heredoc_indentation.rst 863 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. ============================
  2. Rule ``heredoc_indentation``
  3. ============================
  4. Heredoc/nowdoc content must be properly indented. Requires PHP >= 7.3.
  5. Examples
  6. --------
  7. Example #1
  8. ~~~~~~~~~~
  9. .. code-block:: diff
  10. --- Original
  11. +++ New
  12. @@ -1,5 +1,5 @@
  13. <?php
  14. $a = <<<EOD
  15. -abc
  16. - def
  17. -EOD;
  18. + abc
  19. + def
  20. + EOD;
  21. Example #2
  22. ~~~~~~~~~~
  23. .. code-block:: diff
  24. --- Original
  25. +++ New
  26. @@ -1,5 +1,5 @@
  27. <?php
  28. $a = <<<'EOD'
  29. -abc
  30. - def
  31. -EOD;
  32. + abc
  33. + def
  34. + EOD;
  35. Rule sets
  36. ---------
  37. The rule is part of the following rule sets:
  38. @PHP73Migration
  39. Using the ``@PHP73Migration`` rule set will enable the ``heredoc_indentation`` rule.
  40. @PHP80Migration
  41. Using the ``@PHP80Migration`` rule set will enable the ``heredoc_indentation`` rule.