Allow unused function arguments as regexp #22
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There are already three options for ignoring unused variables. This PR adds documentation for those options and also adds a new option to allow ignoring variables by regular expression. This will bring the available options to the following:
allowUnusedFunctionParameters
(bool, defaultfalse
): if set to true, function arguments will never be marked as unused.allowUnusedCaughtExceptions
(bool, defaultfalse
): if set to true, caught Exception variables will never be marked as unused.validUnusedVariableNames
(string, defaultnull
): a space-separated list of names of placeholder variables that you want to ignore from unused variable warnings. For example, to ignore the variables$junk
and$unused
, this could be set to'junk unused'
.ignoreUnusedRegexp
(string, defaultnull
): a PHP regexp string (note that this requires explicit delimiters) for variables that you want to ignore from unused variable warnings. For example, to ignore the variables$_junk
and$_unused
, this could be set to'/^_/'
.Fixes #21.
To do
validUnusedVariableNames
validUnusedVariableNames
to array lateignoreUnusedRegexp
option to allow unused arguments regexpallowUnusedFunctionParameters
,validUnusedVariableNames
,allowUnusedCaughtExceptions
andignoreUnusedRegexp