Skip to content
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

[NodeTypeResolver] Handle crash after next exit() on no namespaced code after removal next attribute #4074

Merged
merged 7 commits into from
Jun 5, 2023

Conversation

samsonasik
Copy link
Member

After removal of next attribute, on no namespaced code, the stmts collected via FileWithoutNamespaceNodeTraverser which seems late detect the UnreachableStatementNode next stmt handling cause crash.

This PR try to fix rectorphp/rector#7972

@samsonasik samsonasik marked this pull request as draft June 4, 2023 23:34
@samsonasik samsonasik marked this pull request as ready for review June 5, 2023 08:43
@samsonasik
Copy link
Member Author

Fixed 🎉 /cc @PhilETaylor

@PhilETaylor
Copy link
Contributor

Confirmed this PR works - thanks. 🎉

Before

ScreenShot-2023-06-05-09 50 15

After manually applying change to packages/NodeTypeResolver/PHPStan/Scope/PHPStanNodeScopeResolver.php only

ScreenShot-2023-06-05-09 48 52

@samsonasik
Copy link
Member Author

@PhilETaylor thank you for verify, PHPStan notice seems unrelated, I will fix that in separate PR.

@samsonasik
Copy link
Member Author

Restart build.

@samsonasik
Copy link
Member Author

All checks have passed 🎉 @TomasVotruba I think it is ready.

@TomasVotruba TomasVotruba merged commit dab4482 into main Jun 5, 2023
44 checks passed
@TomasVotruba TomasVotruba deleted the crash-after-exit branch June 5, 2023 09:50
@TomasVotruba
Copy link
Member

Thanks 👍

@samsonasik samsonasik restored the crash-after-exit branch December 18, 2023 04:57
@samsonasik samsonasik deleted the crash-after-exit branch December 18, 2023 04:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants