[PHP] "Remove this unused local variable" using "extract".

50 views
Skip to first unread message

li...@nitsnets.com

unread,
May 10, 2017, 4:06:23 AM5/10/17
to SonarQube
Extracted vars are detected as unused variables:

class MyClass 
{
    function response(array $vars)
    {
        extract($vars);
        return sprintf('Hello, %s welcome to %s', $user->name, $site->name);
    }
}

$user and $site return "Remove this unused local variable" error.

Sonar:  6.3.1
Scanner: sonar-scanner-cli-3.0.1.733.jar

Thanks!

Elena Vilchik

unread,
May 11, 2017, 3:34:55 AM5/11/17
to SonarQube, li...@nitsnets.com
Hello,

Thanks for reporting false positive.

Elena Vilchik | SonarSource
Language Team
Reply all
Reply to author
Forward
0 new messages