-
-
Notifications
You must be signed in to change notification settings - Fork 430
[WIP] [DX] Add prototype for scope refresh issues #1297
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
Conversation
498126a to
99f266f
Compare
| // refresh PHPStan scope, parent connections and other attributes | ||
| $scope = $node->getAttribute(AttributeKey::SCOPE); | ||
| $parent = $node->getAttribute(AttributeKey::PARENT_NODE); | ||
| $this->phpStanNodeScopeResolver->refreshStmtNodes($parent, [$node], $scope); | ||
|
|
||
| // update parents relations - must run before connectParentNodes() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the important change. On changed node, all the children of this node and this node get retraverse of scope.
| foreach ($itemsByName as $items) { | ||
| if (count($items)) { | ||
| continue; | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before this change, the type was lost on $values renamed to $items.
Now the $items have the ArrayType as original $values have 👍
0ef1a51 to
061f54b
Compare
samsonasik
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To show that the refresh scope working, the part that can be removed is second parameter bool $isCheckNameScope = false at:
| public function isUsed(Expr $expr, bool $isCheckNameScope = false): bool |
After removed, run tests against tests/Issues:
vendor/bin/phpunit tests/Issuesand verify if it cause error or not.
2ae2cde to
e98e2fd
Compare
e5c965b to
29d211d
Compare
50f1565 to
f204f29
Compare
f204f29 to
312de27
Compare
Ref rectorphp/rector#6723