Skip to content

LazyCollection::every() type inferences by PHPStan are completely broken  #41369

@mpyw

Description

@mpyw
  • Laravel Version: 9.3.1
  • PHPStan Version: 1.4.5
  • Larastan Version: 1.0.3
  • PHP Version: 8.1

Description & Reproduction Steps:

$collection = new LazyCollection([new \stdClass]);
\PHPStan\dumpType($collection->every(...));

Expected:

Dumped type: Closure((callable(stdClass, int): bool)|stdClass|string, mixed, mixed): bool

Actual:

Dumped type: Closure((callable(int, int): bool)|int|string, mixed, mixed): bool

Though I haven't determined yet whether it is a PHPStan bug or a Laravel bug, I'll submit it as a Laravel issue for the time being.

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