/** * @test */ public function parseClassComment() { \Phake::when($this->annotationsParser)->parse(\Phake::anyParameters())->thenReturn([]); $stmts = (include __DIR__ . '/../fixtures/1/Model/Product.php.class.cache'); $class = $this->parser->parse($stmts, '', ''); $this->assertThat($class->comment, $this->equalTo('商品エンティティ')); }
/** * @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; }