- 创建了测试文件 zero-const.phpt 验证类常量值为0的情况 - 测试了将值为0的类常量用作数组键的功能 - 验证了返回数组中键值对的正确性 - 确保类型转换和数据完整性符合预期行为pull/1/head
parent
d1c4e365b1
commit
93367a722e
1 changed files with 29 additions and 0 deletions
@ -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…
Reference in new issue