From 386c6568f1e8324f7f3b853c81dbeebed3dcaee7 Mon Sep 17 00:00:00 2001 From: tianfenghan Date: Wed, 17 Jun 2026 18:50:41 +0800 Subject: [PATCH] =?UTF-8?q?test(aot):=20=E6=B7=BB=E5=8A=A0=E5=8F=AF?= =?UTF-8?q?=E7=A9=BA=E5=B8=83=E5=B0=94=E7=B1=BB=E5=9E=8B=E7=9A=84=E5=9F=BA?= =?UTF-8?q?=E6=9C=AC=E6=B5=8B=E8=AF=95=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加 bool 可空类型的基础测试文件 nullable-bool.phpt - 测试静态类中 ?bool 类型参数的默认值行为 - 验证 null、true、false 和无参数传入的情况 - 包含动态类 eval 情况下的可空布尔类型测试 - 确保所有测试场景的输出符合预期结果 --- tests/aot/basic/nullable-bool.phpt | 45 ++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 tests/aot/basic/nullable-bool.phpt diff --git a/tests/aot/basic/nullable-bool.phpt b/tests/aot/basic/nullable-bool.phpt new file mode 100644 index 00000000..1c8536cc --- /dev/null +++ b/tests/aot/basic/nullable-bool.phpt @@ -0,0 +1,45 @@ +--TEST-- +bool nullable type +--SKIPIF-- +--FILE-- +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) \ No newline at end of file