Skip to content

array_splice resets int keys of the input array #14037

@takaram

Description

@takaram

Bug report

array_splice resets the key of the input array when the keys are integer.
https://3v4l.org/R0a2I

PHPStan infers the correct type on constant arrays, but not for general arrays like array<10|20|30, mixed>.

Code snippet that reproduces the problem

https://phpstan.org/r/4753d549-20a2-4c81-85e8-2d821cf9a41f

Expected output

No error on assertType

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

No response

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