test(const): 添加零值类常量作为数组键的测试用例

- 创建了测试文件 zero-const.phpt 验证类常量值为0的情况
- 测试了将值为0的类常量用作数组键的功能
- 验证了返回数组中键值对的正确性
- 确保类型转换和数据完整性符合预期行为
pull/1/head
韩天峰 2 months ago
parent d1c4e365b1
commit 93367a722e
  1. 29
      tests/aot/const/zero-const.phpt

@ -0,0 +1,29 @@
--TEST--
class const with value 0 used as array key
--FILE--
<?php
class Test
{
const CV = 0;
public function aaa(): array
{
$list = [
self::CV => 'a',
];
return $list;
}
}
function main(): void
{
$test = new Test;
var_dump('test', $test->aaa());
}
?>
--EXPECT--
string(4) "test"
array(1) {
[0]=>
string(1) "a"
}
Loading…
Cancel
Save