Skip to content

Dynamic type for array functions does not work #3155

@ossinkine

Description

@ossinkine

Bug report

Return type of some functions (such array_key_first, array_key_last, reset, end, array_pop, array_shift, min, max) depends on count elements in argument array.
Since PHPStan can count array size the returning type should be detected correctly but it does not.

Code snippet that reproduces the problem

https://phpstan.org/r/1317dc25-c959-4053-bf09-e3639df688e8

Expected output

I expect no errors in a snippet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions