[ProcessAnalyzer] Skip process when origNode class is not equal with target node class#4861
Merged
samsonasik merged 5 commits intomainfrom Aug 27, 2023
Merged
[ProcessAnalyzer] Skip process when origNode class is not equal with target node class#4861samsonasik merged 5 commits intomainfrom
samsonasik merged 5 commits intomainfrom
Conversation
…target node class
Member
Author
|
The issue seems sowewhere deeper on traversing, so it seems not working... |
Member
Author
|
@TomasVotruba ok, I am debugging, so to make d($node);PhpParser\Node\Expr\ClassConstFetch #42595
class: PhpParser\Node\Name\FullyQualified #42230
| parts: array (4) ...
| attributes: array (11) ...
name: PhpParser\Node\Identifier #62762
| name: 'UP_TO_TWIG_134'
| attributes: array (10) ...
attributes: array (12)
| 'startLine' => 10
| 'startTokenPos' => 52
| 'startFilePos' => 251
| 'endLine' => 10
| 'endTokenPos' => 54
| 'endFilePos' => 282
| 'statementOrder' => 0
| 'statementDepth' => 2
| 'expressionOrder' => 0
| 'expressionDepth' => 4
| 'scope' => PHPStan\Analyser\MutatingScope #42283 ...
| 'origNode' => PhpParser\Node\Expr\ClassConstFetch #42320 ...
69/69 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
[OK] 6 files would have changed (dry-run) by Rector
so, it possibly memory on hold got loss when debug enabled. |
Member
Author
|
@TomasVotruba give me time.... |
Member
Author
|
I tried to extract downgrade lists and it seems the issue is when import: $rectorConfig->import(DowngradeSetList::PHP_73);so somewhere in that rules... |
Member
Author
|
@TomasVotruba ok, the bug seems on |
samsonasik
commented
Aug 27, 2023
Comment on lines
+231
to
+241
| $result = $this->nodesToReturn[$objectHash] ?? $node; | ||
|
|
||
| if (is_array($result)) { | ||
| return $result; | ||
| } | ||
|
|
||
| if ($result::class === $node::class) { | ||
| return $result; | ||
| } | ||
|
|
||
| return $node; |
Member
Author
There was a problem hiding this comment.
@TomasVotruba it seems the tweak 👍
Before
➜ rector-src git:(ksip) bin/rector process vendor/rector/rector-symfony/config/sets --config build/config/config-downgrade.php --ansi --dry-run --clear-cache --no-diffs
69/69 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
[ERROR] Could not process
"/Users/samsonasik/www/rector-src/vendor/rector/rector-symfony/config/sets/twig/level/up-to-twig-127.php" file,
due to:
"System error: "Trying to replace statement (Stmt_Return) with expression (Expr_MethodCall). Are you missing a
Stmt_Expression wrapper?"
Run Rector with "--debug" option and post the report here: https://github.com/rectorphp/rector/issues/new". On line: 277
After
➜ rector-src git:(ksip) ✗ bin/rector process vendor/rector/rector-symfony/config/sets --config build/config/config-downgrade.php --ansi --dry-run --clear-cache --no-diffs
69/69 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
[OK] 6 files would have changed (dry-run) by Rector
Member
Author
|
All checks have passed 🎉 @TomasVotruba let's give it a try 👍 |
Member
Author
|
@TomasVotruba it works 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 |
Member
|
Thank you 🤗 what a journey to follow your work 👏 👏 👏 👏 👏 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

@TomasVotruba I tried locally, and verify
origNodeis equal with target$nodeclass early on reprint seems fix the downgrade issue.Ref #4841 (review)
Let's give it a try and test enable downgrade
vendor/rector/rector-*/configagain.