Fork me on GitHub
a Sensio Labs Product

Space Sets (v3.64.0) edition

Rule no_spaces_around_offset

There MUST NOT be spaces around offset braces.

Configuration

positions

Whether spacing should be fixed inside and/or outside the offset braces.

Allowed values: a subset of ['inside', 'outside']

Default value: ['inside', 'outside']

Examples

Example #1

Default configuration.

--- Original
+++ New
 <?php
-$sample = $b [ 'a' ] [ 'b' ];
+$sample = $b['a']['b'];

Example #2

With configuration: ['positions' => ['inside']].

--- Original
+++ New
 <?php
-$sample = $b [ 'a' ] [ 'b' ];
+$sample = $b ['a'] ['b'];

Example #3

With configuration: ['positions' => ['outside']].

--- Original
+++ New
 <?php
-$sample = $b [ 'a' ] [ 'b' ];
+$sample = $b[ 'a' ][ 'b' ];

Rule sets

The rule is part of the following rule sets:

References

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