ternary_operator_spaces.rst 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. ================================
  2. Rule ``ternary_operator_spaces``
  3. ================================
  4. Standardize spaces around ternary operator.
  5. Examples
  6. --------
  7. Example #1
  8. ~~~~~~~~~~
  9. .. code-block:: diff
  10. --- Original
  11. +++ New
  12. -<?php $a = $a ?1 :0;
  13. +<?php $a = $a ? 1 : 0;
  14. Rule sets
  15. ---------
  16. The rule is part of the following rule sets:
  17. - `@PER <./../../ruleSets/PER.rst>`_
  18. - `@PER-CS <./../../ruleSets/PER-CS.rst>`_
  19. - `@PER-CS1.0 <./../../ruleSets/PER-CS1.0.rst>`_
  20. - `@PER-CS2.0 <./../../ruleSets/PER-CS2.0.rst>`_
  21. - `@PSR12 <./../../ruleSets/PSR12.rst>`_
  22. - `@PhpCsFixer <./../../ruleSets/PhpCsFixer.rst>`_
  23. - `@Symfony <./../../ruleSets/Symfony.rst>`_
  24. References
  25. ----------
  26. - Fixer class: `PhpCsFixer\\Fixer\\Operator\\TernaryOperatorSpacesFixer <./../../../src/Fixer/Operator/TernaryOperatorSpacesFixer.php>`_
  27. - Test class: `PhpCsFixer\\Tests\\Fixer\\Operator\\TernaryOperatorSpacesFixerTest <./../../../tests/Fixer/Operator/TernaryOperatorSpacesFixerTest.php>`_
  28. The test class defines officially supported behaviour. Each test case is a part of our backward compatibility promise.