Spaces should be properly placed in a function declaration.
Spacing to use before open parenthesis for short arrow functions.
Allowed values: 'none'
and 'one'
Default value: 'one'
Spacing to use before open parenthesis for closures.
Allowed values: 'none'
and 'one'
Default value: 'one'
Whether trailing commas are allowed in single line signatures.
Allowed types: bool
Default value: false
Default configuration.
--- Original
+++ New
<?php
class Foo
{
- public static function bar ( $baz , $foo )
+ public static function bar($baz , $foo)
{
return false;
}
}
-function foo ($bar, $baz)
+function foo($bar, $baz)
{
return false;
}
With configuration: ['closure_function_spacing' => 'none']
.
--- Original
+++ New
<?php
-$f = function () {};
+$f = function() {};
With configuration: ['closure_fn_spacing' => 'none']
.
--- Original
+++ New
<?php
-$f = fn () => null;
+$f = fn() => null;
The rule is part of the following rule sets:
@PER with config:
['closure_fn_spacing' => 'none']
@PER-CS with config:
['closure_fn_spacing' => 'none']
@PER-CS2.0 with config:
['closure_fn_spacing' => 'none']
- Fixer class: PhpCsFixer\Fixer\FunctionNotation\FunctionDeclarationFixer
- Test class: PhpCsFixer\Tests\Fixer\FunctionNotation\FunctionDeclarationFixerTest
The test class defines officially supported behaviour. Each test case is a part of our backward compatibility promise.