I have a PHP program,
<?php
class Zap {
}
class Zip {
public Zap $zap;
}
$object = new Zip;
var_dump(
$object->zap
);
This program produces an error because of an initialized non-nullable property.
Fatal error: Uncaught Error: Typed property Zip::$zap must not be accessed before initialization in
Can phpstan
detect these sorts of errors? I've scanned this program at the highest level, and phpstan
seems happy
% ./vendor/bin/phpstan analyse --level=8 /tmp/test.php
1/1 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
[OK] No errors
If phpstan
can't detect these situations, is there another PHP Static Analyzer that can?