value = $value; $this->resolver = $resolver; parent::__construct('', []); } /** * @inheritDoc */ public function validate(ValidationContext $context, Schema $schema): ?ValidationError { $value = $this->value->data($context->rootData(), $context->currentDataPath(), $this); if ($value === $this || !is_string($value)) { return $this->error($schema, $context, 'format', 'Invalid $data', [ 'pointer' => (string)$this->value, ]); } /** @var string $value */ $type = $context->currentDataType(); $types = [ $type => $this->resolver->resolve($value, $type), ]; if (!$types[$type] && ($super = Helper::getJsonSuperType($type))) { $types[$super] = $this->resolver->resolve($value, $super); unset($super); } unset($type); $this->name = $value; $this->types = $types; $ret = parent::validate($context, $schema); $this->name = $this->types = null; return $ret; } }