concat_space.rst 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. =====================
  2. Rule ``concat_space``
  3. =====================
  4. Concatenation should be spaced according to configuration.
  5. Configuration
  6. -------------
  7. ``spacing``
  8. ~~~~~~~~~~~
  9. Spacing to apply around concatenation operator.
  10. Allowed values: ``'none'`` and ``'one'``
  11. Default value: ``'none'``
  12. Examples
  13. --------
  14. Example #1
  15. ~~~~~~~~~~
  16. *Default* configuration.
  17. .. code-block:: diff
  18. --- Original
  19. +++ New
  20. <?php
  21. -$foo = 'bar' . 3 . 'baz'.'qux';
  22. +$foo = 'bar'. 3 .'baz'.'qux';
  23. Example #2
  24. ~~~~~~~~~~
  25. With configuration: ``['spacing' => 'none']``.
  26. .. code-block:: diff
  27. --- Original
  28. +++ New
  29. <?php
  30. -$foo = 'bar' . 3 . 'baz'.'qux';
  31. +$foo = 'bar'. 3 .'baz'.'qux';
  32. Example #3
  33. ~~~~~~~~~~
  34. With configuration: ``['spacing' => 'one']``.
  35. .. code-block:: diff
  36. --- Original
  37. +++ New
  38. <?php
  39. -$foo = 'bar' . 3 . 'baz'.'qux';
  40. +$foo = 'bar' . 3 . 'baz' . 'qux';
  41. Rule sets
  42. ---------
  43. The rule is part of the following rule sets:
  44. - `@PER <./../../ruleSets/PER.rst>`_ with config:
  45. ``['spacing' => 'one']``
  46. - `@PER-CS <./../../ruleSets/PER-CS.rst>`_ with config:
  47. ``['spacing' => 'one']``
  48. - `@PER-CS2.0 <./../../ruleSets/PER-CS2.0.rst>`_ with config:
  49. ``['spacing' => 'one']``
  50. - `@PhpCsFixer <./../../ruleSets/PhpCsFixer.rst>`_
  51. - `@Symfony <./../../ruleSets/Symfony.rst>`_
  52. References
  53. ----------
  54. - Fixer class: `PhpCsFixer\\Fixer\\Operator\\ConcatSpaceFixer <./../../../src/Fixer/Operator/ConcatSpaceFixer.php>`_
  55. - Test class: `PhpCsFixer\\Tests\\Fixer\\Operator\\ConcatSpaceFixerTest <./../../../tests/Fixer/Operator/ConcatSpaceFixerTest.php>`_
  56. The test class defines officially supported behaviour. Each test case is a part of our backward compatibility promise.