no_useless_else.rst 514 B

123456789101112131415161718192021222324252627282930313233
  1. ========================
  2. Rule ``no_useless_else``
  3. ========================
  4. There should not be useless ``else`` cases.
  5. Examples
  6. --------
  7. Example #1
  8. ~~~~~~~~~~
  9. .. code-block:: diff
  10. --- Original
  11. +++ New
  12. @@ -1,6 +1,6 @@
  13. <?php
  14. if ($a) {
  15. return 1;
  16. -} else {
  17. +}
  18. return 2;
  19. -}
  20. +
  21. Rule sets
  22. ---------
  23. The rule is part of the following rule set:
  24. @PhpCsFixer
  25. Using the `@PhpCsFixer <./../../ruleSets/PhpCsFixer.rst>`_ rule set will enable the ``no_useless_else`` rule.