-
-
Notifications
You must be signed in to change notification settings - Fork 452
rector: RemoveUnusedVariableInCatchRector
#4834
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
rector: RemoveUnusedVariableInCatchRector
#4834
Conversation
|
Pls ignore Sonar. |
|
i'm more curious why the Exceptions aren't used, not even logged with Also since most of Mage core stuff does throw Throwable instead of Exception now, |
|
I think there is some space for improvements. Want to oen a new issue or discussion for that? |
|
|
Pls ignnore sonar. (in free version it is not possible to adjust that limit) |
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.
Pull Request Overview
This PR applies the Rector rule RemoveUnusedVariableInCatchRector to eliminate unused exception variables in catch blocks throughout the OpenMage codebase. This refactoring improves code cleanliness by removing variables that are caught but never used.
- Removes unused exception variables from catch blocks where the exception is not referenced
- Maintains exception variables where they are actually used (e.g., for logging, re-throwing, or error messages)
- Updates @throws annotations in one case to properly document exceptions that can be thrown
Reviewed Changes
Copilot reviewed 139 out of 139 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| Various PHP files | Removed unused exception variables from catch blocks where exceptions are caught but not used |
| lib/Varien/Data/Tree/Db.php | Added @throws Exception annotation and renamed exception variables for clarity where they are actually used |
|
|
Merged with one green. |


See https://getrector.com/rule-detail/remove-unused-variable-in-catch-rector