Menu

← Back to phpstan.*

Error Identifier: phpstan.reflection

Every error reported by PHPStan has an error identifier. Here’s a list of all error identifiers. In PHPStan Pro you can see the error identifier next to each error and filter errors by their identifiers.

Code example #

This error does not correspond to a specific PHP code pattern. It is emitted when PHPStan is unable to find the reflection of a class, function, or constant referenced in the analysed code.

Why is it reported? #

PHPStan needs to resolve information about all symbols (classes, interfaces, traits, functions, constants) used in the analysed code. When a symbol cannot be found through reflection, this error is reported.

This typically happens when:

  • A class, interface, or trait is not autoloadable
  • A required dependency is not installed
  • The autoloader configuration does not cover all necessary paths

This error is not ignorable because PHPStan cannot perform accurate analysis when it cannot resolve the types involved.

How to fix it #

Make sure all symbols are autoloadable. Learn more at Discovering Symbols.

Common solutions:

  1. Run composer install or composer dump-autoload to ensure the autoloader is up to date.
  2. Add missing paths to the scanFiles or scanDirectories configuration options in phpstan.neon.
  3. Add stub files for symbols from extensions that are not always installed.

Non-ignorable error #

This error cannot be ignored using @phpstan-ignore or the ignoreErrors configuration. Non-ignorable errors indicate code that would cause a crash or a fatal error at runtime, or a fundamental problem in the analysed code that must be addressed.

Rules that report this error #

  • PHPStan\Analyser\AnalyserResultFinalizer [1] [2]
  • PHPStan\Analyser\FileAnalyser [1] [2]
  • PHPStan\Analyser\FileAnalyserCallback [1] [2] [3] [4]

Edit this page on GitHub

Theme
A
© 2026 PHPStan s.r.o.