vscode-intelephense
vscode-intelephense copied to clipboard
Does not recognize instanceof in match
Not sure if this is a bug or a feature request, but I have the following code (roughly):
interface Foo {
public function bar();
}
class A implements Foo {
public function bar()
{
return 'a';
}
}
class B implements Foo {
public function bar()
{
return 'b';
}
public function baz()
{
return 'c';
}
}
function test(Foo $foo) {
return match (true) {
$foo instanceof B => $foo->baz(),
default => $foo->bar(),
};
}
Intelephense shows an undefined method
error on $foo->baz()
, while it could (should?) know that $foo
is an instance of B
, with method baz()
in this case.
(Using Intelephense 1.8.2 on Ubuntu 20.04.3 LTS if that matters)