Skip to content

Array_search DynamicReturnType is not working #3316

@VincentLanglet

Description

@VincentLanglet

Bug report

Code snippet that reproduces the problem

https://phpstan.org/r/04a5c099-1223-4ff3-bc41-cc4d9791d0ba

Expected output

No error

array_values is correctly typed as array<int, string>.
So it should return the key found (int) or false if not found.

There is ArraySearchFunctionDynamicReturnTypeExtension, so it seems like something is buggy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions