-
-
Notifications
You must be signed in to change notification settings - Fork 946
Closed
Labels
Description
Bug report
phpstan-ignore-line does not work in certain circumstances
Code snippet that reproduces the problem
https://phpstan.org/r/51956c1f-c771-478e-b8b7-3ce82321edc6
trait SomeTrait {
private function sayHello(): ?string // @phpstan-ignore-line
{
return $this->value;
}
}
class HelloWorld2
{
use SomeTrait;
private string $value = '';
public function sayIt(): void
{
echo $this->sayHello();
}
}Code above raises Method HelloWorld2::sayHello() never returns null so it can be removed from the return type. error
Expected output
no error
Did PHPStan help you today? Did it make you happy in any way?
yup!
Reactions are currently unavailable