Skip to content

Conversation

@paulbalandan
Copy link
Member

Description

$ vendor/bin/php-cs-fixer describe no_useless_nullsafe_operator   
Description of no_useless_nullsafe_operator rule.
There should not be useless `null-safe-operators` `?->` used.

Fixing examples:
 * Example #1.
   ---------- begin diff ----------
   --- Original
   +++ New
   @@ -1,7 +1,7 @@
    <?php
    class Foo extends Bar
    {
        public function test() {
   -        echo $this?->parentMethod();
   +        echo $this->parentMethod();
        }
    }

   ----------- end diff -----------

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

Copy link
Member

@MGatner MGatner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to see this one didn't trigger any changes! Null-safe operator is the new empty(): suspicious at best. Well, it would be if empty() weren't still alive and well 😤

@paulbalandan paulbalandan force-pushed the no-useless-nullsafe-operator branch from 443b64f to 70c3f14 Compare September 4, 2022 12:46
@paulbalandan paulbalandan merged commit 681b13d into codeigniter4:develop Sep 4, 2022
@paulbalandan paulbalandan deleted the no-useless-nullsafe-operator branch September 4, 2022 12:48
paulbalandan added a commit to CodeIgniter/coding-standard that referenced this pull request Sep 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants