Skip to content
This repository was archived by the owner on Feb 21, 2019. It is now read-only.

Commit 6c39adc

Browse files
OndraMdg
authored andcommitted
AnnotationsParser::parsePhp() Return also classes without annotations
1 parent 087c26e commit 6c39adc

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

src/Reflection/AnnotationsParser.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ public static function parsePhp($code)
299299
if ($name = self::fetch($tokens, T_STRING)) {
300300
$class = $namespace . $name;
301301
$classLevel = $level + 1;
302+
$res[$class] = array();
302303
if ($docComment) {
303304
$res[$class]['class'] = $docComment;
304305
}

tests/Reflection/AnnotationsParser.parsePhp.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,13 @@ Assert::same(array(
2727
'g' => '/** @return g */',
2828
),
2929
'Test\AnnotatedClass2' => array('class' => '/** @author jack */'),
30+
'Test\AnnotatedClass3' => array(),
3031
), AnnotationsParser::parsePhp(file_get_contents(__DIR__ . '/files/annotations.php')));
3132

3233

3334
Assert::same(array(
3435
'Test\TestClass1' => array('use' => array('C' => 'A\B')),
3536
'Test\TestClass2' => array('use' => array('C' => 'A\B', 'D' => 'D', 'E' => 'E', 'H' => 'F\G')),
37+
'Test2\TestClass3' => array(),
3638
'Test2\TestClass4' => array('use' => array('C' => 'A\B\C')),
3739
), AnnotationsParser::parsePhp(file_get_contents(__DIR__ . '/files/uses.php')));

0 commit comments

Comments
 (0)