mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-07-11 07:52:19 +00:00
Changed behavior of router to always exspect returned output to be string.
This commit is contained in:
@@ -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));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user