for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Humbug\PhpScoper\Patcher;
use function array_reduce;
final class PatcherChain implements Patcher
{
/**
* @var array<(callable(string, string, string): string)|Patcher>
array<(callable(string, ...ring): string)|Patcher>
3
*/
private array $patchers;
* @param array<callable(string, string, string): string> $patchers
array<callable(string, string, string): string>
2
public function __construct(array $patchers = [])
$this->patchers = $patchers;
}
public function __invoke(string $filePath, string $prefix, string $contents): string
return (string) array_reduce(
$this->patchers,
static fn (string $contents, callable $patcher) => $patcher($filePath, $prefix, $contents),
$contents,
);