Skip to content

Type inference from get_class #1885

@marcospassos

Description

@marcospassos

Summary of a problem or a feature request

If you want to know if two classes are exactly of the same type, you have no option other than to use \get_class(). Currently, PHPStan provides no support for inferring the type from conditional tests for type equality.

Code snippet that reproduces the problem

https://phpstan.org/r/2671c878-5958-41ba-a485-e21668d1f00d

Expected output

No violation.

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