1
0
mirror of https://github.com/php/php-src.git synced 2026-03-25 16:52:18 +01:00
Files
archived-php-src/Zend/tests/nullsafe_operator/036.phpt
2020-08-31 16:44:36 +02:00

29 lines
342 B
PHP

--TEST--
Test nullsafe method call on delayed var
--FILE--
<?php
class Foo {
public ?Bar $bar;
}
class Bar {
public function baz() {
return 'baz';
}
}
$foo = new Foo();
$foo->bar = null;
var_dump($foo->bar?->baz());
$bar = new Bar();
$foo->bar = $bar;
var_dump($foo->bar?->baz());
?>
--EXPECT--
NULL
string(3) "baz"