Skip to content
New issue

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

is_subclass_of do not infer anything when context is falsy #1124

Merged
merged 1 commit into from Mar 27, 2022

Conversation

VincentLanglet
Copy link
Contributor

@ondrejmirtes
Copy link
Member

Regression test for #6891 needs to be in NodeScopeResolverTest.

@VincentLanglet VincentLanglet marked this pull request as ready for review March 27, 2022 12:02
@VincentLanglet
Copy link
Contributor Author

Regression test for #6891 needs to be in NodeScopeResolverTest.

Done

@herndlm
Copy link
Contributor

herndlm commented Mar 27, 2022

👍
does it make sense to do the same for is_a? could be done in a follow-up as well of course
UPDATE: checked this now, apparently this is not needed for is_a and would even break things hmm

@@ -34,18 +33,15 @@ public function isFunctionSupported(FunctionReflection $functionReflection, Func

public function specifyTypes(FunctionReflection $functionReflection, FuncCall $node, Scope $scope, TypeSpecifierContext $context): SpecifiedTypes
{
if (count($node->getArgs()) < 2) {
if (!$context->truthy() || count($node->getArgs()) < 2) {
Copy link
Contributor

@staabm staabm Mar 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This $context->truthy() check should be done in isFunctionSupported instead

@ondrejmirtes ondrejmirtes merged commit 3ea1fb4 into phpstan:1.5.x Mar 27, 2022
@ondrejmirtes
Copy link
Member

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants