no_useless_concat_operator.rst 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. ===================================
  2. Rule ``no_useless_concat_operator``
  3. ===================================
  4. There should not be useless concat operations.
  5. Configuration
  6. -------------
  7. ``juggle_simple_strings``
  8. ~~~~~~~~~~~~~~~~~~~~~~~~~
  9. Allow for simple string quote juggling if it results in more concat-operations
  10. merges.
  11. Allowed types: ``bool``
  12. Default value: ``false``
  13. Examples
  14. --------
  15. Example #1
  16. ~~~~~~~~~~
  17. *Default* configuration.
  18. .. code-block:: diff
  19. --- Original
  20. +++ New
  21. <?php
  22. -$a = 'a'.'b';
  23. +$a = 'ab';
  24. Example #2
  25. ~~~~~~~~~~
  26. With configuration: ``['juggle_simple_strings' => true]``.
  27. .. code-block:: diff
  28. --- Original
  29. +++ New
  30. <?php
  31. -$a = 'a'."b";
  32. +$a = "ab";
  33. Rule sets
  34. ---------
  35. The rule is part of the following rule sets:
  36. - `@PhpCsFixer <./../../ruleSets/PhpCsFixer.rst>`_
  37. - `@Symfony <./../../ruleSets/Symfony.rst>`_
  38. References
  39. ----------
  40. - Fixer class: `PhpCsFixer\\Fixer\\Operator\\NoUselessConcatOperatorFixer <./../../../src/Fixer/Operator/NoUselessConcatOperatorFixer.php>`_
  41. - Test class: `PhpCsFixer\\Tests\\Fixer\\Operator\\NoUselessConcatOperatorFixerTest <./../../../tests/Fixer/Operator/NoUselessConcatOperatorFixerTest.php>`_
  42. The test class defines officially supported behaviour. Each test case is a part of our backward compatibility promise.