no_useless_nullsafe_operator.rst 605 B

123456789101112131415161718192021222324252627282930313233
  1. =====================================
  2. Rule ``no_useless_nullsafe_operator``
  3. =====================================
  4. There should not be useless Null-safe operator ``?->`` used.
  5. Examples
  6. --------
  7. Example #1
  8. ~~~~~~~~~~
  9. .. code-block:: diff
  10. --- Original
  11. +++ New
  12. <?php
  13. class Foo extends Bar
  14. {
  15. public function test() {
  16. - echo $this?->parentMethod();
  17. + echo $this->parentMethod();
  18. }
  19. }
  20. Rule sets
  21. ---------
  22. The rule is part of the following rule sets:
  23. - `@PhpCsFixer <./../../ruleSets/PhpCsFixer.rst>`_
  24. - `@Symfony <./../../ruleSets/Symfony.rst>`_