value = $value; } /** * @inheritDoc */ public function validate(ValidationContext $context, Schema $schema): ?ValidationError { $data = $context->currentData(); foreach ($this->value as $name => $value) { if (!property_exists($data, $name)) { continue; } foreach ($value as $prop) { if (!property_exists($data, $prop)) { return $this->error($schema, $context, 'dependentRequired', "'{$prop}' property is required by '{$name}' property", [ 'property' => $name, 'missing' => $prop, ]); } } } return null; } }