-
-
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
Add ExceptionList property for UnusedFormalParameter #984
base: master
Are you sure you want to change the base?
Conversation
Isn't that then a fault with the class, correctly detected by PHPMD. and should be corrected instead of ignored? |
Yeah, is a fault with the class, but the entire framework uses like this. So we can only ask for a fix in the framework and implement a exception list in PHMD 🤷♂️ |
Maybe a better solution is to have a setting to ignore violations that are inherited? |
IIRC it's a |
In this case I should remove the request because it isn't required to have. (I have changed it in my stubs) A generic rule means that you have more change to hide a place where it should notice about a problem. |
If that is the case then there is no reason to actually have the unused argument. PHP doesn't have function overloading so if Laravel is calling the function with more arguments then it has it will still work the same. |
As you guys said, there are other ways to suppress this warning, suppress comment, ignore inherited and others. The exception property is just one more option that anybody can use as they wish. This feature has no breaking changes. |
Ok |
Handling inheritance better does not prevent to have an list for exceptions. This PR still need to have documentation update and unit tests. If so I would approve. @AJenbo @tvbeek @ravage84 Are you fine with that? Let's have a definitive go/no-go decision so either we define what it needs to be merged, or we close. |
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.
Since it's pointless to fight bad framework design and people potentially shooting themselves in the foot, we can add this.
But it needs docs, tests etc as usual.
Type: feature
This PR add the exception property to the UnusedFormalParameter rule.
Some classes of some frameworks, such as Laravel ApiResource, uses some parameters that arent used by the method.