no_spaces_around_offset.rst 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. ================================
  2. Rule ``no_spaces_around_offset``
  3. ================================
  4. There MUST NOT be spaces around offset braces.
  5. Configuration
  6. -------------
  7. ``positions``
  8. ~~~~~~~~~~~~~
  9. Whether spacing should be fixed inside and/or outside the offset braces.
  10. Allowed values: a subset of ``['inside', 'outside']``
  11. Default value: ``['inside', 'outside']``
  12. Examples
  13. --------
  14. Example #1
  15. ~~~~~~~~~~
  16. *Default* configuration.
  17. .. code-block:: diff
  18. --- Original
  19. +++ New
  20. <?php
  21. -$sample = $b [ 'a' ] [ 'b' ];
  22. +$sample = $b['a']['b'];
  23. Example #2
  24. ~~~~~~~~~~
  25. With configuration: ``['positions' => ['inside']]``.
  26. .. code-block:: diff
  27. --- Original
  28. +++ New
  29. <?php
  30. -$sample = $b [ 'a' ] [ 'b' ];
  31. +$sample = $b ['a'] ['b'];
  32. Example #3
  33. ~~~~~~~~~~
  34. With configuration: ``['positions' => ['outside']]``.
  35. .. code-block:: diff
  36. --- Original
  37. +++ New
  38. <?php
  39. -$sample = $b [ 'a' ] [ 'b' ];
  40. +$sample = $b[ 'a' ][ 'b' ];
  41. Rule sets
  42. ---------
  43. The rule is part of the following rule sets:
  44. - `@PhpCsFixer <./../../ruleSets/PhpCsFixer.rst>`_
  45. - `@Symfony <./../../ruleSets/Symfony.rst>`_