mirror of
https://github.com/barryvdh/ReflectionDocBlock.git
synced 2026-08-18 01:57:13 +00:00
Merge pull request #240 from DerManoMann/reflectionparameter-getclass-deprecated-php8
Use ReflectionParameter::getType() instead of getClass()
This commit is contained in:
@@ -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;
|
||||||
@@ -254,10 +255,16 @@ final class StandardTagFactory implements TagFactory
|
|||||||
{
|
{
|
||||||
$arguments = [];
|
$arguments = [];
|
||||||
foreach ($parameters as $parameter) {
|
foreach ($parameters as $parameter) {
|
||||||
$class = $parameter->getClass();
|
$type = $parameter->getType();
|
||||||
$typeHint = null;
|
$typeHint = null;
|
||||||
if ($class !== null) {
|
if ($type instanceof ReflectionNamedType) {
|
||||||
$typeHint = $class->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