for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace RustamWin\Attributes\Handler;
use ReflectionClass;
final class CompositeHandler implements AttributeHandlerInterface
{
/**
* @param AttributeHandlerInterface[] $handlers
*/
public function __construct(private array $handlers)
$this->validateHandlers();
}
* @inheritDoc
public function handle(ReflectionClass $class, iterable $attributes): void
foreach ($this->handlers as $handler) {
$handler->handle($class, $attributes);
private function validateHandlers(): void
if (!$handler instanceof AttributeHandlerInterface) {
throw new \InvalidArgumentException(sprintf('Handler must implement AttributeHandlerInterface, got %s.', get_debug_type($handler)));