private function readProperty(ReflectionProperty $property, ObjectDefinition $definition, $classname = null)
{
// Look for @Inject annotation
/** @var $annotation Inject */
$annotation = $this->getAnnotationReader()->getPropertyAnnotation($property, 'DI\\Annotation\\Inject');
if ($annotation === null) {
return null;
}
// @Inject("name") or look for @var content
$entryName = $annotation->getName() ?: $this->getPhpDocReader()->getPropertyClass($property);
if ($entryName === null) {
throw new AnnotationException(sprintf('@Inject found on property %s::%s but unable to guess what to inject, use a @var annotation', $property->getDeclaringClass()->getName(), $property->getName()));
}
$definition->addPropertyInjection(new PropertyInjection($property->getName(), new EntryReference($entryName), $classname));
}