Having this code:
<?php declare(strict_types = 1);
function TestCallable(callable $c) : void
{
}
abstract class AB
{
public static function Foo() : void
{
TestCallable(function () use ($doesNotExist)
{
});
}
}
Here, there are two errors that PHP Tools does not detect:
$doesNotExist is a variable that does not exist.
$doesNotExist is not being used inside the anonymous method, thus could be removed.
PHPStan does detect both issues:
- Anonymous function has an unused use $doesNotExist.
- Undefined variable: $doesNotExist
Suggestion
Please make PHP Tools also detect both issues and underline them.