Skip to content

Unsafe use of new static when trait enforces constructor via abstract method #9654

@levu42

Description

@levu42

Bug report

When a trait enforces the signature of a constructor, there should be no unsafe use of new static() warning. This works according to the documentation already when an interface enforces the signature of a constructor, but not when a trait enforces it.

Code snippet that reproduces the problem

https://phpstan.org/r/d9a25afa-7a4d-4582-8f11-54a193b20a89

Expected output

No error

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

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions