Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:111007 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 76283 invoked from network); 14 Jul 2020 22:39:44 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 14 Jul 2020 22:39:44 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id AA700180533 for ; Tue, 14 Jul 2020 14:32:16 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from v-smtpout2.han.skanova.net (v-smtpout2.han.skanova.net [81.236.60.155]) (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 ; Tue, 14 Jul 2020 14:32:15 -0700 (PDT) Received: from [192.168.7.8] ([213.64.245.126]) by cmsmtp with ESMTPA id vSX7joJllgqzTvSX7jfuzV; Tue, 14 Jul 2020 23:32:13 +0200 To: Ilija Tovilo Cc: Markus Fischer , PHP internals References: Message-ID: <7a4d86d3-d028-1506-bea8-9a98cbb13581@telia.com> Date: Tue, 14 Jul 2020 23:32:12 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB X-CMAE-Envelope: MS4wfGVG/TZiRM3bIZfjRlD3idXzrbwP6uRT6z6clA6E2bYRyLPc8gGyOqLwR54KrtItSWdM1XwSmK4uRpzfgHCnhXoemyT0Ab1OsK7KTr6/Gk658lUZDKbq 9nUalTyNdQwaDiY47rCDt6ss60BeexZGRO9DMhjKlLOai1GBiaUb490JaTyUIhl/s2MxKNKeuFDtZQSeOMphxOKGflHUSWSTtA3yKkYVLR+SgWDTuIoTfSXf U0OyY1MNxsrqkiElJ8VxtQ== Subject: Re: [PHP-DEV] [RFC] Nullsafe operator From: bjorn.x.larsson@telia.com (=?UTF-8?Q?Bj=c3=b6rn_Larsson?=) Den 2020-07-14 kl. 10:51, skrev Ilija Tovilo: > Hi Markus > >>> https://wiki.php.net/rfc/nullsafe_operator >> Would this still work together with short-circuiting and the null >> coalesce operator? >> >> $country = $session?->user?->getAddress()?->country ?? 'defaultCountry'; > Yes, your example will still work, this is solely about references :) > > Ilija When I see this I come to think about if this might have helped with upgrading to PHP 7 from PHP 5 due to the RFC: - https://wiki.php.net/rfc/counting_non_countables Like: $value = $countvalue?->count($countvalue); Even if I solved over 90% replacing count with empty there could be a few more places where this might prove handy. So +1 on this! r//Björn L