Skip to content

Inferred ThisType(ClassName) does not accept ClassName #6291

@jiripudil

Description

@jiripudil

Bug report

Since 1.3.0, PHPStan started reporting this strange error in our codebase. A type of $this(ArticlesTable) is inferred for a type parameter but then rejects a value of type ArticlesTable which is a final class. Funnily enough, making the class non-final yields no errors.

Code snippet that reproduces the problem

https://phpstan.org/r/7a3f32f4-c17e-4c56-a8ac-48a7a7fc96b1

Expected output

No error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions