is_null.rst 706 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. ================
  2. Rule ``is_null``
  3. ================
  4. Replaces ``is_null($var)`` expression with ``null === $var``.
  5. Warning
  6. -------
  7. Using this rule is risky
  8. ~~~~~~~~~~~~~~~~~~~~~~~~
  9. Risky when the function ``is_null`` is overridden.
  10. Examples
  11. --------
  12. Example #1
  13. ~~~~~~~~~~
  14. .. code-block:: diff
  15. --- Original
  16. +++ New
  17. <?php
  18. -$a = is_null($b);
  19. +$a = null === $b;
  20. Rule sets
  21. ---------
  22. The rule is part of the following rule sets:
  23. @PhpCsFixer:risky
  24. Using the `@PhpCsFixer:risky <./../../ruleSets/PhpCsFixerRisky.rst>`_ rule set will enable the ``is_null`` rule.
  25. @Symfony:risky
  26. Using the `@Symfony:risky <./../../ruleSets/SymfonyRisky.rst>`_ rule set will enable the ``is_null`` rule.