Skip to content

Commit

Permalink
Widen view render param type
Browse files Browse the repository at this point in the history
  • Loading branch information
iansltx committed Apr 23, 2024
1 parent d7146be commit 41f6936
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 14 deletions.
7 changes: 1 addition & 6 deletions src/View/ApiView.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,7 @@ public function setNoRender(bool $noRender): void
$this->noRender = $noRender;
}

/**
* @param array|string $content
*
* @return bool
*/
public function render(array|string $content): bool
public function render(array|string|null $content): bool
{
ob_start();
$body = '';
Expand Down
7 changes: 1 addition & 6 deletions src/View/HtmlView.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,7 @@
*/
class HtmlView extends ApiView
{
/**
* @param array|string $content
*
* @return bool
*/
public function render(array|string $content): bool
public function render(array|string|null $content): bool
{
$this->setHeader('Content-Type', 'text/html; charset=utf8');

Expand Down
2 changes: 1 addition & 1 deletion src/View/JsonPView.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public function __construct(protected string $callback)
parent::__construct();
}

public function render($content): bool
public function render(array|string|null $content): bool
{
$this->setHeader('Content-Type', 'text/javascript; charset=utf8');

Expand Down
2 changes: 1 addition & 1 deletion src/View/JsonView.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class JsonView extends ApiView
{
protected array $string_fields;

public function render(array|string $content): bool
public function render(array|string|null $content): bool
{
$this->setHeader('Content-Type', 'application/json; charset=utf8');
$this->setHeader('Access-Control-Allow-Origin', '*');
Expand Down

0 comments on commit 41f6936

Please sign in to comment.