Skip to content

PHPStan interprets return type from phpDoc as certain even with treatPhpDocTypesAsCertain set to false #4689

@morozov

Description

@morozov

Bug report

In the code snippet below, getReservedKeywordsClass() should return a class-string<KeywordList> but it's not enforced at the language level. PHPStan reports an attempt to validate the return value of the method as redundant which is not correct.

Code snippet that reproduces the problem

https://phpstan.org/r/86c37597-0fec-4f2e-b87d-663afebd512c

Expected output

No error

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