|
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;
|
|
147 | 149 | use PhpCsFixer\Fixer\Whitespace\NoWhitespaceInBlankLineFixer;
|
148 | 150 | use PhpCsFixer\Fixer\Whitespace\TypeDeclarationSpacesFixer;
|
149 | 151 | use PhpCsFixer\Fixer\Whitespace\TypesSpacesFixer;
|
| 152 | +use SlevomatCodingStandard\Sniffs\Attributes\DisallowAttributesJoiningSniff; |
| 153 | +use SlevomatCodingStandard\Sniffs\Attributes\DisallowMultipleAttributesPerLineSniff; |
150 | 154 | use SlevomatCodingStandard\Sniffs\Classes\RequireConstructorPropertyPromotionSniff;
|
151 | 155 | use SlevomatCodingStandard\Sniffs\ControlStructures\RequireNullSafeObjectOperatorSniff;
|
152 | 156 | use SlevomatCodingStandard\Sniffs\Exceptions\ReferenceThrowableOnlySniff;
|
|
229 | 233 | RandomApiMigrationFixer::class,
|
230 | 234 | // Cast shall be used, not `settype()`
|
231 | 235 | SetTypeToCastFixer::class,
|
| 236 | + // Attributes declared without arguments must not be followed by empty parentheses. |
| 237 | + AttributeEmptyParenthesesFixer::class, |
232 | 238 | // Array index should always be written by using square braces
|
233 | 239 | NormalizeIndexBraceFixer::class,
|
234 | 240 | // 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.
|
|
409 | 415 | PhpdocToParamTypeFixer::class,
|
410 | 416 | // Takes `@return` annotation of non-mixed types and adjusts accordingly the function signature.
|
411 | 417 | PhpdocToReturnTypeFixer::class,
|
| 418 | + // Requires that only one attribute can be placed inside #[]. |
| 419 | + DisallowAttributesJoiningSniff::class, |
| 420 | + // Disallows multiple attributes of some target on same line. |
| 421 | + DisallowMultipleAttributesPerLineSniff::class, |
412 | 422 | // Promote constructor properties
|
413 | 423 | // @see https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues/5956
|
414 | 424 | RequireConstructorPropertyPromotionSniff::class,
|
|
518 | 528 | // Removes extra blank lines and/or blank lines following configuration
|
519 | 529 | ->withConfiguredRule(NoExtraBlankLinesFixer::class, [
|
520 | 530 | 'tokens' => [
|
521 |
| - 'break', |
| 531 | + 'attribute', |
| 532 | + 'case', |
522 | 533 | 'continue',
|
523 | 534 | 'curly_brace_block',
|
| 535 | + 'default', |
524 | 536 | 'extra',
|
525 | 537 | 'parenthesis_brace_block',
|
526 |
| - 'return', |
527 | 538 | 'square_brace_block',
|
| 539 | + 'switch', |
528 | 540 | 'throw',
|
529 | 541 | 'use',
|
530 | 542 | 'use_trait',
|
|
562 | 574 | FullyQualifiedStrictTypesFixer::class,
|
563 | 575 | ['import_symbols' => true], // Also import symbols from other namespaces than in current file
|
564 | 576 | )
|
| 577 | + // Spaces and newlines in method arguments and attributes |
| 578 | + ->withConfiguredRule( |
| 579 | + MethodArgumentSpaceFixer::class, |
| 580 | + ['attribute_placement' => 'standalone', 'on_multiline' => 'ensure_fully_multiline'], |
| 581 | + ) |
565 | 582 | ->withSkip([
|
566 | 583 | // We allow empty catch statements (but they must have comment - see EmptyCatchCommentSniff)
|
567 | 584 | EmptyStatementSniff::class . '.DetectedCatch' => null,
|
|
0 commit comments