Skip to content

Commit 321abc5

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

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/DocBlock/StandardTagFactory.php

Lines changed: 8 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,14 @@ 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') {
263+
$declaringClass = $parameter->getDeclaringClass();
264+
if ($declaringClass !== null) {
265+
$typeHint = $declaringClass->getName();
266+
}
267+
}
261268
}
262269

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

0 commit comments

Comments
 (0)