sandhje / vscode-phpmd

VSCode PHP Mess Detector extension
MIT License
15 stars 4 forks source link

Add support of anonymous classes #43

Closed Danila1985 closed 5 years ago

Danila1985 commented 6 years ago

I have false-positive message Avoid unused local variables such as '$prop'. in anonymous class placed inside another class or function:

function getData($var) { return new class($var) { private $prop;

    public function __construct($var)
    {
        $this->prop = $var;
    }

    public function getProp()
    {
        return $this->prop;
    }
};

}

sandhje commented 5 years ago

Sorry for the late response! I'm afraid this is something you should take up with the PHPMD team (https://phpmd.org/). There is also a way to surpress certain warnings or create your own PHPMD rules, see https://phpmd.org/documentation/index.html.