Fork me on GitHub
a Sensio Labs Product

7th Gear (v3.57.2) edition

Rule whitespace_after_comma_in_array

In array declaration, there MUST be a whitespace after each comma.



If there are only horizontal whitespaces after the comma then ensure it is a single space.

Allowed types: bool

Default value: false


Example #1

Default configuration.

--- Original
+++ New
-$sample = array(1,'a',$b,);
+$sample = array(1, 'a', $b, );

Example #2

With configuration: ['ensure_single_space' => true].

--- Original
+++ New
-$sample = [1,2, 3,  4,    5];
+$sample = [1, 2, 3, 4, 5];

Rule sets

The rule is part of the following rule sets:


The test class defines officially supported behaviour. Each test case is a part of our backward compatibility promise.