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)

Most upvoted comments

My opinion is that you should always make all the classes defined when the static analysis runs.