- 将复杂的类型检查条件判断提取到独立的 checkVarAssignExpr 方法中 - 移除 CompilerBase.php 中的冗长条件判断逻辑 - 在 MagicMethodDetector.php 的 __toString 检查中添加严格类型参数 - 添加 str.php 示例文件用于测试字符串类型转换 - 更新 myext/test.php 添加环境变量访问示例 - 在 Translator.php 中添加 clang-format 版本检测逻辑pull/1/head
parent
3460c1e435
commit
935aeb8b1b
5 changed files with 68 additions and 9 deletions
@ -0,0 +1,20 @@ |
|||||||
|
<?php |
||||||
|
class TestObject { |
||||||
|
public string $a; |
||||||
|
function __toString(): string |
||||||
|
{ |
||||||
|
return $this->a; |
||||||
|
} |
||||||
|
} |
||||||
|
function test(string $a) |
||||||
|
{ |
||||||
|
var_dump($a); |
||||||
|
} |
||||||
|
|
||||||
|
function main() |
||||||
|
{ |
||||||
|
$o = new TestObject(); |
||||||
|
$o->a = "hello"; |
||||||
|
test($o); |
||||||
|
} |
||||||
|
|
||||||
@ -1,5 +1,12 @@ |
|||||||
<?php |
<?php |
||||||
function my_add(int $a, int $b): int |
function my_add(int $a, int $b): int |
||||||
{ |
{ |
||||||
|
$env = $_ENV; |
||||||
|
var_dump(count($env)); |
||||||
return $a + $b; |
return $a + $b; |
||||||
|
} |
||||||
|
|
||||||
|
function main() |
||||||
|
{ |
||||||
|
var_dump(my_add(1, 2)); |
||||||
} |
} |
||||||
Loading…
Reference in new issue