Skip to content

CallTo*Rule: cheap checks first - #4733

Merged
ondrejmirtes merged 1 commit into
phpstan:2.1.xfrom
staabm:furst
Jan 8, 2026
Merged

ondrejmirtes merged 1 commit into
phpstan:2.1.xfrom
staabm:furst

Conversation

@staabm

@staabm staabm commented Jan 8, 2026

Copy link
Copy Markdown
Contributor

No description provided.

if (!$methodCall->name instanceof Node\Identifier) {
return [];
}
$scope = $scope->filterByTruthyValue(new Node\Expr\BinaryOp\NotIdentical($methodCall->var, new Node\Expr\ConstFetch(new Node\Name('null'))));

@staabm staabm Jan 8, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

prevents scope filtering if possible

@ondrejmirtes
ondrejmirtes merged commit e45b086 into phpstan:2.1.x Jan 8, 2026
631 of 646 checks passed
@ondrejmirtes

Copy link
Copy Markdown
Member

Thank you!

@staabm
staabm deleted the furst branch January 8, 2026 10:52
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