strict_comparison.rst 912 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. ==========================
  2. Rule ``strict_comparison``
  3. ==========================
  4. Comparisons should be strict.
  5. Warning
  6. -------
  7. Using this rule is risky
  8. ~~~~~~~~~~~~~~~~~~~~~~~~
  9. Changing comparisons to strict might change code behavior.
  10. Examples
  11. --------
  12. Example #1
  13. ~~~~~~~~~~
  14. .. code-block:: diff
  15. --- Original
  16. +++ New
  17. <?php
  18. -$a = 1== $b;
  19. +$a = 1=== $b;
  20. Rule sets
  21. ---------
  22. The rule is part of the following rule set:
  23. - `@PhpCsFixer:risky <./../../ruleSets/PhpCsFixerRisky.rst>`_
  24. References
  25. ----------
  26. - Fixer class: `PhpCsFixer\\Fixer\\Strict\\StrictComparisonFixer <./../../../src/Fixer/Strict/StrictComparisonFixer.php>`_
  27. - Test class: `PhpCsFixer\\Tests\\Fixer\\Strict\\StrictComparisonFixerTest <./../../../tests/Fixer/Strict/StrictComparisonFixerTest.php>`_
  28. The test class defines officially supported behaviour. Each test case is a part of our backward compatibility promise.