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

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to