ReflectionParamter::getClass is deprecated

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>
This commit is contained in:
Roeland Jago Douma 2020-11-10 21:05:32 +01:00
parent fec679dd8d
commit 51a02c8009
No known key found for this signature in database
GPG Key ID: F941078878347C0C
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) {
$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 {
@ -91,7 +91,7 @@ class SimpleContainer implements ArrayAccess, ContainerInterface, IContainer {
return $parameter->getDefaultValue();
}
if ($parameterClass !== null) {
if ($parameterType !== null && !$parameterType->isBuiltin()) {
$resolveName = $parameter->getName();
return $this->query($resolveName);
}