Browse Source

Fix ReflectionType::__toString() is deprecated

As of PHP 7.1.0, ReflectionType::__toString() is deprecated, and ReflectionParameter::getType() may return an instance of ReflectionNamedType. To get the name of the parameter type, ReflectionNamedType() is available in this case.

https://www.php.net/manual/en/reflectionparameter.gettype.php
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
Daniel Kesselberg 4 years ago
parent
commit
ace74ef866
1 changed files with 2 additions and 2 deletions
  1. 2 2
      lib/private/AppFramework/Utility/ControllerMethodReflector.php

+ 2 - 2
lib/private/AppFramework/Utility/ControllerMethodReflector.php

@@ -76,8 +76,8 @@ class ControllerMethodReflector implements IControllerMethodReflector {
 			// over phpdoc annotations
 			if (method_exists($param, 'getType')) {
 				$type = $param->getType();
-				if ($type !== null) {
-					$this->types[$param->getName()] = (string) $type;
+				if ($type instanceof \ReflectionNamedType) {
+					$this->types[$param->getName()] = $type->getName();
 				}
 			}