TypePHP 编译器
https://swoole.com/aot/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
327 B
21 lines
327 B
--TEST--
|
|
Nullsafe operator - method and property access
|
|
--FILE--
|
|
<?php
|
|
class User {
|
|
public function getName(): string {
|
|
return 'Alice';
|
|
}
|
|
}
|
|
|
|
function main() {
|
|
$user1 = null;
|
|
var_dump($user1?->getName());
|
|
$user2 = new User();
|
|
var_dump($user2?->getName());
|
|
}
|
|
?>
|
|
--EXPECT--
|
|
NULL
|
|
string(5) "Alice"
|
|
|
|
|