[Renaming] Remove Scope filling from Name node on PHPStanNodeScopeResolver for RenameClassRector#4422
[Renaming] Remove Scope filling from Name node on PHPStanNodeScopeResolver for RenameClassRector#4422samsonasik merged 6 commits intomainfrom
Conversation
…olver for RenameClassRector
| if ($node->getAttribute(AttributeKey::EXPRESSION_DEPTH) >= 2) { | ||
| return $this->scopeFactory->createFromFile($filePath); | ||
| } |
There was a problem hiding this comment.
@TomasVotruba this is to avoid too deep scope filing assign -> assign -> expr -> method call -> property fetch , eg:
$$param = $$bar = self::decodeValue($result->getItem()->getTextContent());that can goes out of control,.
|
@TomasVotruba @staabm I removed many scope filling 🎉 |
|
@TomasVotruba I am merging it to have faster feedback to test ;) |
| { | ||
| $oldToNewClasses = $this->renamedClassesDataCollector->getOldToNewClasses(); | ||
| if ($oldToNewClasses !== []) { | ||
| $scope = $node->getAttribute(AttributeKey::SCOPE); |
There was a problem hiding this comment.
shouldn't the scope passed in from rector core be the same as the one in the attribute?
There was a problem hiding this comment.
I still find why Scope for RenameClassRector after refactor require ORIGINAL_NODE instead of Node itself at
rector-src/src/Rector/AbstractRector.php
Lines 342 to 343 in 3fa4bec
that's possibly due to docblock is too late to get Scope, that's another PR to apply if possible ;)
@staabm @TomasVotruba per #4400 (comment)
Here I remove Scope filling for
Namenode onRenameClassRectoronPHPStanNodeScopeResolver