|
1 | 1 | ## Functions BC |
2 | 2 |
|
3 | | -All collection functions with `$callback`/`$predicate` params does not allow key as second parameter anymore. |
4 | | -To use key in the map, filter and other collection functions use *KV combinators: |
| 3 | +- All collection functions with `$callback`/`$predicate` params does not allow key as second parameter anymore. |
| 4 | + To use key in the map, filter and other collection functions use *KV combinators. |
| 5 | + Each collection function with `$callback`/`$predicate` has *KV version: |
5 | 6 | ```diff |
6 | 7 | - \Fp\Collection\map(fn($value, $key) => new Row(id: $key, data: $value)); |
7 | 8 | + \Fp\Collection\mapKV(fn($key, $value) => new Row(id: $key, data: $value)); |
8 | 9 | ``` |
9 | | -Each collection function with `$callback`/`$predicate` has *KV version. |
| 10 | + |
| 11 | +- Parameter `$preserveKeys` of `Fp\Collection\filter` has been removed. Type of input array will be preserved: |
| 12 | +```diff |
| 13 | +- \Fp\Collection\filter(['a' => 1, 'b' => 2], fn($value) => $value !== 1, preserveKeys: true); // result is ['b' => 2] |
| 14 | ++ \Fp\Collection\filter(['a' => 1, 'b' => 2], fn($value) => $value !== 1); // result is ['b' => 2] |
| 15 | +- \Fp\Collection\filter([1, 2], fn($value) => $value !== 1, preserveKeys: true); // result is [2] |
| 16 | ++ \Fp\Collection\filter([1, 2], fn($value) => $value !== 1); // result is [2] |
| 17 | +``` |
10 | 18 |
|
11 | 19 | - `Fp\Collection\existsOf` has been removed. Use `Fp\Collection\exists` instead: |
12 | 20 | ```diff |
@@ -80,6 +88,21 @@ Each collection function with `$callback`/`$predicate` has *KV version. |
80 | 88 | + \Fp\Evidence\proveNonEmptyArray(getMixed(), vType: of(Foo::class)); |
81 | 89 | ``` |
82 | 90 |
|
| 91 | +- `Fp\Json\jsonDecode` moved to `Fp\Util\jsonDecode`: |
| 92 | +```diff |
| 93 | +- \Fp\Json\jsonDecode('[1,2,3]'); |
| 94 | ++ \Fp\Util\jsonDecode('[1,2,3]'); |
| 95 | +``` |
| 96 | + |
| 97 | +- `Fp\String\regExpMatch` moved to `Fp\Util\regExpMatch`: |
| 98 | +```diff |
| 99 | +- \Fp\String\regExpMatch('/[a-z]+(?<num>[0-9]+)/', 'aa1123'); |
| 100 | ++ \Fp\Util\regExpMatch('/[a-z]+(?<num>[0-9]+)/', 'aa1123'); |
| 101 | +``` |
| 102 | + |
| 103 | +- `Fp\Reflection\getReflectionClass` has been removed without replacement. |
| 104 | +- `Fp\Reflection\getReflectionProperty` has been removed without replacement. |
| 105 | + |
83 | 106 | ## Option BC |
84 | 107 | - `Fp\Functional\Option\Option::filterOf` has been removed. Use `Fp\Functional\Option\Option::flatMap` and `Fp\Evidence\of`: |
85 | 108 | ```diff |
|
0 commit comments