php-src/Zend/tests/nullsafe_operator/024.phpt
Ilija Tovilo 9bf119832d
Implement nullsafe ?-> operator
RFC: https://wiki.php.net/rfc/nullsafe_operator

Closes GH-5619.

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
2020-07-24 10:05:03 +02:00

11 lines
198 B
PHP

--TEST--
Test nullsafe as foreach target
--FILE--
<?php
$foo = null;
foreach ([1, 2, 3] as $foo?->bar) {}
--EXPECTF--
Fatal error: Can't use nullsafe operator in write context in %s.php on line 4