Skip to content

array_rand() - "offset might not exists" #12981

@staabm

Description

@staabm

Bug report

array rand returns a valid index for the given array, as long as the array is non-empty

Code snippet that reproduces the problem

https://phpstan.org/r/2c6b246b-0f5b-461d-8dfb-1916dace03aa

Expected output

no errors

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

No response

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