Error Identifier: interface.notFound
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 #
<?php declare(strict_types = 1);
interface MyInterface extends NonExistentInterface // ERROR: Interface MyInterface extends unknown interface NonExistentInterface.
{
}
Why is it reported? #
The interface declaration extends an interface that does not exist. PHP requires all extended interfaces to be valid and loadable. This typically happens when the interface name contains a typo, the namespace is incorrect, or the package providing the interface is not installed.
How to fix it #
Fix the interface name or namespace:
<?php declare(strict_types = 1);
-interface MyInterface extends NonExistentInterface
+interface MyInterface extends ExistingInterface
{
}
If the interface comes from a third-party package, make sure the package is installed via Composer and that the correct namespace is used. If PHPStan is not aware of the interface, check the discovering symbols guide.
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.