Handle typehint value 'self'

This commit is contained in:
Martin Rademacher
2020-07-07 11:00:15 +12:00
committed by DerManoMann
parent 65a85616f4
commit 321abc52ae
+8 -1
View File
@@ -36,6 +36,7 @@ use phpDocumentor\Reflection\DocBlock\Tags\Version;
use phpDocumentor\Reflection\FqsenResolver;
use phpDocumentor\Reflection\Types\Context as TypeContext;
use ReflectionMethod;
use ReflectionNamedType;
use ReflectionParameter;
use Webmozart\Assert\Assert;
use function array_merge;
@@ -256,8 +257,14 @@ final class StandardTagFactory implements TagFactory
foreach ($parameters as $parameter) {
$type = $parameter->getType();
$typeHint = null;
if ($type instanceof \ReflectionNamedType) {
if ($type instanceof ReflectionNamedType) {
$typeHint = $type->getName();
if ($typeHint === 'self') {
$declaringClass = $parameter->getDeclaringClass();
if ($declaringClass !== null) {
$typeHint = $declaringClass->getName();
}
}
}
if (isset($locator[$typeHint])) {