Skip to content

instanceof $class not reported as an error when $class is string|null #10036

@dktapps

Description

@dktapps

Bug report

As per title.

This code causes an Error to be thrown in PHP, but PHPStan is happy with it.

https://3v4l.org/MAigb

Code snippet that reproduces the problem

https://phpstan.org/r/aca3a083-be53-401d-a12a-78be2fe35bec

Expected output

An error should be reported on line 7, since $class could be null and lead to an error.

Did PHPStan help you today? Did it make you happy in any way?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions