I think in this example the check for null can be removed.
The feature is so much more useful than presented here.

(https://www.php.net/releases/8.2/en.php#dnf_types)

   class Foo {
       public function bar((A&B)|null $entity) {
-          if ($entity === null) {
-              return null;
-          }

           return $entity;
       }
   }

Best regards
Thomas Gutbier

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to