Skip to content

Commit dcbe4de

Browse files
committed
WIP
1 parent 86479d4 commit dcbe4de

1 file changed

Lines changed: 26 additions & 9 deletions

File tree

src/Utilities/TypeResolver.php

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -260,16 +260,33 @@ public static function getExtendedClasses($class): array
260260

261261
if (class_exists($classPath)) {
262262
$reflectionClass = new \ReflectionClass($classPath);
263-
preg_match_all('/\@parent\s+([^\r\n]+)/i', $reflectionClass->getDocComment(), $parents);
264-
$roots = array_merge($parents[1], [$classPath]);
265-
if (count($roots) > count($extendedClasses)) {
266-
$extendedClasses = $roots;
267-
}
263+
if ($document = $reflectionClass->getDocComment()) {
264+
$documentBlock = \phpDocumentor\Reflection\DocBlockFactory::createInstance()
265+
->create($reflectionClass->getDocComment());
266+
267+
$roots = array_merge(
268+
array_map(
269+
function (\phpDocumentor\Reflection\DocBlock\Tags\Generic $item) {
270+
var_dump($item->getDescription());
271+
return (string) $item->getDescription();
272+
},
273+
$documentBlock->getTagsByName('parent')
274+
),
275+
[$classPath]
276+
);
277+
if (count($roots) > count($extendedClasses)) {
278+
$extendedClasses = $roots;
279+
}
268280

269-
preg_match_all('/\@interface\s+([^\r\n]+)/i', $reflectionClass->getDocComment(), $interfaceRoots);
270-
$roots = $interfaceRoots[1];
271-
if (count($roots) > count($interfaces)) {
272-
$interfaces = $roots;
281+
$roots = array_map(
282+
function (\phpDocumentor\Reflection\DocBlock\Tags\Generic $item) {
283+
return (string) $item->getDescription();
284+
},
285+
$documentBlock->getTagsByName('interface')
286+
);
287+
if (count($roots) > count($interfaces)) {
288+
$interfaces = $roots;
289+
}
273290
}
274291
}
275292

0 commit comments

Comments
 (0)