/**
  * @param array $stmts
  * @param $sourcePath
  * @return string
  */
 public function parse($stmts, $sourcePath)
 {
     $namespace = (string) $stmts[0]->name;
     $classStmts = array_filter($stmts[0]->stmts, function (Stmt $stmt) {
         return $this->classParser->match($stmt);
     });
     if ($classStmts) {
         // class
         $classStmt = array_pop($classStmts);
         $class = $this->classParser->parse($classStmt, $namespace, $sourcePath);
         // use
         $useStmts = array_filter($stmts[0]->stmts, function ($element) {
             return $element instanceof Use_;
         });
         array_map(function (Stmt $useStmt) use($class) {
             array_map(function (Stmt $oneUseStmt) use($class) {
                 $this->referenceFactory->create((string) $oneUseStmt->name, $class);
             }, $useStmt->uses);
         }, $useStmts);
     }
     return $namespace;
 }
 /**
  * @param Stmt $propertyStmt
  * @param Element\Property $property
  * @param Element\ClassModel $class
  * @return Element\Annotation\AnnotationCollection
  */
 public function parse(Stmt $propertyStmt, Element\Property $property, Element\ClassModel $class)
 {
     // annotation
     $attrs = $propertyStmt->getAttributes();
     $this->commentsParser->parse($attrs, $property);
     $vars = $property->annotations->withName('var');
     if ($vars->count()) {
         /** @var Element\Annotation $var */
         $var = $vars->first();
         if (!is_array($var->parameters)) {
             // classのuseにあるものだけにする(FQCN形式等は要検討)
             //  型が単純なクラス名ではなくて Element\Annotation のような形式になっている場合は、Element 部分が use にあればOK
             if ($searchAlias = strstr($var->parameters, '\\', true) === false) {
                 $searchAlias = $var->parameters;
             }
             $classReferences = $class->references->withAlias($searchAlias);
             if ($classReferences->count()) {
                 $ref = $this->referenceFactory->create($var->parameters, null);
                 $property->reference = $ref;
             }
         }
     }
     return $property->annotations;
 }