single_line_throw.rst 888 B

12345678910111213141516171819202122232425262728293031323334353637
  1. ==========================
  2. Rule ``single_line_throw``
  3. ==========================
  4. Throwing exception must be done in single line.
  5. Examples
  6. --------
  7. Example #1
  8. ~~~~~~~~~~
  9. .. code-block:: diff
  10. --- Original
  11. +++ New
  12. <?php
  13. -throw new Exception(
  14. - 'Error.',
  15. - 500
  16. -);
  17. +throw new Exception('Error.', 500);
  18. Rule sets
  19. ---------
  20. The rule is part of the following rule set:
  21. - `@Symfony <./../../ruleSets/Symfony.rst>`_
  22. References
  23. ----------
  24. - Fixer class: `PhpCsFixer\\Fixer\\FunctionNotation\\SingleLineThrowFixer <./../../../src/Fixer/FunctionNotation/SingleLineThrowFixer.php>`_
  25. - Test class: `PhpCsFixer\\Tests\\Fixer\\FunctionNotation\\SingleLineThrowFixerTest <./../../../tests/Fixer/FunctionNotation/SingleLineThrowFixerTest.php>`_
  26. The test class defines officially supported behaviour. Each test case is a part of our backward compatibility promise.