Error Identifier: phpstan.classNotFound
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 is reported during PHPStan’s internal testing when a class being analysed cannot be found via the reflection provider.
Why is it reported? #
The class under analysis is not autoloadable. This typically occurs when the autoload-dev section in composer.json is not configured to include the test directories, or when the class file is not included in the analysis paths.
How to fix it #
Ensure your composer.json autoload-dev section includes the directory containing the class:
{
"autoload-dev": {
"psr-4": {
"App\\Tests\\": "tests/"
}
}
}
Then run composer dump-autoload to regenerate the autoloader.
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\Testing\NonexistentAnalysedClassRule [1]