Skip to content

PHPStan does not respect @phpstan-consistent-constructor for a class without a constructor #11316

@calebdw

Description

@calebdw

Bug report

Hello!

It seems like PHPStan throws new.static errors when a class does not explicitly define a constructor (the default is used) and @phpstan-consistent-constructor is used

Thanks!

Code snippet that reproduces the problem

https://phpstan.org/r/e09887ea-9714-487f-8a11-463c65b6049e

Expected output

I would expect PHPStan to pass instead of having to define an empty constructor:

https://phpstan.org/r/cbbbcf58-2cce-427e-98ee-3deab22688f4

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

Yes, thanks for all your hard work!

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