File tree Expand file tree Collapse file tree
tests/Integration/Fixtures Expand file tree Collapse file tree Original file line number Diff line number Diff line change 6868use PhpCsFixer \Fixer \FunctionNotation \CombineNestedDirnameFixer ;
6969use PhpCsFixer \Fixer \FunctionNotation \FopenFlagOrderFixer ;
7070use PhpCsFixer \Fixer \FunctionNotation \FopenFlagsFixer ;
71+ use PhpCsFixer \Fixer \FunctionNotation \FunctionDeclarationFixer ;
7172use PhpCsFixer \Fixer \FunctionNotation \ImplodeCallFixer ;
7273use PhpCsFixer \Fixer \FunctionNotation \LambdaNotUsedImportFixer ;
7374use PhpCsFixer \Fixer \FunctionNotation \NoUnreachableDefaultArgumentValueFixer ;
541542 ],
542543 ],
543544 )
545+ // Spaces should be properly placed in a function declaration.
546+ ->withConfiguredRule (
547+ FunctionDeclarationFixer::class,
548+ ['closure_fn_spacing ' => 'none ' ], // Defined in PER 2.0
549+ )
544550 ->withSkip ([
545551 // We allow empty catch statements (but they must have comment - see EmptyCatchCommentSniff)
546552 EmptyStatementSniff::class . '.DetectedCatch ' => null ,
Original file line number Diff line number Diff line change @@ -38,8 +38,16 @@ class Basic
3838 return false ; // BlankLineBeforeStatementFixer
3939 }
4040
41- public function fooBar (mixed $ foo ): mixed
41+ public function fooBar (mixed $ foo ): mixed // FunctionDeclarationFixer
4242 {
43+ $ value = 5 ;
44+ // FunctionDeclarationFixer
45+ $ function = function ($ foo ) use ($ value ) {
46+ return $ foo + $ value ;
47+ };
48+ // FunctionDeclarationFixer
49+ $ fn = fn ($ foo ) => $ foo + $ value ;
50+
4351 // PhpdocToCommentFixer
4452 /*
4553 * Phpdoc used instead of plain comment
Original file line number Diff line number Diff line change @@ -31,8 +31,16 @@ class Basic
3131
3232 public const MY_PUBLIC_CONST = 333 ; // OrderedClassElementsFixer
3333
34- public function fooBar ( mixed $ foo ): mixed
34+ public function fooBar ( mixed $ foo ): mixed // FunctionDeclarationFixer
3535 {
36+ $ value = 5 ;
37+ // FunctionDeclarationFixer
38+ $ function = function ($ foo )use ($ value ) {
39+ return $ foo + $ value ;
40+ };
41+ // FunctionDeclarationFixer
42+ $ fn = fn ($ foo ) => $ foo + $ value ;
43+
3644 // PhpdocToCommentFixer
3745 /**
3846 * Phpdoc used instead of plain comment
You can’t perform that action at this time.
0 commit comments