It is really nice that intelephense now tries to tell you symbols that are not used(I find it great)
but the problem is that if symbol is used in dockblock then it still tells that this symbol is not used even tho it is used
@mikk150 Do you actually use the symbol in the definition of whatever you鈥檙e doc-blocking though?
Given this:
use Foo;
class Bar
{
/**
* @param Foo $foo
*/
public static function qux($foo)
{
//
}
}
I鈥檇 still expect Foo to be flagged as un-used because鈥攅ven though you鈥檝e referenced it in the docblock鈥攜ou鈥檝e not actually used it in the class or method itself.
The reason being, I could add _anything_ to a docblock, but it doesn鈥檛 actually make it so:
use Foo;
class Bar
{
/**
* @param Foo $foo
*/
public static function qux(DefinitelyNotFoo $foo)
{
//
}
}
Same for
$lastname = "Doe";
$this->set(compact("lastname"));
Symbol '$lastname' is declared but not used
@martinbean yes and no
use FooInterface;
class Bar
{
/**
* @return FooInterface
*/
public static function qux()
{
return $this->someMethodThatReturnsFoo();
}
}
that someMethodThatReturnsFoo could be method from another class or whatever
@mstroink that is something even I would not expect working because yes, it is used, no you shall never use it
Same for
$lastname = "Doe"; $this->set(compact("lastname"));Symbol '$lastname' is declared but not used
Can we have an option to disable not used check? Thanks
I agree with @martinbean example in that it's unused in the executable code. Though considering acting on the unused symbol declaration by removing it could break intellisense and generated docs I think it shouldnt be reported as unused. @mstroink in the next release if a compact call is present in the variable scope then it will be assumed all variables are used. @anothergituser #204
Reopen :)

if I remove that |null then it works
@mikk150 fixed in 1.0.5
Most helpful comment
Same for
Symbol '$lastname' is declared but not used