Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 3.7.2

Request #19950 UnusedFunctionParameter sniff should allow skipping unused before used ones
Submitted: 2013-05-16 21:16 UTC
From: krinkle Assigned: krinkle
Status: Closed Package: PHP_CodeSniffer (version 1.4.5)
PHP Version: 5.4.14 OS: Linux
Roadmaps: (Not assigned)    
Subscription  


 [2013-05-16 21:16 UTC] krinkle (Timo Tijhof)
Description: ------------ A function of which one does not directly control the arguments (e.g. a callback, a hook etc.) often causes UnusedFunctionParameter warnings because, though I omit unused arguments from the signature at the end, I can't omit ones in the middle of the arguments list. For example: Hooks::emit( 'some event', array( $foo, $bar, $quux ) ); Hooks::on( 'some event', array( $this, 'x' ); /** * @parma $foo * @parma $bar * @parma $quux */ public function x ( $foo, $bar ) { return $this->handle( $bar ); } In such case it should either ignore $foo, or perhaps use a different sub-sniff name (UnusedFunctionParameter.MiddleFound in addition to UnusedFunctionParameter.Found or whatever) so that one can disable it from the ruleset.xml.

Comments

 [2018-09-17 21:15 UTC] krinkle (Timo Tijhof)
-Status: Open +Status: Closed -Assigned To: +Assigned To: krinkle