Skip to content

2.1.8 introduced bug with count() #12716

Closed
@momala454

Description

@momala454

Bug report

count() is invalid with a closure when counting a variable passed as reference

playground is not up to date yet

current error :

Comparison operation ">=" between 1 and 10 is always false. 
💡 Because the type is coming from a PHPDoc, you can turn off this check by setting treatPhpDocTypesAsCertain: false in your %configurationFile%.

Code snippet that reproduces the problem

https://phpstan.org/r/c4f1c380-7c64-4ec8-9c89-d8a73b5b5357

Expected output

No error, phpstan think $items length is only 1

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