Re: [RFC] Nullsafe operator

From: Date: Tue, 14 Jul 2020 21:32:12 +0000
Subject: Re: [RFC] Nullsafe operator
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-111007@lists.php.net to get a copy of this message
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

« previous php.internals (#111007) next »