Skip to content

Previously working generic for exception class fails #3420

@vojtech-dobes

Description

@vojtech-dobes

Bug report

We have a generic class, which receives exception class as templated parameter and then uses it to throw. Previously it was recognized by PhpStan, but both on 0.12.26 & 0.12.27 this now fails (both on throw and on @throws phpDoc).

Invalid type TExceptionClass of RuntimeException to throw
PHPDoc tag @throws with type TExceptionClass of Exception is not subtype of Throwable

Code snippet that reproduces the problem

https://phpstan.org/r/a2f79f88-a35e-450d-86d1-86d750e6b21b

Expected output

No error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions