Skip to content

Latest commit

 

History

History
60 lines (40 loc) · 1.21 KB

whitespace_after_comma_in_array.rst

File metadata and controls

60 lines (40 loc) · 1.21 KB

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

Using the @PhpCsFixer rule set will enable the whitespace_after_comma_in_array rule with the config below:

['ensure_single_space' => true]

@Symfony
Using the @Symfony rule set will enable the whitespace_after_comma_in_array rule with the default config.