Array Indent

The opening brace of a multi-line array must be indented at least to the same level as the start of the statement.

Valid: Opening brace of a multi-line array indented to the same level as the start of the statement.

$b = <em>[</em> 1, 2, ];

if ($condition) { $a = <em> [</em> 1, 2, ]; }

Invalid: Opening brace of a multi-line array not indented to the same level as the start of the statement.

if ($condition) { $a = <em>[</em> 1, 2, ]; }
Each array element must be indented exactly four spaces from the start of the statement.

Valid: Each array element is indented by exactly four spaces.

$a = array( <em> </em>1, <em> </em>2, <em> </em>3, );

Invalid: Array elements not indented by four spaces.

$a = array( <em> </em>1, <em> </em>2, <em> </em>3, );
The array closing brace must be on a new line.

Valid: Array closing brace on its own line.

$a = [ 1, 2,<em> ]</em>;

Invalid: Array closing brace not on its own line.

$a = [ 1, 2,<em>]</em>;
The closing brace must be aligned with the start of the statement containing the array opener.

Valid: Closing brace aligned with the start of the statement containing the array opener.

$a = array( 1, 2, <em>)</em>;

Invalid: Closing brace not aligned with the start of the statement containing the array opener.

$a = array( 1, 2, <em> )</em>;