Parentheses must be declared using the configured whitespace.
By default there are not any additional spaces inside parentheses, however with
space=single configuration option whitespace inside parentheses will be
unified to single space.
Whether to have single or none space inside parentheses.
Allowed values: 'none' and 'single'
Default value: 'none'
Default configuration.
--- Original
+++ New
<?php
-if ( $a ) {
- foo( );
+if ($a) {
+ foo();
}With configuration: ['space' => 'none'].
--- Original
+++ New
<?php
-function foo( $bar, $baz )
+function foo($bar, $baz)
{
}With configuration: ['space' => 'single'].
--- Original
+++ New
<?php
-if ($a) {
- foo( );
+if ( $a ) {
+ foo();
}With configuration: ['space' => 'single'].
--- Original
+++ New
<?php
-function foo($bar, $baz)
+function foo( $bar, $baz )
{
}The rule is part of the following rule sets:
- Fixer class: PhpCsFixer\Fixer\Whitespace\SpacesInsideParenthesesFixer
- Test class: PhpCsFixer\Tests\Fixer\Whitespace\SpacesInsideParenthesesFixerTest
The test class defines officially supported behaviour. Each test case is a part of our backward compatibility promise.