Skip to content

Offset 0 should not be optional on non empty list #14308

@VincentLanglet

Description

@VincentLanglet

Bug report

https://phpstan.org/r/3a7a3f51-53af-4e10-9db7-388d76e23795

The error Offset 0 might not exist on non-empty-list{0?: 'redoc'|'scalar'|'swagger', 1?: 'redoc'|'scalar', 2?: 'scalar'} is odd.

It should have been improved by phpstan/phpstan-src#5067
which worked on intersection of ConstantArray and AccessoryIsList

Code snippet that reproduces the problem

https://phpstan.org/r/3a7a3f51-53af-4e10-9db7-388d76e23795

Expected output

No errors.

And the dumpType could even be
list{0: 'redoc'|'scalar'|'swagger', 1?: 'redoc'|'scalar', 2?: 'scalar'}
or non-empty-list{0: 'redoc'|'scalar'|'swagger', 1?: 'redoc'|'scalar', 2?: 'scalar'}.

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

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions