<?php declare(strict_types = 1);
trait FooBar
{
public function foo(): string
{
return 'abc';
}
}
class HelloWorld
{
public function sayHello(mixed $value): void
{
if ($value instanceof FooBar) {
echo $value->foo();
}
}
}
I expect no error for the code above.
Bug report
Code snippet that reproduces the problem
https://phpstan.org/r/21864fe8-ba76-4945-b9fc-9dc27e286ca1
Expected output
I expect no error for the code above.
Did PHPStan help you today? Did it make you happy in any way?
This snippet system with try is still very cool to be sure in a blink if current version has the same output.