annotationsReader = $annotationsReader; } public function updateDefinition(\ReflectionClass $reflectionClass, Schema $schema) { /** @var SwgDefinition $swgDefinition */ if (!$swgDefinition = $this->annotationsReader->getClassAnnotation($reflectionClass, SwgDefinition::class)) { return; } if (null !== $swgDefinition->required) { $schema->setRequired($swgDefinition->required); } } public function getPropertyName(\ReflectionProperty $reflectionProperty, string $default): string { /** @var SwgProperty $swgProperty */ if (!$swgProperty = $this->annotationsReader->getPropertyAnnotation($reflectionProperty, SwgProperty::class)) { return $default; } return $swgProperty->property ?? $default; } public function updateProperty(\ReflectionProperty $reflectionProperty, Schema $property) { /** @var SwgProperty $swgProperty */ if (!$swgProperty = $this->annotationsReader->getPropertyAnnotation($reflectionProperty, SwgProperty::class)) { return; } if (!$swgProperty->validate()) { return; } $property->merge(json_decode(json_encode($swgProperty))); } }