for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace loophp\fpt;
use Closure;
use Generator;
use phpDocumentor\Reflection\DocBlock\Tags\Generic;
// phpcs:disable Generic.Files.LineLength.TooLong
/**
* @psalm-immutable
*/
final class Filter
{
* @psalm-pure
public static function of(): Closure
return static fn (callable $callable): Closure => static function (iterable $iterable) use ($callable): Generator {
foreach ($iterable as $key => $value) {
if ($callable($value)) {
yield $key => $value;
}
};