-
-
Notifications
You must be signed in to change notification settings - Fork 344
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
Regression in 2.9.0: False positive using ShortVariable for $e
in catch() within a foreach()
#826
Comments
$e
in catch() within a foreach()$e
in catch() within a foreach()
Hello, Thanks for raising this. I can't see why the expected behavior would be "no errors", for me the bug in proof.php is that PHPMD does not rise an error line 31. |
OK, Indeed, the code is supposed to filter short variable created via |
@kylekatarnls I kind of disagree with you on that, primarily because I think that the type/classname of the caught Exception should already describe the intention of the variable enough. At most people would start using Using See https://github.com/phpmd/phpmd/blob/2.8.2/src/main/php/PHPMD/Rule/Naming/ShortVariable.php#L173 |
I agree on both statements. Using |
Thank you, @Doqnach for the detailed issue report. |
Fix #826 consider foreach exception only for direct children
Current Behavior
False positive for
ShortVariable
, regression since earlier versions:Expected Behavior
No errors.
Steps To Reproduce:
Proof of concept: https://github.com/Doqnach/phpmd-shortvariable-error
The problem seems to be related to PR #807 (2.9.0). Works like expected in 2.8.2.
Checks before submitting
The text was updated successfully, but these errors were encountered: