Skip to content

Commit db73114

Browse files
committed
Better inheritdoc support
1 parent a0b8555 commit db73114

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

src/PHPFUI/InstaDoc/Section/CodeCommon.php

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ protected function getDocBlock($method) : ?\phpDocumentor\Reflection\DocBlock
223223
*/
224224

225225
$comments = $method->getDocComment();
226-
$comments = \str_replace('{@inheritdoc}', '@inheritdoc', $comments);
226+
$comments = \str_ireplace('{@inheritdoc}', '@inheritdoc', $comments);
227227

228228
if (! $comments)
229229
{
@@ -261,14 +261,21 @@ protected function getInheritedSummary(\phpDocumentor\Reflection\DocBlock $docBl
261261
$tags = $docBlock->getTags();
262262
foreach ($tags as $index => $tag)
263263
{
264-
if (0 == \strcasecmp($tag->getName(), 'inheritDoc'))
264+
if (0 >= \stripos($tag->getName(), 'inheritdoc'))
265265
{
266266
$reflectionClass = $reflectionMethod->getDeclaringClass();
267267
$parent = $reflectionClass->getParentClass();
268268

269269
while ($parent)
270270
{
271-
$method = $parent->getMethod($reflectionMethod->name);
271+
try
272+
{
273+
$method = $parent->getMethod($reflectionMethod->name);
274+
}
275+
catch (\Throwable $e)
276+
{
277+
$method = null;
278+
}
272279
if ($method)
273280
{
274281
$docBlock = $this->getDocBlock($method);
@@ -292,14 +299,21 @@ protected function getInheritedDocBlock(array $tags, \ReflectionMethod $reflecti
292299
{
293300
foreach ($tags as $index => $tag)
294301
{
295-
if (0 == \strcasecmp($tag->getName(), 'inheritDoc'))
302+
if (0 >= \stripos($tag->getName(), 'inheritdoc'))
296303
{
297304
$reflectionClass = $reflectionMethod->getDeclaringClass();
298305
$parent = $reflectionClass->getParentClass();
299306

300307
while ($parent)
301308
{
302-
$method = $parent->getMethod($reflectionMethod->name);
309+
try
310+
{
311+
$method = $parent->getMethod($reflectionMethod->name);
312+
}
313+
catch (\Throwable $e)
314+
{
315+
$method = null;
316+
}
303317
if ($method)
304318
{
305319
$docBlock = $this->getDocBlock($method);

0 commit comments

Comments
 (0)