Skip to content

False positive: array_walk should be working also with objects #6338

@niconoe-

Description

@niconoe-

Hi there!

I noticed some weeks ago that PHP is allowing objects in array_walk and array_walk_recursive internal functions.

Therefore, the error InvalidArgument - file.php:line:col - Argument 1 of array_walk expects array<array-key, mixed>, stdClass provided should not be triggered.
See: https://psalm.dev/r/0aeeb09741

I already helped in providing a PR for PHPStan which had the same issue as yours: phpstan/phpstan-src#573. The PR was incomplete but still, the feature to allow objects in such function was accepted

I don't know yet how you're referencing internal PHP functions, but if this is something like PHPStan, I could probably provide you a PR for that.

Have a nice day.
Regards,

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