Skip to content

Commit

Permalink
ReflectionParamter::getClass is deprecated
Browse files Browse the repository at this point in the history
In php8 this starts throwing warnings. And since we use it quite often
we flood the log. This moves it to getType which does the same. Only non
deprecated now.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
  • Loading branch information
rullzer committed Nov 10, 2020
1 parent 03b436c commit ec9afad
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/private/AppFramework/Utility/SimpleContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ private function buildClass(ReflectionClass $class) {
}

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
if ($parameterClass === null) {
$resolveName = $parameter->getName();
} else {
$resolveName = $parameterClass->name;
if ($parameterType !== null && !$parameterType->isBuiltin()) {
$resolveName = $parameterType->getName();
}

try {
Expand All @@ -91,7 +91,7 @@ private function buildClass(ReflectionClass $class) {
return $parameter->getDefaultValue();
}

if ($parameterClass !== null) {
if ($parameter !== null && !$parameterType->isBuiltin()) {
$resolveName = $parameter->getName();
return $this->query($resolveName);
}
Expand Down

0 comments on commit ec9afad

Please sign in to comment.