Skip to content

Constructor args are not checked in new $class(...) when the $class is class-string #12010

@LastDragon-ru

Description

@LastDragon-ru

Bug report

Seems the code like new $class(...); are not checked at all when the $class is class-string.

Code snippet that reproduces the problem

https://phpstan.org/r/89e868a6-b4dc-4927-b855-8b547ae748df

Expected output

The "Parameter #1 $i of class A constructor expects int, string given." for class-string<class>. Something like Unsafe usage of new ... for class-string<interface> (when no __constructor() signature).

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

No response

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