Skip to content

Bogus certainty of empty array inside delayed-use closure #8292

@dktapps

Description

@dktapps

Bug report

PHPStan cannot be certain of class field types inside a closure, regardless of whether they were initialized outside of the closure.

Code snippet that reproduces the problem

https://phpstan.org/r/f9c6e122-a753-4fdf-b729-a5523443e71d

Expected output

No error should be reported. By the time the closure is invoked, the array may contain something.

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

It's cool to see all the new stuff brought by 1.9

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions