Skip to content

Should a count on $matches ensure an array element is present? #11277

@mitelg

Description

@mitelg

Bug report

Hey there 👋

See the example I provided. I wonder if PHPStan should know after the count check if the array key 1 exists. Since we are checking for the array to contain two elements, I would assume so. But I might be wrong 😁

Code snippet that reproduces the problem

https://phpstan.org/r/4f0ea824-daa5-443c-a4ea-8d742025f680

Expected output

no error should be shown

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