We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If a function returns the given input but makes a check for a subclass it is flagged as an incompatible type.
Method MyClass::returnInput() should return T of BaseClass but returns (SubClass&T of BaseClass)|T of BaseClass.
But SubClass&T of BaseClass is compatible with T of BaseClass (T === T) and should not produce an error.
SubClass&T of BaseClass
T of BaseClass
T === T
https://phpstan.org/r/ce00808b-84c3-46f7-96ff-b1673be83cfc
Found when analyzing https://github.com/pdepend/pdepend (PHPMD) at level 3.
The text was updated successfully, but these errors were encountered:
Fixed recently, works on PHPStan 1.4.4.
Sorry, something went wrong.
Nice!
Regression tests
86fd620
Closes phpstan/phpstan#5893 Closes phpstan/phpstan#6070 Closes phpstan/phpstan#5869 Closes phpstan/phpstan#6212 Closes phpstan/phpstan#6262 Closes phpstan/phpstan#6266 Closes phpstan/phpstan#6023 Closes phpstan/phpstan#6108 Closes phpstan/phpstan#6020 Closes phpstan/phpstan#1746 Closes phpstan/phpstan#1516 Closes phpstan/phpstan#6174 Closes phpstan/phpstan#6112 Closes phpstan/phpstan#5749 Closes phpstan/phpstan#5969 Closes phpstan/phpstan#5295 Closes phpstan/phpstan#5675 Closes phpstan/phpstan#5369 Closes phpstan/phpstan#6699 Closes phpstan/phpstan#6505
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
No branches or pull requests
Bug report
If a function returns the given input but makes a check for a subclass it is flagged as an incompatible type.
Method MyClass::returnInput() should return T of BaseClass but returns (SubClass&T of BaseClass)|T of BaseClass.
But
SubClass&T of BaseClass
is compatible withT of BaseClass
(T === T
) and should not produce an error.Code snippet that reproduces the problem
https://phpstan.org/r/ce00808b-84c3-46f7-96ff-b1673be83cfc
Found when analyzing https://github.com/pdepend/pdepend (PHPMD) at level 3.
The text was updated successfully, but these errors were encountered: