Changed behavior of router to always exspect returned output to be string.

This commit is contained in:
sessingo
2023-04-07 15:30:24 +02:00
parent ebf9224407
commit d6642a7f7b
2 changed files with 7 additions and 7 deletions
@@ -27,11 +27,11 @@ class ClassLoader implements IClassLoader
* @param object $class * @param object $class
* @param string $method * @param string $method
* @param array $parameters * @param array $parameters
* @return mixed * @return string
*/ */
public function loadClassMethod($class, string $method, array $parameters) public function loadClassMethod($class, string $method, array $parameters): string
{ {
return call_user_func_array([$class, $method], array_values($parameters)); return (string)call_user_func_array([$class, $method], array_values($parameters));
} }
/** /**
@@ -39,11 +39,11 @@ class ClassLoader implements IClassLoader
* *
* @param Callable $closure * @param Callable $closure
* @param array $parameters * @param array $parameters
* @return mixed * @return string
*/ */
public function loadClosure(Callable $closure, array $parameters) public function loadClosure(callable $closure, array $parameters): string
{ {
return call_user_func_array($closure, array_values($parameters)); return (string)call_user_func_array($closure, array_values($parameters));
} }
} }
+1 -1
View File
@@ -427,7 +427,7 @@ class Router
$routeOutput = $route->renderRoute($this->request, $this); $routeOutput = $route->renderRoute($this->request, $this);
if ($this->renderMultipleRoutes === true) { if ($this->renderMultipleRoutes === true) {
if ($routeOutput !== null) { if ($routeOutput !== '') {
return $routeOutput; return $routeOutput;
} }