Skip to content

Commit 7deeab4

Browse files
committed
Docs about filterNotNull
1 parent 480066f commit 7deeab4

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/Doc/Md/Psalm/1_PsalmSupport.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,3 +346,23 @@ $ vendor/bin/psalm-plugin enable fp4php/functional
346346
return partitionT($list, fn($i) => $i instanceof Foo, fn($i) => $i instanceof Bar);
347347
}
348348
```
349+
350+
- #### filterNotNull
351+
352+
Plugin turns all nullable keys to possibly undefined keys:
353+
```php
354+
<?php
355+
356+
declare(strict_types=1);
357+
358+
use function Fp\Collection\filterNotNull;
359+
360+
/**
361+
* @param array{name: string, age: int|null} $shape
362+
* @return array{name: string, age?: int}
363+
*/
364+
function example(array $shape): array
365+
{
366+
return filterNotNull($shape);
367+
}
368+
```

0 commit comments

Comments
 (0)