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

Incorrect method.childParameterType when implementing abstract trait function #12073

Open
stefanfisk opened this issue Nov 18, 2024 · 1 comment
Labels
Milestone

Comments

@stefanfisk
Copy link

Bug report

When implementing an abstract function from a trait with an array param PHPStan 2.0 generate a false method.childParameterType issue if the array key type is specified as int or string. array-key works.

Here is an example: https://phpstan.org/r/bcc05431-7490-4be9-b71c-57f224947222

Subclassing does not exhibit the same issue: https://phpstan.org/r/29b940f4-3d50-4535-b350-d6016cfabf8a

Code snippet that reproduces the problem

https://phpstan.org/r/bcc05431-7490-4be9-b71c-57f224947222

Expected output

No issues, the code is correct!

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

No response

@ondrejmirtes ondrejmirtes added this to the Easy fixes milestone Nov 19, 2024
@ondrejmirtes
Copy link
Member

The issue is most likely that FileTypeMapper does not see the PHPDoc in the trait. Feel free to investigate.

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

No branches or pull requests

2 participants