/** * {@inheritdoc} * @throws PropertyDefinitionNotFoundException */ public function resolveProperty(DefinitionAnalyzer $analyzer, ClassDefinition $classDefinition, \ReflectionProperty $reflectionProperty) { $propertyName = $reflectionProperty->getName(); if ($classDefinition->hasProperty($propertyName)) { $classDefinition->getProperty($propertyName)->defineDependency(new ServiceReference($this->value['value'])); } }
/** * {@inheritdoc} * @throws PropertyDefinitionNotFoundException */ public function analyze(DefinitionAnalyzer $analyzer, ClassDefinition $classDefinition, \ReflectionProperty $reflectionProperty) { $propertyName = $reflectionProperty->getName(); // Set property metadata if ($classDefinition->hasProperty($propertyName)) { $classDefinition->getProperty($propertyName)->setIsPublic($reflectionProperty->isPublic())->setModifiers($reflectionProperty->getModifiers()); } }
/** * {@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); } } } }