-
-
Notifications
You must be signed in to change notification settings - Fork 205
Improve ArgumentFunctionsReportCurrentValue to avoid false positive? #1207
Copy link
Copy link
Closed
Labels
Milestone
Description
With a minimum example code like:
function foo ( $stuff ) {
if ( true === SOME_CONSTANT ) {
return $stuff;
}
foreach ( func_get_args() as $arg ) {
...
}
}and a testVersion that includes 7.0 or later, I get a Warning of:
Since PHP 7.0, functions inspecting arguments, like func_get_args(), no longer report the original value as passed to a parameter, but will instead provide the current value. The parameter "$stuff" was used, and possibly changed (by reference), on line 5.
(PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValue.NeedsInspection)
...against the line containing the func_get_args().
It seems like it would be possible to look at the use of the variable in line 5, and to see if has been assigned to in some way, before giving the violation?
Reactions are currently unavailable