no_mixed_echo_print.rst 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. ============================
  2. Rule ``no_mixed_echo_print``
  3. ============================
  4. Either language construct ``print`` or ``echo`` should be used.
  5. Configuration
  6. -------------
  7. ``use``
  8. ~~~~~~~
  9. The desired language construct.
  10. Allowed values: ``'echo'`` and ``'print'``
  11. Default value: ``'echo'``
  12. Examples
  13. --------
  14. Example #1
  15. ~~~~~~~~~~
  16. *Default* configuration.
  17. .. code-block:: diff
  18. --- Original
  19. +++ New
  20. -<?php print 'example';
  21. +<?php echo 'example';
  22. Example #2
  23. ~~~~~~~~~~
  24. With configuration: ``['use' => 'print']``.
  25. .. code-block:: diff
  26. --- Original
  27. +++ New
  28. -<?php echo('example');
  29. +<?php print('example');
  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\\Alias\\NoMixedEchoPrintFixer <./../../../src/Fixer/Alias/NoMixedEchoPrintFixer.php>`_
  38. - Test class: `PhpCsFixer\\Tests\\Fixer\\Alias\\NoMixedEchoPrintFixerTest <./../../../tests/Fixer/Alias/NoMixedEchoPrintFixerTest.php>`_
  39. The test class defines officially supported behaviour. Each test case is a part of our backward compatibility promise.