no_superfluous_elseif.rst 913 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. ==============================
  2. Rule ``no_superfluous_elseif``
  3. ==============================
  4. Replaces superfluous ``elseif`` with ``if``.
  5. Examples
  6. --------
  7. Example #1
  8. ~~~~~~~~~~
  9. .. code-block:: diff
  10. --- Original
  11. +++ New
  12. <?php
  13. if ($a) {
  14. return 1;
  15. -} elseif ($b) {
  16. +}
  17. +if ($b) {
  18. return 2;
  19. }
  20. Rule sets
  21. ---------
  22. The rule is part of the following rule set:
  23. - `@PhpCsFixer <./../../ruleSets/PhpCsFixer.rst>`_
  24. References
  25. ----------
  26. - Fixer class: `PhpCsFixer\\Fixer\\ControlStructure\\NoSuperfluousElseifFixer <./../../../src/Fixer/ControlStructure/NoSuperfluousElseifFixer.php>`_
  27. - Test class: `PhpCsFixer\\Tests\\Fixer\\ControlStructure\\NoSuperfluousElseifFixerTest <./../../../tests/Fixer/ControlStructure/NoSuperfluousElseifFixerTest.php>`_
  28. The test class defines officially supported behaviour. Each test case is a part of our backward compatibility promise.