diff --git a/src/Php/CompilerBase.php b/src/Php/CompilerBase.php index db71194b..d966edf5 100644 --- a/src/Php/CompilerBase.php +++ b/src/Php/CompilerBase.php @@ -1004,6 +1004,9 @@ class CompilerBase extends \PhpAot\Core\Translator if ($param->type instanceof NullableType) { $type = $param->type->type; $nullable = true; + } elseif ($param->type instanceof UnionType) { + $type = 'mixed'; + $nullable = false; } else { $type = $param->type === null ? '' : $param->type; $nullable = false; diff --git a/tests/aot/prop-004.phpt b/tests/aot/prop-004.phpt new file mode 100644 index 00000000..68e03a0f --- /dev/null +++ b/tests/aot/prop-004.phpt @@ -0,0 +1,18 @@ +--TEST-- +Property with nullable type +--FILE-- +value); +} +?> +--EXPECT-- +string(8) "Continue" \ No newline at end of file