aik099 / CodingStandard

The PHP_CodeSniffer coding standard I'm using on all of my projects
BSD 3-Clause "New" or "Revised" License
5 stars 2 forks source link

Validate comma spacing in arrays #15

Closed aik099 closed 9 years ago

aik099 commented 10 years ago

We need to validate that for cases when:

  1. there are several elements of array placed in a single line (not exactly inline array)
  2. not for last element in a row

we need to ensure that a space is present after comma.

Valid:

$something = array(1 => 'aa', 'bb' => 'cc');

Invalid:

$something = array(1 => 'aa','bb' => 'cc');

The ArrayDeclaration sniff from Squiz coding standard has some good code for checking what we need, but it only applies to inline arrays.

aik099 commented 9 years ago

Closing as special case of #54, which obviously more general case for that problem.