Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:119097 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 5492 invoked from network); 8 Dec 2022 12:39:35 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 8 Dec 2022 12:39:35 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 0988318055B for ; Thu, 8 Dec 2022 04:39:35 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: * X-Spam-Status: No, score=1.5 required=5.0 tests=BAYES_40,BODY_8BITS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS8972 80.67.16.0/20 X-Spam-Virus: No X-Envelope-From: Received: from smtprelay04.ispgateway.de (smtprelay04.ispgateway.de [80.67.18.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 8 Dec 2022 04:39:34 -0800 (PST) Received: from [87.191.194.51] (helo=[192.168.178.16]) by smtprelay04.ispgateway.de with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1p3GBq-0002GI-E5 for internals@lists.php.net; Thu, 08 Dec 2022 13:39:50 +0100 Message-ID: Date: Thu, 8 Dec 2022 13:39:31 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.5.1 To: internals@lists.php.net References: <994B8839-2A69-4522-95D7-BF1B19831677@php.net> In-Reply-To: <994B8839-2A69-4522-95D7-BF1B19831677@php.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Df-Sender: dGhvbWFzLmd1dGJpZXJAYW50aHJvdGVjLmRl Subject: What's new in 8.2: DNF types From: thomas.gutbier@anthrotec.de (Thomas Gutbier) 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