Merge pull request #24037 from nextcloud/enh/reflectionparamter_getclass_deprecatred

ReflectionParamter::getClass is deprecated
This commit is contained in:
Roeland Jago Douma 2020-11-11 21:53:55 +01:00 committed by GitHub
commit c2588b0b10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 6 deletions

View File

@ -73,13 +73,13 @@ class SimpleContainer implements ArrayAccess, ContainerInterface, IContainer {
} }
return $class->newInstanceArgs(array_map(function (ReflectionParameter $parameter) { return $class->newInstanceArgs(array_map(function (ReflectionParameter $parameter) {
$parameterClass = $parameter->getClass(); $parameterType = $parameter->getType();
$resolveName = $parameter->getName();
// try to find out if it is a class or a simple parameter // try to find out if it is a class or a simple parameter
if ($parameterClass === null) { if ($parameterType !== null && !$parameterType->isBuiltin()) {
$resolveName = $parameter->getName(); $resolveName = $parameterType->getName();
} else {
$resolveName = $parameterClass->name;
} }
try { try {
@ -91,7 +91,7 @@ class SimpleContainer implements ArrayAccess, ContainerInterface, IContainer {
return $parameter->getDefaultValue(); return $parameter->getDefaultValue();
} }
if ($parameterClass !== null) { if ($parameterType !== null && !$parameterType->isBuiltin()) {
$resolveName = $parameter->getName(); $resolveName = $parameter->getName();
return $this->query($resolveName); return $this->query($resolveName);
} }