* SPDX-FileContributor: Emmerson Siqueira * SPDX-FileContributor: Graham Campbell * SPDX-FileContributor: Henrique Moody * SPDX-FileContributor: Nick Lombard * SPDX-FileContributor: Pathum Harshana De Silva * SPDX-FileContributor: Kir Kolyshkin */ declare(strict_types=1); namespace Respect\Validation\Validators; use Attribute; use Respect\Validation\Result; use Respect\Validation\Validator; use function call_user_func; #[Attribute(Attribute::TARGET_PROPERTY | Attribute::TARGET_CLASS | Attribute::IS_REPEATABLE)] final class Call implements Validator { /** @var callable */ private $callable; public function __construct( callable $callable, private readonly Validator $validator, ) { $this->callable = $callable; } public function evaluate(mixed $input): Result { return $this->validator->evaluate(call_user_func($this->callable, $input)); } }