Skip to content

Conversation

rvanvelzen
Copy link
Contributor

@@ -661,6 +661,11 @@ private function resolveType(Expr $node): Type
return new NeverType(true);
}

$exprString = $this->getNodeKey($node);
if (isset($this->moreSpecificTypes[$exprString]) && $this->moreSpecificTypes[$exprString]->getCertainty()->yes()) {
return $this->moreSpecificTypes[$exprString]->getType();
Copy link
Member

Choose a reason for hiding this comment

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

It's an obvious solution but it's gonna be slow :(

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't notice a slowdown - running make phpstan actually seems slightly faster 😅

Copy link
Member

Choose a reason for hiding this comment

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

Alright, I'll benchmark it :)

@ondrejmirtes
Copy link
Member

I profiled it and it's not slower 🎉 I even came up with an idea for a small optimization which I'm gonna try soon. Thank you!

@ondrejmirtes ondrejmirtes marked this pull request as ready for review June 9, 2022 15:26
@ondrejmirtes ondrejmirtes merged commit ee386a2 into phpstan:1.7.x Jun 9, 2022
@rvanvelzen rvanvelzen deleted the match-scope-type branch June 13, 2022 06:28
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.

2 participants