/** * Initialize the annotation. */ public function initAnnotation(array $properties) { $this->map($properties, array('type')); parent::initAnnotation($properties); if (!isset($this->type)) { throw new AnnotationException('ReturnAnnotation requires a type property'); } $this->type = $this->file->resolveType($this->type); }
protected function testAnnotationFileTypeResolution() { $annotationFile = new AnnotationFile('', array('#namespace' => 'LevelA\\NS', '#uses' => array('LevelBClass' => 'LevelB\\Class'))); $this->check($annotationFile->resolveType('SubNS1\\SubClass') == 'LevelA\\NS\\SubNS1\\SubClass', 'Class in sub-namespace is resolved correctly'); $this->check($annotationFile->resolveType('\\SubNS1\\SubClass') == '\\SubNS1\\SubClass', 'Fully qualified class name is not changed during resolution'); $this->check($annotationFile->resolveType('LevelBClass') == 'LevelB\\Class', 'The "uses ..." clause (exact match) is being used during resolution'); $this->check($annotationFile->resolveType('SomeClass[]') == 'LevelA\\NS\\SomeClass[]', 'The [] at then end of data type are preserved during resolution'); $this->check($annotationFile->resolveType('integer') == 'integer', 'Simple data type is kept as-is during resolution'); }