Skip to content

Commit

Permalink
Merge pull request #240 from DerManoMann/reflectionparameter-getclass…
Browse files Browse the repository at this point in the history
…-deprecated-php8

Use ReflectionParameter::getType() instead of getClass()
  • Loading branch information
jaapio committed Jul 7, 2020
2 parents 41f77e8 + 321abc5 commit 7c87da1
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/DocBlock/StandardTagFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
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;
Expand Down Expand Up @@ -254,10 +255,16 @@ private function getArgumentsForParametersFromWiring(array $parameters, array $l
{
$arguments = [];
foreach ($parameters as $parameter) {
$class = $parameter->getClass();
$type = $parameter->getType();
$typeHint = null;
if ($class !== null) {
$typeHint = $class->getName();
if ($type instanceof ReflectionNamedType) {
$typeHint = $type->getName();
if ($typeHint === 'self') {
$declaringClass = $parameter->getDeclaringClass();
if ($declaringClass !== null) {
$typeHint = $declaringClass->getName();
}
}
}

if (isset($locator[$typeHint])) {
Expand Down

0 comments on commit 7c87da1

Please sign in to comment.