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.
46 lines
942 B
46 lines
942 B
--TEST--
|
|
SSA object prop: nullable and union properties stay Var with null default
|
|
--FILE--
|
|
<?php
|
|
use native_types;
|
|
|
|
class FlexibleDefaults {
|
|
public ?int $nullable;
|
|
public ?object $nullableObject;
|
|
public int|string $union;
|
|
|
|
public function run(): void {
|
|
var_dump($this->nullable);
|
|
var_dump($this->nullableObject);
|
|
var_dump($this->union);
|
|
|
|
$this->nullable = 13;
|
|
$this->nullableObject = null;
|
|
$this->union = "ok";
|
|
var_dump($this->nullable);
|
|
var_dump($this->nullableObject);
|
|
var_dump($this->union);
|
|
|
|
$this->nullable = null;
|
|
$this->nullableObject = null;
|
|
$this->union = '';
|
|
var_dump($this->nullable);
|
|
var_dump($this->nullableObject);
|
|
var_dump($this->union);
|
|
}
|
|
}
|
|
|
|
function main(): void {
|
|
(new FlexibleDefaults())->run();
|
|
}
|
|
?>
|
|
--EXPECT--
|
|
NULL
|
|
NULL
|
|
NULL
|
|
int(13)
|
|
NULL
|
|
string(2) "ok"
|
|
NULL
|
|
NULL
|
|
string(0) ""
|
|
|