- 在 CompilerBase.php 中添加 classDef 检查以避免空指针错误 - 在 gen_stub.php 中对字符串表达式进行转义处理 - 将 Utils.php 中的 genCharPtr 和 escapeString 方法设为公共方法 - 添加测试用例验证默认数组属性功能pull/1/head
parent
ce7d254709
commit
17fcb16aec
4 changed files with 30 additions and 3 deletions
@ -0,0 +1,24 @@ |
|||||||
|
--TEST-- |
||||||
|
default array property |
||||||
|
--FILE-- |
||||||
|
<?php |
||||||
|
class Test { |
||||||
|
protected string $x = '[{"label":"Option 1","value":"1"},{"label":"Option 2","value":"2"},{"label":"Option 3","value":"3"},{"label":"Option 4","value":"4"}]'; |
||||||
|
|
||||||
|
public function bar() { |
||||||
|
$json = json_decode($this->x,true); |
||||||
|
Assert::isArray($json); |
||||||
|
Assert::count($json, 4); |
||||||
|
Assert::eq($json[0]['label'], "Option 1"); |
||||||
|
echo "DONE\n"; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
function main() { |
||||||
|
require __DIR__ . '/../../../src/Assert.php'; |
||||||
|
$obj = new Test; |
||||||
|
$obj->bar(); |
||||||
|
} |
||||||
|
?> |
||||||
|
--EXPECT-- |
||||||
|
DONE |
||||||
Loading…
Reference in new issue