/** * {@inheritdoc} * @throws PropertyDefinitionAlreadyExistsException * @throws PropertyDefinitionNotFoundException */ public function analyze(DefinitionAnalyzer $analyzer, ClassDefinition $classDefinition, \ReflectionProperty $reflectionProperty) { $propertyName = $reflectionProperty->getName(); // Resolve annotations $annotations = $this->reader->getPropertyAnnotations($reflectionProperty); if (count($annotations)) { // Define property if not exists if (!$classDefinition->hasProperty($propertyName)) { $classDefinition->defineProperty($propertyName); } // Exec annotations foreach ($annotations as $annotation) { if ($annotation instanceof ResolvePropertyInterface) { $annotation->resolveProperty($analyzer, $classDefinition, $reflectionProperty); } } } }
/** * Resolve property * * @param ClassDefinition $classDefinition * @param array $propertyArray * @param string $propertyName * @throws \InvalidArgumentException * @throws ReferenceNotImplementsException * @throws PropertyDefinitionAlreadyExistsException */ protected function resolveProperty(ClassDefinition $classDefinition, array $propertyArray, string $propertyName) { $propertyDefinition = $classDefinition->defineProperty($propertyName); $propertyDefinition->defineDependency($this->resolveDependency($propertyArray)); }