
Rule whitespace_after_comma_in_array
ΒΆ
In array declaration, there MUST be a whitespace after each comma.
ConfigurationΒΆ
ensure_single_space
ΒΆ
If there are only horizontal whitespaces after the comma then ensure it is a single space.
Allowed types: bool
Default value: false
ExamplesΒΆ
Example #1ΒΆ
Default configuration.
--- Original
+++ New
<?php
-$sample = array(1,'a',$b,);
+$sample = array(1, 'a', $b, );
Example #2ΒΆ
With configuration: ['ensure_single_space' => true]
.
--- Original
+++ New
<?php
-$sample = [1,2, 3, 4, 5];
+$sample = [1, 2, 3, 4, 5];
Rule setsΒΆ
The rule is part of the following rule sets:
@PhpCsFixer with config:
['ensure_single_space' => true]
Source classΒΆ
PhpCsFixer\Fixer\ArrayNotation\WhitespaceAfterCommaInArrayFixer