Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
* develop:
  specify next release
  fix frames types transitions
  fix NoOp constructor
  • Loading branch information
Baptouuuu committed Dec 3, 2023
2 parents 0d6988c + b764c56 commit 4f9bb19
Show file tree
Hide file tree
Showing 9 changed files with 136 additions and 1 deletion.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## 2.4.1 - 2023-12-03

### Fixed

- `Innmind\IO\Readable\Frame\NoOp` constructor type
- Frames types transitions via `::filter()`, `::map()` and `::flatMap()`

## 2.4.0 - 2023-12-03

### Added
Expand Down
16 changes: 16 additions & 0 deletions src/Readable/Frame/Chunk.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ public static function of(int $size): self

/**
* @psalm-mutation-free
*
* @param callable(Str): bool $predicate
*
* @return Frame<Str>
*/
public function filter(callable $predicate): Frame
{
Expand All @@ -56,6 +60,12 @@ public function filter(callable $predicate): Frame

/**
* @psalm-mutation-free
*
* @template U
*
* @param callable(Str): U $map
*
* @return Frame<U>
*/
public function map(callable $map): Frame
{
Expand All @@ -64,6 +74,12 @@ public function map(callable $map): Frame

/**
* @psalm-mutation-free
*
* @template U
*
* @param callable(Str): Frame<U> $map
*
* @return Frame<U>
*/
public function flatMap(callable $map): Frame
{
Expand Down
16 changes: 16 additions & 0 deletions src/Readable/Frame/Chunks.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ public function until(int $size, callable $predicate): self

/**
* @psalm-mutation-free
*
* @param callable(Seq<Str>): bool $predicate
*
* @return Frame<Seq<Str>>
*/
public function filter(callable $predicate): Frame
{
Expand All @@ -108,6 +112,12 @@ public function filter(callable $predicate): Frame

/**
* @psalm-mutation-free
*
* @template U
*
* @param callable(Seq<Str>): U $map
*
* @return Frame<U>
*/
public function map(callable $map): Frame
{
Expand All @@ -116,6 +126,12 @@ public function map(callable $map): Frame

/**
* @psalm-mutation-free
*
* @template U
*
* @param callable(Seq<Str>): Frame<U> $map
*
* @return Frame<U>
*/
public function flatMap(callable $map): Frame
{
Expand Down
16 changes: 16 additions & 0 deletions src/Readable/Frame/Filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ public static function of(Frame $frame, callable $predicate): self

/**
* @psalm-mutation-free
*
* @param callable(T): bool $predicate
*
* @return Frame<T>
*/
public function filter(callable $predicate): Frame
{
Expand All @@ -62,6 +66,12 @@ public function filter(callable $predicate): Frame

/**
* @psalm-mutation-free
*
* @template U
*
* @param callable(T): U $map
*
* @return Frame<U>
*/
public function map(callable $map): Frame
{
Expand All @@ -70,6 +80,12 @@ public function map(callable $map): Frame

/**
* @psalm-mutation-free
*
* @template U
*
* @param callable(T): Frame<U> $map
*
* @return Frame<U>
*/
public function flatMap(callable $map): Frame
{
Expand Down
16 changes: 16 additions & 0 deletions src/Readable/Frame/FlatMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ public static function of(Frame $frame, callable $map): self

/**
* @psalm-mutation-free
*
* @param callable(U): bool $predicate
*
* @return Frame<U>
*/
public function filter(callable $predicate): Frame
{
Expand All @@ -65,6 +69,12 @@ public function filter(callable $predicate): Frame

/**
* @psalm-mutation-free
*
* @template V
*
* @param callable(U): V $map
*
* @return Frame<V>
*/
public function map(callable $map): Frame
{
Expand All @@ -73,6 +83,12 @@ public function map(callable $map): Frame

/**
* @psalm-mutation-free
*
* @template V
*
* @param callable(U): Frame<V> $map
*
* @return Frame<V>
*/
public function flatMap(callable $map): Frame
{
Expand Down
16 changes: 16 additions & 0 deletions src/Readable/Frame/Line.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ public static function new(): self

/**
* @psalm-mutation-free
*
* @param callable(Str): bool $predicate
*
* @return Frame<Str>
*/
public function filter(callable $predicate): Frame
{
Expand All @@ -46,6 +50,12 @@ public function filter(callable $predicate): Frame

/**
* @psalm-mutation-free
*
* @template U
*
* @param callable(Str): U $map
*
* @return Frame<U>
*/
public function map(callable $map): Frame
{
Expand All @@ -54,6 +64,12 @@ public function map(callable $map): Frame

/**
* @psalm-mutation-free
*
* @template U
*
* @param callable(Str): Frame<U> $map
*
* @return Frame<U>
*/
public function flatMap(callable $map): Frame
{
Expand Down
16 changes: 16 additions & 0 deletions src/Readable/Frame/Map.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ public static function of(Frame $frame, callable $map): self

/**
* @psalm-mutation-free
*
* @param callable(U): bool $predicate
*
* @return Frame<U>
*/
public function filter(callable $predicate): Frame
{
Expand All @@ -64,6 +68,12 @@ public function filter(callable $predicate): Frame

/**
* @psalm-mutation-free
*
* @template V
*
* @param callable(U): V $map
*
* @return Frame<V>
*/
public function map(callable $map): Frame
{
Expand All @@ -72,6 +82,12 @@ public function map(callable $map): Frame

/**
* @psalm-mutation-free
*
* @template V
*
* @param callable(U): Frame<V> $map
*
* @return Frame<V>
*/
public function flatMap(callable $map): Frame
{
Expand Down
18 changes: 17 additions & 1 deletion src/Readable/Frame/NoOp.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ final class NoOp implements Frame
*
* @param T $value
*/
private function __construct(int $value)
private function __construct(mixed $value)
{
$this->value = $value;
}
Expand All @@ -52,6 +52,10 @@ public static function of(mixed $value): self

/**
* @psalm-mutation-free
*
* @param callable(T): bool $predicate
*
* @return Frame<T>
*/
public function filter(callable $predicate): Frame
{
Expand All @@ -60,6 +64,12 @@ public function filter(callable $predicate): Frame

/**
* @psalm-mutation-free
*
* @template U
*
* @param callable(T): U $map
*
* @return Frame<U>
*/
public function map(callable $map): Frame
{
Expand All @@ -68,6 +78,12 @@ public function map(callable $map): Frame

/**
* @psalm-mutation-free
*
* @template U
*
* @param callable(T): Frame<U> $map
*
* @return Frame<U>
*/
public function flatMap(callable $map): Frame
{
Expand Down
16 changes: 16 additions & 0 deletions src/Readable/Frame/Sequence.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ public function until(callable $predicate): self

/**
* @psalm-mutation-free
*
* @param callable(Seq<T>): bool $predicate
*
* @return Frame<Seq<T>>
*/
public function filter(callable $predicate): Frame
{
Expand All @@ -90,6 +94,12 @@ public function filter(callable $predicate): Frame

/**
* @psalm-mutation-free
*
* @template U
*
* @param callable(Seq<T>): U $map
*
* @return Frame<U>
*/
public function map(callable $map): Frame
{
Expand All @@ -98,6 +108,12 @@ public function map(callable $map): Frame

/**
* @psalm-mutation-free
*
* @template U
*
* @param callable(Seq<T>): Frame<U> $map
*
* @return Frame<U>
*/
public function flatMap(callable $map): Frame
{
Expand Down

0 comments on commit 4f9bb19

Please sign in to comment.