Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,3 @@ jobs:
uses: innmind/github-workflows/.github/workflows/psalm-matrix.yml@main
cs:
uses: innmind/github-workflows/.github/workflows/cs.yml@main
with:
php-version: '8.2'
12 changes: 12 additions & 0 deletions .github/workflows/extensive.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Extensive CI

on:
push:
tags:
- '*'
paths:
- '.github/workflows/extensive.yml'

jobs:
blackbox:
uses: innmind/github-workflows/.github/workflows/extensive.yml@main
39 changes: 39 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,44 @@
# Changelog

## [Unreleased]

### Added

- `Innmind\Immutable\Predicate::and()`
- `Innmind\Immutable\Predicate::or()`
- `Innmind\Immutable\Sequence->lookup()->first()->maybe()`
- `Innmind\Immutable\Sequence->lookup()->first()->attempt()`
- `Innmind\Immutable\Sequence->lookup()->first()->either()`
- `Innmind\Immutable\Sequence->lookup()->last()->maybe()`
- `Innmind\Immutable\Sequence->lookup()->last()->attempt()`
- `Innmind\Immutable\Sequence->lookup()->last()->either()`

### Changed

- `Innmind\Immutable\Map::partition()` now returns an array to allow for destructuring
- `Innmind\Immutable\Sequence::partition()` now returns an array to allow for destructuring
- `Innmind\Immutable\Set::partition()` now returns an array to allow for destructuring
- `Innmind\Immutable\Map` no longer implements `Countable`
- `Innmind\Immutable\Sequence` no longer implements `Countable`
- `Innmind\Immutable\Set` no longer implements `Countable`
- Requires PHP `8.4`
- `Innmind\Immutable\Predicate` is now a final class

### Removed

- `Innmind\Immutable\Fold`
- `Innmind\Immutable\State`
- `Innmind\Immutable\Sequence::indexOf()`
- `Innmind\Immutable\Set::defer()`
- `Innmind\Immutable\SideEffect::__construct()`
- `Innmind\Immutable\Sequence::count()`
- `Innmind\Immutable\Set::count()`
- `Innmind\Immutable\Map::count()`

### Fixed

- PHP `8.5` deprecation

## 5.20.0 - 2025-09-06

### Added
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"issues": "http://github.com/Innmind/Immutable/issues"
},
"require": {
"php": "~8.2"
"php": "~8.4"
},
"autoload": {
"psr-4": {
Expand All @@ -30,7 +30,7 @@
}
},
"require-dev": {
"innmind/static-analysis": "^1.2.1",
"innmind/static-analysis": "~1.3",
"innmind/black-box": "^6.4.1",
"innmind/coding-standard": "~2.0"
},
Expand Down
130 changes: 0 additions & 130 deletions docs/structures/fold.md

This file was deleted.

2 changes: 0 additions & 2 deletions docs/structures/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ This library provides the following structures:
- [`Attempt`](attempt.md)
- [`Validation`](validation.md)
- [`Identity`](identity.md)
- [`State`](state.md)
- [`Fold`](fold.md)

See the documentation for each structure to understand how to use them.

Expand Down
32 changes: 5 additions & 27 deletions docs/structures/map.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,6 @@ $map = Map::of([1, 2]);
$map->size(); // 1
```

### `->count()`

This is an alias for `->size()`, but you can also use the PHP function `\count` if you prefer.

```php
$map = Map::of([1, 2]);
$map->size(); // 1
\count($map); // 1
```

### `->get()`

Return an instance of [`Maybe`](maybe.md) that may contain the value associated to the given key (if it exists).
Expand Down Expand Up @@ -319,26 +309,14 @@ $map

### `->partition()`

This method is similar to `->groupBy()` method but the map keys are always booleans. The difference is that here the 2 keys are always present whereas with `->groupBy()` it will depend on the original map.
This method is similar to `->groupBy()` except it always return 2 `Map`s. The first one contains elements that match the predicate and the second the ones that don't.

```php
$map = Map::of([1, 2], [2, 3], [3, 3]);
/** @var Map<bool, Map<int, int>> */
$map = $map->partition(fn($key, $value) => ($key + $value) % 2 === 0);
$map
->get(true)
->match(
static fn($partition) => $partition,
static fn() => Map::of(),
)
->equals(Map::of([3, 3])); // true
$map
->get(false)
->match(
static fn($partition) => $partition,
static fn() => Map::of(),
)
->equals(Map::of([1, 2], [2, 3])); // true
/** @var array{Map<int, int>, Map<int, int>} */
[$true, $false] = $map->partition(fn($key, $value) => ($key + $value) % 2 === 0);
$true->equals(Map::of([3, 3])); // true
$false->equals(Map::of([1, 2], [2, 3])); // true
```

### `->clear()`
Expand Down
Loading