@@ -129,7 +129,7 @@ public function testRegisteredSniffCodes($key, $value)
129
129
*
130
130
* @see self::testRegisteredSniffCodes()
131
131
*
132
- * @return array
132
+ * @return array<array<string>>
133
133
*/
134
134
public static function dataRegisteredSniffCodes ()
135
135
{
@@ -335,9 +335,9 @@ public static function dataRegisteredSniffCodes()
335
335
* Test that setting properties for standards, categories, sniffs works for all supported rule
336
336
* inclusion methods.
337
337
*
338
- * @param string $sniffClass The name of the sniff class.
339
- * @param string $propertyName The name of the changed property.
340
- * @param mixed $expectedValue The value expected for the property.
338
+ * @param string $sniffClass The name of the sniff class.
339
+ * @param string $propertyName The name of the changed property.
340
+ * @param string|int|bool $expectedValue The value expected for the property.
341
341
*
342
342
* @dataProvider dataSettingProperties
343
343
*
@@ -362,62 +362,62 @@ public function testSettingProperties($sniffClass, $propertyName, $expectedValue
362
362
*
363
363
* @see self::testSettingProperties()
364
364
*
365
- * @return array
365
+ * @return array<string, array<string, string|int|bool>>
366
366
*/
367
367
public static function dataSettingProperties ()
368
368
{
369
369
return [
370
370
'Set property for complete standard: PSR2 ClassDeclaration ' => [
371
- 'PHP_CodeSniffer\Standards\PSR2\Sniffs\Classes\ClassDeclarationSniff ' ,
372
- 'indent ' ,
373
- '20 ' ,
371
+ 'sniffClass ' => ' PHP_CodeSniffer\Standards\PSR2\Sniffs\Classes\ClassDeclarationSniff ' ,
372
+ 'propertyName ' => ' indent ' ,
373
+ 'expectedValue ' => ' 20 ' ,
374
374
],
375
375
'Set property for complete standard: PSR2 SwitchDeclaration ' => [
376
- 'PHP_CodeSniffer\Standards\PSR2\Sniffs\ControlStructures\SwitchDeclarationSniff ' ,
377
- 'indent ' ,
378
- '20 ' ,
376
+ 'sniffClass ' => ' PHP_CodeSniffer\Standards\PSR2\Sniffs\ControlStructures\SwitchDeclarationSniff ' ,
377
+ 'propertyName ' => ' indent ' ,
378
+ 'expectedValue ' => ' 20 ' ,
379
379
],
380
380
'Set property for complete standard: PSR2 FunctionCallSignature ' => [
381
- 'PHP_CodeSniffer\Standards\PSR2\Sniffs\Methods\FunctionCallSignatureSniff ' ,
382
- 'indent ' ,
383
- '20 ' ,
381
+ 'sniffClass ' => ' PHP_CodeSniffer\Standards\PSR2\Sniffs\Methods\FunctionCallSignatureSniff ' ,
382
+ 'propertyName ' => ' indent ' ,
383
+ 'expectedValue ' => ' 20 ' ,
384
384
],
385
385
'Set property for complete category: PSR12 OperatorSpacing ' => [
386
- 'PHP_CodeSniffer\Standards\PSR12\Sniffs\Operators\OperatorSpacingSniff ' ,
387
- 'ignoreSpacingBeforeAssignments ' ,
388
- false ,
386
+ 'sniffClass ' => ' PHP_CodeSniffer\Standards\PSR12\Sniffs\Operators\OperatorSpacingSniff ' ,
387
+ 'propertyName ' => ' ignoreSpacingBeforeAssignments ' ,
388
+ ' expectedValue ' => false ,
389
389
],
390
390
'Set property for individual sniff: Generic ArrayIndent ' => [
391
- 'PHP_CodeSniffer\Standards\Generic\Sniffs\Arrays\ArrayIndentSniff ' ,
392
- 'indent ' ,
393
- '2 ' ,
391
+ 'sniffClass ' => ' PHP_CodeSniffer\Standards\Generic\Sniffs\Arrays\ArrayIndentSniff ' ,
392
+ 'propertyName ' => ' indent ' ,
393
+ 'expectedValue ' => ' 2 ' ,
394
394
],
395
395
'Set property for individual sniff using sniff file inclusion: Generic LineLength ' => [
396
- 'PHP_CodeSniffer\Standards\Generic\Sniffs\Files\LineLengthSniff ' ,
397
- 'lineLimit ' ,
398
- '10 ' ,
396
+ 'sniffClass ' => ' PHP_CodeSniffer\Standards\Generic\Sniffs\Files\LineLengthSniff ' ,
397
+ 'propertyName ' => ' lineLimit ' ,
398
+ 'expectedValue ' => ' 10 ' ,
399
399
],
400
400
'Set property for individual sniff using sniff file inclusion: CamelCapsFunctionName ' => [
401
- 'PHP_CodeSniffer\Standards\Generic\Sniffs\NamingConventions\CamelCapsFunctionNameSniff ' ,
402
- 'strict ' ,
403
- false ,
401
+ 'sniffClass ' => ' PHP_CodeSniffer\Standards\Generic\Sniffs\NamingConventions\CamelCapsFunctionNameSniff ' ,
402
+ 'propertyName ' => ' strict ' ,
403
+ ' expectedValue ' => false ,
404
404
],
405
405
'Set property for individual sniff via included ruleset: NestingLevel - nestingLevel ' => [
406
- 'PHP_CodeSniffer\Standards\Generic\Sniffs\Metrics\NestingLevelSniff ' ,
407
- 'nestingLevel ' ,
408
- '2 ' ,
406
+ 'sniffClass ' => ' PHP_CodeSniffer\Standards\Generic\Sniffs\Metrics\NestingLevelSniff ' ,
407
+ 'propertyName ' => ' nestingLevel ' ,
408
+ 'expectedValue ' => ' 2 ' ,
409
409
],
410
410
'Set property for all sniffs in an included ruleset: NestingLevel - absoluteNestingLevel ' => [
411
- 'PHP_CodeSniffer\Standards\Generic\Sniffs\Metrics\NestingLevelSniff ' ,
412
- 'absoluteNestingLevel ' ,
413
- true ,
411
+ 'sniffClass ' => ' PHP_CodeSniffer\Standards\Generic\Sniffs\Metrics\NestingLevelSniff ' ,
412
+ 'propertyName ' => ' absoluteNestingLevel ' ,
413
+ ' expectedValue ' => true ,
414
414
],
415
415
416
416
// Testing that setting a property at error code level does *not* work.
417
417
'Set property for error code will not change the sniff property value: CyclomaticComplexity ' => [
418
- 'PHP_CodeSniffer\Standards\Generic\Sniffs\Metrics\CyclomaticComplexitySniff ' ,
419
- 'complexity ' ,
420
- 10 ,
418
+ 'sniffClass ' => ' PHP_CodeSniffer\Standards\Generic\Sniffs\Metrics\CyclomaticComplexitySniff ' ,
419
+ 'propertyName ' => ' complexity ' ,
420
+ ' expectedValue ' => 10 ,
421
421
],
422
422
];
423
423
@@ -453,22 +453,22 @@ public function testSettingInvalidPropertiesOnStandardsAndCategoriesSilentlyFail
453
453
*
454
454
* @see self::testSettingInvalidPropertiesOnStandardsAndCategoriesSilentlyFails()
455
455
*
456
- * @return array
456
+ * @return array<string, array>string, string>>
457
457
*/
458
458
public static function dataSettingInvalidPropertiesOnStandardsAndCategoriesSilentlyFails ()
459
459
{
460
460
return [
461
461
'Set property for complete standard: PSR2 ClassDeclaration ' => [
462
- 'PHP_CodeSniffer\Standards\PSR1\Sniffs\Classes\ClassDeclarationSniff ' ,
463
- 'setforallsniffs ' ,
462
+ 'sniffClass ' => ' PHP_CodeSniffer\Standards\PSR1\Sniffs\Classes\ClassDeclarationSniff ' ,
463
+ 'propertyName ' => ' setforallsniffs ' ,
464
464
],
465
465
'Set property for complete standard: PSR2 FunctionCallSignature ' => [
466
- 'PHP_CodeSniffer\Standards\PSR2\Sniffs\Methods\FunctionCallSignatureSniff ' ,
467
- 'setforallsniffs ' ,
466
+ 'sniffClass ' => ' PHP_CodeSniffer\Standards\PSR2\Sniffs\Methods\FunctionCallSignatureSniff ' ,
467
+ 'propertyName ' => ' setforallsniffs ' ,
468
468
],
469
469
'Set property for complete category: PSR12 OperatorSpacing ' => [
470
- 'PHP_CodeSniffer\Standards\PSR12\Sniffs\Operators\OperatorSpacingSniff ' ,
471
- 'setforallincategory ' ,
470
+ 'sniffClass ' => ' PHP_CodeSniffer\Standards\PSR12\Sniffs\Operators\OperatorSpacingSniff ' ,
471
+ 'propertyName ' => ' setforallincategory ' ,
472
472
],
473
473
];
474
474
0 commit comments