- 添加对布尔类型默认值的正确处理和转换 - 修复常量表达式在字符串类型检查中的逻辑错误 - 增加对重复属性定义的检测和错误报告 - 优化数值类型默认值的处理流程 - 添加测试用例验证各种类型的属性默认值行为pull/1/head
parent
f41d42e5bc
commit
1e47ac0f53
5 changed files with 45 additions and 5 deletions
@ -0,0 +1,26 @@ |
|||||||
|
--TEST-- |
||||||
|
default array property |
||||||
|
--FILE-- |
||||||
|
<?php |
||||||
|
|
||||||
|
class Test { |
||||||
|
protected bool|int $attr1 = false; |
||||||
|
protected string $attr2 = 'hello'; |
||||||
|
protected int $attr3 = 1232; |
||||||
|
protected float $attr4 = 3.1415; |
||||||
|
|
||||||
|
function bar() { |
||||||
|
var_dump($this->attr1, $this->attr2, $this->attr3, $this->attr4); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
function main() { |
||||||
|
$obj = new Test; |
||||||
|
$obj->bar(); |
||||||
|
} |
||||||
|
?> |
||||||
|
--EXPECT-- |
||||||
|
bool(false) |
||||||
|
string(5) "hello" |
||||||
|
int(1232) |
||||||
|
float(3.1415) |
||||||
Loading…
Reference in new issue