|
43 | 43 | use PhpCsFixer\Fixer\ArrayNotation\NormalizeIndexBraceFixer;
|
44 | 44 | use PhpCsFixer\Fixer\ArrayNotation\TrimArraySpacesFixer;
|
45 | 45 | use PhpCsFixer\Fixer\ArrayNotation\WhitespaceAfterCommaInArrayFixer;
|
| 46 | +use PhpCsFixer\Fixer\AttributeNotation\AttributeEmptyParenthesesFixer; |
46 | 47 | use PhpCsFixer\Fixer\Basic\BracesFixer;
|
47 | 48 | use PhpCsFixer\Fixer\Basic\NoTrailingCommaInSinglelineFixer;
|
48 | 49 | use PhpCsFixer\Fixer\Basic\PsrAutoloadingFixer;
|
|
72 | 73 | use PhpCsFixer\Fixer\FunctionNotation\FunctionDeclarationFixer;
|
73 | 74 | use PhpCsFixer\Fixer\FunctionNotation\ImplodeCallFixer;
|
74 | 75 | use PhpCsFixer\Fixer\FunctionNotation\LambdaNotUsedImportFixer;
|
| 76 | +use PhpCsFixer\Fixer\FunctionNotation\MethodArgumentSpaceFixer; |
75 | 77 | use PhpCsFixer\Fixer\FunctionNotation\NoUnreachableDefaultArgumentValueFixer;
|
76 | 78 | use PhpCsFixer\Fixer\FunctionNotation\NoUselessSprintfFixer;
|
77 | 79 | use PhpCsFixer\Fixer\FunctionNotation\PhpdocToParamTypeFixer;
|
|
148 | 150 | use PhpCsFixer\Fixer\Whitespace\NoWhitespaceInBlankLineFixer;
|
149 | 151 | use PhpCsFixer\Fixer\Whitespace\TypeDeclarationSpacesFixer;
|
150 | 152 | use PhpCsFixer\Fixer\Whitespace\TypesSpacesFixer;
|
| 153 | +use SlevomatCodingStandard\Sniffs\Attributes\DisallowAttributesJoiningSniff; |
| 154 | +use SlevomatCodingStandard\Sniffs\Attributes\DisallowMultipleAttributesPerLineSniff; |
151 | 155 | use SlevomatCodingStandard\Sniffs\Classes\RequireConstructorPropertyPromotionSniff;
|
152 | 156 | use SlevomatCodingStandard\Sniffs\ControlStructures\RequireNullSafeObjectOperatorSniff;
|
153 | 157 | use SlevomatCodingStandard\Sniffs\Exceptions\ReferenceThrowableOnlySniff;
|
|
230 | 234 | RandomApiMigrationFixer::class,
|
231 | 235 | // Cast shall be used, not `settype()`
|
232 | 236 | SetTypeToCastFixer::class,
|
| 237 | + // Attributes declared without arguments must not be followed by empty parentheses. |
| 238 | + AttributeEmptyParenthesesFixer::class, |
233 | 239 | // Array index should always be written by using square braces
|
234 | 240 | NormalizeIndexBraceFixer::class,
|
235 | 241 | // Empty body of class, interface, trait, enum or function must be abbreviated as {} and placed on the same line as the previous symbol, separated by a single space.
|
|
415 | 421 | // Takes `@return` annotation of non-mixed types and adjusts accordingly the function signature.
|
416 | 422 | PhpdocToReturnTypeFixer::class,
|
417 | 423 | ReturnTypeHintSniff::class,
|
| 424 | + // Requires that only one attribute can be placed inside #[]. |
| 425 | + DisallowAttributesJoiningSniff::class, |
| 426 | + // Disallows multiple attributes of some target on same line. |
| 427 | + DisallowMultipleAttributesPerLineSniff::class, |
418 | 428 | // Promote constructor properties
|
419 | 429 | // For php-cs-fixer implementation @see https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues/5956
|
420 | 430 | RequireConstructorPropertyPromotionSniff::class,
|
|
520 | 530 | // Removes extra blank lines and/or blank lines following configuration
|
521 | 531 | ->withConfiguredRule(NoExtraBlankLinesFixer::class, [
|
522 | 532 | 'tokens' => [
|
523 |
| - 'break', |
| 533 | + 'attribute', |
| 534 | + 'case', |
524 | 535 | 'continue',
|
525 | 536 | 'curly_brace_block',
|
| 537 | + 'default', |
526 | 538 | 'extra',
|
527 | 539 | 'parenthesis_brace_block',
|
528 |
| - 'return', |
529 | 540 | 'square_brace_block',
|
| 541 | + 'switch', |
530 | 542 | 'throw',
|
531 | 543 | 'use',
|
532 | 544 | 'use_trait',
|
|
564 | 576 | FullyQualifiedStrictTypesFixer::class,
|
565 | 577 | ['import_symbols' => true], // Also import symbols from other namespaces than in current file
|
566 | 578 | )
|
| 579 | + // Spaces and newlines in method arguments and attributes |
| 580 | + ->withConfiguredRule( |
| 581 | + MethodArgumentSpaceFixer::class, |
| 582 | + ['attribute_placement' => 'standalone', 'on_multiline' => 'ensure_fully_multiline'], |
| 583 | + ) |
567 | 584 | ->withSkip([
|
568 | 585 | // We allow empty catch statements (but they must have comment - see EmptyCatchCommentSniff)
|
569 | 586 | EmptyStatementSniff::class . '.DetectedCatch' => null,
|
|
0 commit comments