On 02/06/2020 22:52, Ilija Tovilo wrote:
It introduces the nullsafe operator ?-> that skips null values when
calling functions and fetching properties. In contrast to the last few
attempts this RFC includes full short circuiting.
I like it a lot! Concise and clear RFC.
From having used a similar feature in TypeScript I can say it is quite
convenient, easy to get used to and makes for much leaner code.
IMO not having it on array accesses isn't so bad as with arrays you can
easily isset($deep['into']['the']['array']) in one go, while with
objects and getters etc it tends to lead to much uglier and repetitive
code like:
if ($foo && $foo->getBar() && $foo->getBar()->getBaz()) { ... }
So yeah, +1
Best,
Jordi
--
Jordi Boggiano
@seldaek - https://seld.be
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php