File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -344,6 +344,12 @@ class Generic_Sniffs_CodeAnalysis_VariableAnalysisSniff implements PHP_CodeSniff
344344 */
345345 public $ allowUnusedCaughtExceptions = false ;
346346
347+ /**
348+ * Allow function parameters to be unused without provoking unused-var warning.
349+ * Set generic.codeanalysis.variableanalysis.allowUnusedFunctionParameters to a true value.
350+ */
351+ public $ allowUnusedFunctionParameters = false ;
352+
347353 /**
348354 * A list of names of placeholder variables that you want to ignore from
349355 * unused variable warnings, ie things like $junk.
@@ -1453,6 +1459,9 @@ protected function processScopeClose(
14531459 if ($ varInfo ->ignoreUnused || isset ($ varInfo ->firstRead )) {
14541460 continue ;
14551461 }
1462+ if ($ this ->allowUnusedFunctionParameters && $ varInfo ->scopeType == 'param ' ) {
1463+ continue ;
1464+ }
14561465 if ($ varInfo ->passByReference && isset ($ varInfo ->firstInitialized )) {
14571466 // If we're pass-by-reference then it's a common pattern to
14581467 // use the variable to return data to the caller, so any
You can’t perform that action at this time.
0 commit comments