Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
LastDragon-ru opened this issue Nov 12, 2024 · 0 comments · May be fixed by phpstan/phpstan-src#3661

Comments

@LastDragon-ru
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants