michaelpetri / php-generic-list
Basic generic list with psalm support
Installs: 10 867
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 2
Open Issues: 0
Requires
- php: ~8.1.0 || ~8.2.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.16.0
- phpunit/phpunit: ^10.1.2
- roave/security-advisories: dev-latest
- vimeo/psalm: ^5.9.0
Conflicts
This package is auto-updated.
Last update: 2024-11-18 08:31:32 UTC
README
Installation
composer require michaelpetri/php-generic-list
Usage
ImmutableList::of(1, 2, 3, 4, 5) ->filter( static fn(int $i): bool => 0 === $i % 2 ) ->map( static fn(int $i): int => 2 ** $i ) ->with( 32 ) ->with( 32 ) ->unique() ->each( static function (int $i): void { sprintf("\d\n", $i) } ) // Output: // 4 // 16 // 32
Available methods
map
filter
each
toArray