test(aot): 添加可空布尔类型的基本测试用例

- 添加 bool 可空类型的基础测试文件 nullable-bool.phpt
- 测试静态类中 ?bool 类型参数的默认值行为
- 验证 null、true、false 和无参数传入的情况
- 包含动态类 eval 情况下的可空布尔类型测试
- 确保所有测试场景的输出符合预期结果
pull/2/head
韩天峰 2 months ago
parent db5de84468
commit 386c6568f1
  1. 45
      tests/aot/basic/nullable-bool.phpt

@ -0,0 +1,45 @@
--TEST--
bool nullable type
--SKIPIF--
--FILE--
<?php
class TestBoolNullableType
{
public function test(?bool $value = true)
{
var_dump($value);
}
}
function main()
{
$o = new TestBoolNullableType();
$o->test(null);
$o->test(true);
$o->test(false);
$o->test();
eval("class TestBoolNullableTypeDym {
public function test(?bool \$value = true)
{
var_dump(\$value);
}
}");
$o2 = new TestBoolNullableTypeDym();
$o2->test(null);
$o2->test(true);
$o2->test(false);
$o2->test();
}
?>
--EXPECT--
NULL
bool(true)
bool(false)
bool(true)
NULL
bool(true)
bool(false)
bool(true)
Loading…
Cancel
Save