Add default (empty) arguments to renderers.
This commit is contained in:
parent
35418919ed
commit
596af225e5
3 changed files with 3 additions and 3 deletions
|
@ -16,7 +16,7 @@ class PhpRenderer implements Renderer
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function render(object $arguments): string
|
public function render(object $arguments = new \stdClass()): string
|
||||||
{
|
{
|
||||||
// Extract render arguments.
|
// Extract render arguments.
|
||||||
extract((array) $arguments);
|
extract((array) $arguments);
|
||||||
|
|
|
@ -12,5 +12,5 @@ interface Renderer
|
||||||
* @param object $arguments View arguments.
|
* @param object $arguments View arguments.
|
||||||
* @return string Produced view.
|
* @return string Produced view.
|
||||||
*/
|
*/
|
||||||
function render(object $arguments): string;
|
function render(object $arguments = new \stdClass()): string;
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,7 +98,7 @@ abstract class Controller
|
||||||
* @param string|null $contentType The content type of the response.
|
* @param string|null $contentType The content type of the response.
|
||||||
* @return ResponseInterface Built 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));
|
return $this->newResponse($statusCode, $contentType ?? null, $renderer->render($arguments));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue