diff --git a/src/Renderer/PhpRenderer.php b/src/Renderer/PhpRenderer.php index 7713049..abccaba 100644 --- a/src/Renderer/PhpRenderer.php +++ b/src/Renderer/PhpRenderer.php @@ -16,7 +16,7 @@ class PhpRenderer implements Renderer /** * @inheritDoc */ - public function render(object $arguments): string + public function render(object $arguments = new \stdClass()): string { // Extract render arguments. extract((array) $arguments); diff --git a/src/Renderer/Renderer.php b/src/Renderer/Renderer.php index 5c38daf..cafa5b3 100644 --- a/src/Renderer/Renderer.php +++ b/src/Renderer/Renderer.php @@ -12,5 +12,5 @@ interface Renderer * @param object $arguments View arguments. * @return string Produced view. */ - function render(object $arguments): string; + function render(object $arguments = new \stdClass()): string; } diff --git a/src/Router/Controller.php b/src/Router/Controller.php index 9b16945..a99c4b6 100644 --- a/src/Router/Controller.php +++ b/src/Router/Controller.php @@ -98,7 +98,7 @@ abstract class Controller * @param string|null $contentType The content type of the response. * @return ResponseInterface Built response. */ - public function render(Renderer $renderer, object $arguments, StatusCode $statusCode = StatusCode::OK, ?string $contentType = null): ResponseInterface + public function render(Renderer $renderer, object $arguments = new \stdClass(), StatusCode $statusCode = StatusCode::OK, ?string $contentType = null): ResponseInterface { return $this->newResponse($statusCode, $contentType ?? null, $renderer->render($arguments)); }