elseif.rst 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. ===============
  2. Rule ``elseif``
  3. ===============
  4. The keyword ``elseif`` should be used instead of ``else if`` so that all control
  5. keywords look like single words.
  6. Examples
  7. --------
  8. Example #1
  9. ~~~~~~~~~~
  10. .. code-block:: diff
  11. --- Original
  12. +++ New
  13. <?php
  14. if ($a) {
  15. -} else if ($b) {
  16. +} elseif ($b) {
  17. }
  18. Rule sets
  19. ---------
  20. The rule is part of the following rule sets:
  21. - `@PER <./../../ruleSets/PER.rst>`_
  22. - `@PER-CS <./../../ruleSets/PER-CS.rst>`_
  23. - `@PER-CS1.0 <./../../ruleSets/PER-CS1.0.rst>`_
  24. - `@PER-CS2.0 <./../../ruleSets/PER-CS2.0.rst>`_
  25. - `@PSR2 <./../../ruleSets/PSR2.rst>`_
  26. - `@PSR12 <./../../ruleSets/PSR12.rst>`_
  27. - `@PhpCsFixer <./../../ruleSets/PhpCsFixer.rst>`_
  28. - `@Symfony <./../../ruleSets/Symfony.rst>`_
  29. References
  30. ----------
  31. - Fixer class: `PhpCsFixer\\Fixer\\ControlStructure\\ElseifFixer <./../../../src/Fixer/ControlStructure/ElseifFixer.php>`_
  32. - Test class: `PhpCsFixer\\Tests\\Fixer\\ControlStructure\\ElseifFixerTest <./../../../tests/Fixer/ControlStructure/ElseifFixerTest.php>`_
  33. The test class defines officially supported behaviour. Each test case is a part of our backward compatibility promise.