Skip to content

Conversation

@staabm
Copy link
Contributor

@staabm staabm commented Jan 6, 2026

No description provided.

if ($scope->getAnonymousFunctionReflection() !== $currentScope->getAnonymousFunctionReflection()) {
return;
}
if (!$node instanceof VariableAssignNode && !$node instanceof PropertyAssignNode) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

re-ordered checks.. instanceof first before method calls

$originalStorage = $storage;
$storage = $originalStorage->duplicate();
if ($context->isTopLevel()) {
$storage = $originalStorage->duplicate();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

duplicate only if we actually change the storage

&& count($scopesWithIterableValueType) > 0
&& !$continueExitPointHasUnoriginalKeyType
&& $stmt->keyVar !== null
&& (!$hasExpr->no() || !$stmt->expr instanceof Variable)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

simple calls before Type system calls

@ondrejmirtes ondrejmirtes merged commit a98a1e0 into phpstan:2.1.x Jan 7, 2026
634 of 646 checks passed
@ondrejmirtes
Copy link
Member

Thank you!

@staabm staabm deleted the nsr-cheap branch January 7, 2026 06:19
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