我有一个 PHP 程序,
<?php
class Zap {
}
class Zip {
public Zap $zap;
}
$object = new Zip;
var_dump(
$object->zap
);
由于初始化的不可为空的属性,此程序会产生错误。
致命错误:未捕获错误:在初始化之前不得访问类型化属性 Zip::$zap
能phpstan
检测出这些错误吗?我已经在最高级别扫描了这个程序,并且phpstan
似乎很高兴
% ./vendor/bin/phpstan analyse --level=8 /tmp/test.php
1/1 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
[OK] No errors
如果phpstan
无法检测到这些情况,是否有另一个 PHP 静态分析器可以?