I don't know if it could be generalized, but certainly it should be skipped for \assert(). The following code will fails, but is a valid check.
interface MyInterface
{
}
class MyClass implements MyInterface
{
public function check(MyClass $myClass)
{
\assert($myClass instanceof MyInterface);
}
}
Why? I don't see the point:
Can you share your use case please (currently the report warning seems to fullfill its' intention)?
I think this case is similar to :
function check(string $a) {
if(is_string($a)){
}
}
But I can be wrong.
Re-visiting the ticket after a while. The check has found the dead code (probably existing before introducing parameter types), hence closing the issue.
@rentalhost, with a fresh look - isn't it the dead code.