Fork me on GitHub
a Sensio Labs Product

I ate three cookies 🍪 (v3.40.2) edition

Rule no_whitespace_before_comma_in_array

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

Configuration

after_heredoc

Whether the whitespace between heredoc end and comma should be removed.

Allowed types: bool

Default value: false

Examples

Example #1

Default configuration.

--- Original
+++ New
-<?php $x = array(1 , "2");
+<?php $x = array(1, "2");

Example #2

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

--- Original
+++ New
 <?php
     $x = [<<<EOD
 foo
-EOD
-        , 'bar'
+EOD, 'bar'
     ];

Rule sets

The rule is part of the following rule sets:

Source class

PhpCsFixer\Fixer\ArrayNotation\NoWhitespaceBeforeCommaInArrayFixer