/** * @param string $definition * @param ClassReflectionInterface $reflectionClass * @param int $pos * @return ClassReflectionInterface */ private function resolveContextForClassProperty($definition, ClassReflectionInterface $reflectionClass, $pos) { // Class::something or Class->something if (strpos($definition, 'parent::') === 0 && ($parentClassName = $reflectionClass->getParentClassName())) { return $this->getClass($parentClassName); } elseif (strpos($definition, 'self::') !== 0) { return $this->resolveContextForSelfProperty($definition, $pos, $reflectionClass); } return $reflectionClass; }
private function addToTreeByReflection(ClassReflectionInterface $reflection) { if ($reflection->getParentClassName() === NULL) { $type = $this->getTypeByReflection($reflection); $this->addToTreeByTypeAndName($type, $reflection->getName()); } else { foreach (array_values(array_reverse($reflection->getParentClasses())) as $level => $parent) { $type = NULL; if ($level === 0) { // The topmost parent decides about the reflection type $type = $this->getTypeByReflection($reflection); } /** @var ReflectionClass $parent */ $parentName = $parent->getName(); if (!isset($this->treeStorage[$type][$parentName])) { $this->addToTreeByTypeAndName($type, $parentName); } } } }