What's new in 8.2: DNF types
| From: | Thomas Gutbier | Date: | Thu, 08 Dec 2022 12:39:31 +0000 |
| Subject: | What's new in 8.2: DNF types | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-119097@lists.php.net to get a copy of this message | ||
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