Skip to content

Conversation

@VincentLanglet
Copy link
Contributor

@VincentLanglet VincentLanglet marked this pull request as draft March 27, 2022 11:10
@VincentLanglet VincentLanglet force-pushed the isSubclassOf branch 3 times, most recently from e1219b6 to 9dd2642 Compare March 27, 2022 11:25
@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

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

Development

Successfully merging this pull request may close these issues.

is_subclass_of is giving a wrong prediction when call on mixed or object.

4 participants