-
-
Notifications
You must be signed in to change notification settings - Fork 934
Closed
phpstan/phpstan-src
#1972Labels
Milestone
Description
Bug report
Currently using phpstan 1.2.0, analysis on Level 6
Methods not specifically defined in a type-hinted interface, but which are specifically checked for, are flagged by PHPStan.
Code snippet that reproduces the problem
class Controller
{
/**
* @param class-string<ControllerInterface> $class
* @return void
*/
public static function invokeController (string $class): void
{
if (/* Http::methodIs ("post") && */ method_exists ($class, "methodPost"))
{
$class::methodPost (); // Call to an undefined static method ControllerInterface::methodPost()
}
}
}
interface ControllerInterface
{
}
Expected output
No error is expected because the method's existence is specifically checked and verified.
Did PHPStan help you today? Did it make you happy in any way?
Yes! Thank you for everything you've done to make our lives as developers better.