no_empty_statement.rst 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. ===========================
  2. Rule ``no_empty_statement``
  3. ===========================
  4. Remove useless (semicolon) statements.
  5. Examples
  6. --------
  7. Example #1
  8. ~~~~~~~~~~
  9. .. code-block:: diff
  10. --- Original
  11. +++ New
  12. -<?php $a = 1;;
  13. +<?php $a = 1;
  14. Example #2
  15. ~~~~~~~~~~
  16. .. code-block:: diff
  17. --- Original
  18. +++ New
  19. -<?php echo 1;2;
  20. +<?php echo 1;
  21. Example #3
  22. ~~~~~~~~~~
  23. .. code-block:: diff
  24. --- Original
  25. +++ New
  26. <?php while(foo()){
  27. - continue 1;
  28. + continue ;
  29. }
  30. Rule sets
  31. ---------
  32. The rule is part of the following rule sets:
  33. - `@PhpCsFixer <./../../ruleSets/PhpCsFixer.rst>`_
  34. - `@Symfony <./../../ruleSets/Symfony.rst>`_
  35. References
  36. ----------
  37. - Fixer class: `PhpCsFixer\\Fixer\\Semicolon\\NoEmptyStatementFixer <./../../../src/Fixer/Semicolon/NoEmptyStatementFixer.php>`_
  38. - Test class: `PhpCsFixer\\Tests\\Fixer\\Semicolon\\NoEmptyStatementFixerTest <./../../../tests/Fixer/Semicolon/NoEmptyStatementFixerTest.php>`_
  39. The test class defines officially supported behaviour. Each test case is a part of our backward compatibility promise.