Skip to content

[CodeQuality] Handle crash on BinaryOp/Mul and variable variable: $$name on IntvalToTypeCastRector#3608

Merged
samsonasik merged 10 commits into
mainfrom
in-mul-binary-op
Apr 12, 2023
Merged

[CodeQuality] Handle crash on BinaryOp/Mul and variable variable: $$name on IntvalToTypeCastRector#3608
samsonasik merged 10 commits into
mainfrom
in-mul-binary-op

Conversation

@samsonasik

Copy link
Copy Markdown
Member

@samsonasik

Copy link
Copy Markdown
Member Author

Fixed 🎉 /cc @holdmann

@samsonasik

Copy link
Copy Markdown
Member Author

@TomasVotruba I fixed it by set fallback Scope on ScopeAnalyzer::resolveScope() to always return Scope by using

return $this->scopeFactory->createFromFile($filePath);

93f6219 , this is the solution I can found for now.

@samsonasik samsonasik changed the title [CodeQuality] Handle crash on BinaryOp/Mul on IntvalToTypeCastRector [CodeQuality] Handle crash on BinaryOp/Mul and variable $$variable on IntvalToTypeCastRector Apr 12, 2023
@samsonasik samsonasik changed the title [CodeQuality] Handle crash on BinaryOp/Mul and variable $$variable on IntvalToTypeCastRector [CodeQuality] Handle crash on BinaryOp/Mul and variable variable: $$nameon IntvalToTypeCastRector Apr 12, 2023
@samsonasik samsonasik changed the title [CodeQuality] Handle crash on BinaryOp/Mul and variable variable: $$nameon IntvalToTypeCastRector [CodeQuality] Handle crash on BinaryOp/Mul and variable variable: $$name on IntvalToTypeCastRector Apr 12, 2023
@samsonasik

Copy link
Copy Markdown
Member Author

All checks have passed 🎉 @TomasVotruba it is ready for review.

@yguedidi

Copy link
Copy Markdown
Contributor

@samsonasik why not getting the scope from the first ancestor that has a scope? here maybe the parameter Expr or the MethodCall

@samsonasik

Copy link
Copy Markdown
Member Author

I tried that, not working, there is nearest scope filling handle for that, see

but can't get the solution yet for this

@samsonasik

Copy link
Copy Markdown
Member Author

I found a better solution, I check against node just reprinted on ScopeAnalyzer ed898fa

@samsonasik

Copy link
Copy Markdown
Member Author

Finally 🎉 🎉 🎉 All checks have passed 🎉 , the solution is handle by check that node is just re-printed along with parent re-print on ScopeAnalyzer.

@TomasVotruba I think it is ready.

@samsonasik

Copy link
Copy Markdown
Member Author

@TomasVotruba I am merging it ;)

@samsonasik samsonasik merged commit 3a9bebf into main Apr 12, 2023
@samsonasik samsonasik deleted the in-mul-binary-op branch April 12, 2023 13:20
samsonasik added a commit that referenced this pull request May 8, 2023
…ame on IntvalToTypeCastRector (#3608)

* [CodeQuality] Handle crash on BinaryOp/Mul on IntvalToTypeCastRector

* Fixed

* [ci-review] Rector Rectify

* Revert [ci-review] Rector Rectify

This reverts commit a18c051.

* Revert Fixed

This reverts commit 93f6219.

* Handle with re-printed node

* clean up

* Final touch: comment

* [ci-review] Rector Rectify

* [ci-review] Rector Rectify

---------

Co-authored-by: GitHub Action <actions@github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

each time crashes on specific file both file-by-file and parallel mode

3 participants