mirror of
https://github.com/barryvdh/ReflectionDocBlock.git
synced 2026-08-18 10:07:12 +00:00
Handle typehint value 'self'
This commit is contained in:
committed by
DerManoMann
parent
65a85616f4
commit
321abc52ae
@@ -36,6 +36,7 @@ use phpDocumentor\Reflection\DocBlock\Tags\Version;
|
|||||||
use phpDocumentor\Reflection\FqsenResolver;
|
use phpDocumentor\Reflection\FqsenResolver;
|
||||||
use phpDocumentor\Reflection\Types\Context as TypeContext;
|
use phpDocumentor\Reflection\Types\Context as TypeContext;
|
||||||
use ReflectionMethod;
|
use ReflectionMethod;
|
||||||
|
use ReflectionNamedType;
|
||||||
use ReflectionParameter;
|
use ReflectionParameter;
|
||||||
use Webmozart\Assert\Assert;
|
use Webmozart\Assert\Assert;
|
||||||
use function array_merge;
|
use function array_merge;
|
||||||
@@ -256,8 +257,14 @@ final class StandardTagFactory implements TagFactory
|
|||||||
foreach ($parameters as $parameter) {
|
foreach ($parameters as $parameter) {
|
||||||
$type = $parameter->getType();
|
$type = $parameter->getType();
|
||||||
$typeHint = null;
|
$typeHint = null;
|
||||||
if ($type instanceof \ReflectionNamedType) {
|
if ($type instanceof ReflectionNamedType) {
|
||||||
$typeHint = $type->getName();
|
$typeHint = $type->getName();
|
||||||
|
if ($typeHint === 'self') {
|
||||||
|
$declaringClass = $parameter->getDeclaringClass();
|
||||||
|
if ($declaringClass !== null) {
|
||||||
|
$typeHint = $declaringClass->getName();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($locator[$typeHint])) {
|
if (isset($locator[$typeHint])) {
|
||||||
|
|||||||
Reference in New Issue
Block a user