Rule concat_space
¶
Concatenation should be spaced according to configuration.
Configuration¶
spacing
¶
Spacing to apply around concatenation operator.
Allowed values: 'none'
and 'one'
Default value: 'none'
Examples¶
Example #1¶
Default configuration.
--- Original
+++ New
<?php
-$foo = 'bar' . 3 . 'baz'.'qux';
+$foo = 'bar'. 3 .'baz'.'qux';
Example #2¶
With configuration: ['spacing' => 'none']
.
--- Original
+++ New
<?php
-$foo = 'bar' . 3 . 'baz'.'qux';
+$foo = 'bar'. 3 .'baz'.'qux';
Example #3¶
With configuration: ['spacing' => 'one']
.
--- Original
+++ New
<?php
-$foo = 'bar' . 3 . 'baz'.'qux';
+$foo = 'bar' . 3 . 'baz' . 'qux';
Rule sets¶
The rule is part of the following rule sets:
@PER with config:
['spacing' => 'one']
@PER-CS with config:
['spacing' => 'one']
@PER-CS2.0 with config:
['spacing' => 'one']
References¶
Fixer class: PhpCsFixer\Fixer\Operator\ConcatSpaceFixer
Test class: PhpCsFixer\Tests\Fixer\Operator\ConcatSpaceFixerTest
The test class defines officially supported behaviour. Each test case is a part of our backward compatibility promise.