Skip to content

Commit 0690553

Browse files
Martin RademacherDerManoMann
authored andcommitted
Handle typehint value 'self'
1 parent 65a8561 commit 0690553

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/DocBlock/StandardTagFactory.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
use phpDocumentor\Reflection\FqsenResolver;
3737
use phpDocumentor\Reflection\Types\Context as TypeContext;
3838
use ReflectionMethod;
39+
use ReflectionNamedType;
3940
use ReflectionParameter;
4041
use Webmozart\Assert\Assert;
4142
use function array_merge;
@@ -256,8 +257,11 @@ private function getArgumentsForParametersFromWiring(array $parameters, array $l
256257
foreach ($parameters as $parameter) {
257258
$type = $parameter->getType();
258259
$typeHint = null;
259-
if ($type instanceof \ReflectionNamedType) {
260+
if ($type instanceof ReflectionNamedType) {
260261
$typeHint = $type->getName();
262+
if ($typeHint === 'self' && ($declaringClass = $parameter->getDeclaringClass())) {
263+
$typeHint = $declaringClass->getName();
264+
}
261265
}
262266

263267
if (isset($locator[$typeHint])) {

0 commit comments

Comments
 (0)