fix(compiler): 修复类型化参数默认值 helper 的运行时常量转换 #35
Merged
韩天峰
merged 3 commits from preprocessor-wrap-runtime-const-scalar-default into master 1 month ago
2 changed files with 54 additions and 1 deletions
@ -0,0 +1,30 @@ |
|||||||
|
--TEST-- |
||||||
|
Typed parameter default value from an unresolvable (external) class constant |
||||||
|
--FILE-- |
||||||
|
<?php |
||||||
|
|
||||||
|
class TypedDefault |
||||||
|
{ |
||||||
|
public function run( |
||||||
|
int $value = \ArrayObject::ARRAY_AS_PROPS, |
||||||
|
float $floatValue = \ArrayObject::ARRAY_AS_PROPS, |
||||||
|
string $format = \DateTime::ATOM, |
||||||
|
int $composite = 1 | \ArrayObject::ARRAY_AS_PROPS, |
||||||
|
mixed $variant = \ArrayObject::STD_PROP_LIST, |
||||||
|
) |
||||||
|
{ |
||||||
|
var_dump($value, $floatValue, $format, $composite, $variant); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
function main() |
||||||
|
{ |
||||||
|
(new TypedDefault)->run(); |
||||||
|
} |
||||||
|
?> |
||||||
|
--EXPECT-- |
||||||
|
int(2) |
||||||
|
float(2) |
||||||
|
string(13) "Y-m-d\TH:i:sP" |
||||||
|
int(3) |
||||||
|
int(1) |
||||||
Loading…
Reference in new issue