sustainabil-it/phpstan-higher-order-collections
Higher Order Collection Support for PHPStan
Maintainers
Package info
github.com/Sustainabil-IT/phpstan-higher-order-collections
Type:phpstan-extension
pkg:composer/sustainabil-it/phpstan-higher-order-collections
Requires
- php: ^7.4 || ^8.0
- phpstan/phpstan: ^0.12.48|^1.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.16
- illuminate/collections: ^8.9
- phpunit/phpunit: ^9.4
Suggests
- illuminate/collections: This package works with Laravel Collections by default, but does not require them
- laravel/framework: This package works with Laravel Collections by default, but does not require them
Provides
None
Conflicts
None
Replaces
None
MIT e4363a40d191066ff3d834c228d1391a19ad4c51
- Niels Mokkentstorm <nielsmokkenstorm.woop@gmail.com>
This package is auto-updated.
Last update: 2026-06-27 18:11:00 UTC
README
This plugin adds PHPStan support to Higher Order Messaging on the Collection concept popularized by Laravel.
This extension provides following features:
Illuminate\Support\Collectionknows the type(s) of its contents using PHPStan Generics, which ensures that methods called on the Proxy objects are actually valid, and have their return types correctly inferred.
Installation
To use this extension, require it in Composer:
composer require --dev sustainabil-it/phpstan-higher-order-collections
This plugin exposes a few configuration options if you happen to have special needs, like your own Collection implementation:
parameters:
higherOrderCollection:
- collectionClass: Illuminate\Support\Enumerable
- proxyClass: Illuminate\Support\HigherOrderCollectionProxy
- keyTemplate: TKey
- typeTemplate: TValue
- proxyTemplate: TReturn
- proxyMethods:
- map
- filter
If you also install phpstan/extension-installer then you're all set!
