Skip to content

Incorrect method.childParameterType when implementing abstract trait function #12073

@stefanfisk

Description

@stefanfisk

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions