Author: Christoph M. Becker (cmb69) Committer: GitHub (web-flow) Pusher: cmb69 Date: 2022-12-08T19:43:50+01:00
Commit: https://github.com/php/web-php/commit/b1cf7f8f44b8447fe83c1cfdeed306206d718005 Raw diff: https://github.com/php/web-php/commit/b1cf7f8f44b8447fe83c1cfdeed306206d718005.diff Simplify DNF example As has been pointed out by Thomas Gutbier[1], the PHP 8.2 code doesn't need the special handling for `null`, so we remove it, and accordingly merge the special case handling in the pre PHP 8.2 snippet as well. [1] <https://externals.io/message/119096#119097> Closes GH-731. Changed paths: M releases/8.2/release.inc Diff: diff --git a/releases/8.2/release.inc b/releases/8.2/release.inc index dcab6314f..d679de914 100644 --- a/releases/8.2/release.inc +++ b/releases/8.2/release.inc @@ -113,11 +113,7 @@ PHP <<<'PHP' class Foo { public function bar(mixed $entity) { - if ($entity === null) { - return null; - } - - if (($entity instanceof A) && ($entity instanceof B)) { + if ((($entity instanceof A) && ($entity instanceof B)) || ($entity === null)) { return $entity; } @@ -137,10 +133,6 @@ PHP <<<'PHP' class Foo { public function bar((A&B)|null $entity) { - if ($entity === null) { - return null; - } - return $entity; } } -- PHP Webmaster List Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php