You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
No warning that a method being called on a class does not exist (even though the type's class is correct) #11353
Quite an edge case, but I thought it was still worth reporting. We're dynamically calling a method create on a class using $classFQCN::create(), and $classFQCN is properly typed as a union of multiple classes that should all have the create method. But if one of these class do not have the method, no warning is thrown, and an error happens at runtime.
Activity
phpstan-bot commentedon Sep 15, 2024
@gnutix After the latest push in 2.0.x, PHPStan now reports different result with your code snippet:
Full report
PHP 8.1 – 8.3 (1 error)
PHP 8.0 (2 errors)
Syntax error, unexpected T_STRING on line 5Syntax error, unexpected '{' on line 6PHP 7.2 – 7.4 (2 errors)
Syntax error, unexpected T_STRING on line 5Syntax error, unexpected T_CASE on line 7phpstan-bot commentedon Sep 11, 2026
@gnutix After the latest push in 2.3.x, PHPStan now reports different result with your code snippet:
Full report
PHP 8.1 – 8.3 (2 errors)
Variable $class is never read.PHP 8.0 (2 errors)
Syntax error, unexpected T_STRING on line 5Syntax error, unexpected '{' on line 6PHP 7.2 – 7.4 (2 errors)
Syntax error, unexpected T_STRING on line 5Syntax error, unexpected T_CASE on line 7