We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1f9aa2f commit 480066fCopy full SHA for 480066f
src/Doc/Md/Psalm/1_PsalmSupport.md
@@ -321,4 +321,28 @@ $ vendor/bin/psalm-plugin enable fp4php/functional
321
return $separated->toEither();
322
}
323
```
324
-
+
325
+- #### partitionT
326
327
+ Plugin infers each `list` type from predicates of `partitionT`:
328
329
+ ```php
330
+ <?php
331
332
+ declare(strict_types=1);
333
334
+ use Tests\Mock\Foo;
335
+ use Tests\Mock\Bar;
336
+ use Tests\Mock\Baz;
337
338
+ use function Fp\Collection\partitionT;
339
340
+ /**
341
+ * @param list<Foo|Bar|Baz> $list
342
+ * @return array{list<Foo>, list<Bar>, list<Baz>}
343
+ */
344
+ function testExhaustiveInference(array $list): array
345
+ {
346
+ return partitionT($list, fn($i) => $i instanceof Foo, fn($i) => $i instanceof Bar);
347
+ }
348
+ ```
0 commit comments