Fork me on GitHub
a Sensio Labs Product

I ate three cookies πŸͺ (v3.40.2) 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:

Source classΒΆ

PhpCsFixer\Fixer\Whitespace\NoSpacesAroundOffsetFixer