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 reports unused parameter when inherited from interface #11454

Open
BackEndTea opened this issue Aug 5, 2024 · 0 comments · May be fixed by phpstan/phpstan-src#3777
Open

Constructor reports unused parameter when inherited from interface #11454

BackEndTea opened this issue Aug 5, 2024 · 0 comments · May be fixed by phpstan/phpstan-src#3777
Labels
Milestone

Comments

@BackEndTea
Copy link
Contributor

Bug report

A constructor with an unused parameter, coming from an interface is reported as unused.

But if you don't add it, PHP will give a fatal error.

There is a difference between inheriting a constructor from a parent class, or from an interface. Where if it comes from a class you can make adjustments to the constructor, but from an interface you can not.

Code snippet that reproduces the problem

https://phpstan.org/r/b4a70747-e193-4698-9088-3d052eb7a67a

Expected output

No errors

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
Labels
Projects
None yet
2 participants