phpstan: Call to an unknown static method in class_exists() block
Bug
If you analyze the following code with PHPStan (class '\Cake\Codeception\Console\Installer' does not exist):
if (class_exists('\Cake\Codeception\Console\Installer')) {
\Cake\Codeception\Console\Installer::customizeCodeceptionBinary($event);
}
It will report the following error.
Call to static method customizeCodeceptionBinary() on an unknown class Cake\Codeception\Console\Installer.
Expected
Call to an unknown static method and class_exists() should not throw a violation if the call is wrapped with class_exists() .
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 21 (14 by maintainers)
This long-standing issue has now been fixed: https://github.com/phpstan/phpstan-src/commit/1605bb2cddf65139e886df9a62aa7fe9dcfd03eb
My opinion is that you should always make all the classes defined when the static analysis runs.