Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch \Throwable instead of \Exception #139

Merged
merged 1 commit into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/DeferredText.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace ipl\Html;

use Exception;
use Throwable;

/**
* Text node where content creation is deferred until rendering
Expand Down Expand Up @@ -96,7 +96,7 @@ public function __toString()
{
try {
return $this->render();
} catch (Exception $e) {
} catch (Throwable $e) {
return Error::render($e);
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/Form.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php

Check failure on line 1 in src/Form.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.2 on ubuntu-latest

Ignored error pattern #^Parameter \#1 \.\.\.\$arrays of function array_merge_recursive expects array, array\|object\|null given\.$# in path /home/runner/work/ipl-html/ipl-html/src/Form.php was not matched in reported errors.

Check failure on line 1 in src/Form.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.3 on ubuntu-latest

Ignored error pattern #^Parameter \#1 \.\.\.\$arrays of function array_merge_recursive expects array, array\|object\|null given\.$# in path /home/runner/work/ipl-html/ipl-html/src/Form.php was not matched in reported errors.

Check failure on line 1 in src/Form.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.4 on ubuntu-latest

Ignored error pattern #^Parameter \#1 \.\.\.\$arrays of function array_merge_recursive expects array, array\|object\|null given\.$# in path /home/runner/work/ipl-html/ipl-html/src/Form.php was not matched in reported errors.

namespace ipl\Html;

use Exception;
use ipl\Html\Contract\FormElement;
use ipl\Html\Contract\FormSubmitElement;
use ipl\Html\FormElement\FormElements;
use ipl\Stdlib\Messages;
use Psr\Http\Message\ServerRequestInterface;
use Throwable;

class Form extends BaseHtmlElement
{
Expand Down Expand Up @@ -225,7 +225,7 @@
$params = [];
}

$params = array_merge_recursive($params, $request->getUploadedFiles());

Check failure on line 228 in src/Form.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.2 on ubuntu-latest

Parameter #1 $arr1 of function array_merge_recursive expects array, array|object|null given.

Check failure on line 228 in src/Form.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.3 on ubuntu-latest

Parameter #1 $arr1 of function array_merge_recursive expects array, array|object|null given.

Check failure on line 228 in src/Form.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.4 on ubuntu-latest

Parameter #1 $arr1 of function array_merge_recursive expects array, array|object|null given.
$this->populate($params);

// Assemble after populate in order to conditionally provide form elements
Expand All @@ -237,7 +237,7 @@
$this->emit(Form::ON_SENT, [$this]);
$this->onSuccess();
$this->emitOnce(Form::ON_SUCCESS, [$this]);
} catch (Exception $e) {
} catch (Throwable $e) {
$this->addMessage($e);
$this->onError();
$this->emit(Form::ON_ERROR, [$e, $this]);
Expand Down Expand Up @@ -363,7 +363,7 @@
{
$errors = Html::tag('ul', ['class' => 'errors']);
foreach ($this->getMessages() as $message) {
if ($message instanceof Exception) {
if ($message instanceof Throwable) {
$message = $message->getMessage();
}

Expand Down
4 changes: 2 additions & 2 deletions src/FormattedString.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

Check failure on line 1 in src/FormattedString.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.2 on ubuntu-latest

Ignored error pattern #^Parameter \#2 \$values of function vsprintf expects array\<bool\|float\|int\|string\|null\>, array\<ipl\\Html\\ValidHtml\> given\.$# in path /home/runner/work/ipl-html/ipl-html/src/FormattedString.php was not matched in reported errors.

Check failure on line 1 in src/FormattedString.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.3 on ubuntu-latest

Ignored error pattern #^Parameter \#2 \$values of function vsprintf expects array\<bool\|float\|int\|string\|null\>, array\<ipl\\Html\\ValidHtml\> given\.$# in path /home/runner/work/ipl-html/ipl-html/src/FormattedString.php was not matched in reported errors.

Check failure on line 1 in src/FormattedString.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.4 on ubuntu-latest

Ignored error pattern #^Parameter \#2 \$values of function vsprintf expects array\<bool\|float\|int\|string\|null\>, array\<ipl\\Html\\ValidHtml\> given\.$# in path /home/runner/work/ipl-html/ipl-html/src/FormattedString.php was not matched in reported errors.

namespace ipl\Html;

use Exception;
use InvalidArgumentException;
use Throwable;

use function ipl\Stdlib\get_php_type;

Expand Down Expand Up @@ -86,7 +86,7 @@
{
try {
return $this->render();
} catch (Exception $e) {
} catch (Throwable $e) {
return Error::render($e);
}
}
Expand All @@ -95,7 +95,7 @@
{
return vsprintf(
$this->format->render(),
$this->args

Check failure on line 98 in src/FormattedString.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.2 on ubuntu-latest

Parameter #2 $args of function vsprintf expects array<bool|float|int|string|null>, array<ipl\Html\ValidHtml> given.

Check failure on line 98 in src/FormattedString.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.3 on ubuntu-latest

Parameter #2 $args of function vsprintf expects array<bool|float|int|string|null>, array<ipl\Html\ValidHtml> given.

Check failure on line 98 in src/FormattedString.php

View workflow job for this annotation

GitHub Actions / phpstan / Static analysis with phpstan and php 7.4 on ubuntu-latest

Parameter #2 $args of function vsprintf expects array<bool|float|int|string|null>, array<ipl\Html\ValidHtml> given.
);
}
}
4 changes: 2 additions & 2 deletions src/HtmlDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
namespace ipl\Html;

use Countable;
use Exception;
use InvalidArgumentException;
use ipl\Html\Contract\Wrappable;
use ipl\Stdlib\Events;
use RuntimeException;
use Throwable;

/**
* HTML document
Expand Down Expand Up @@ -418,7 +418,7 @@ public function __toString()
{
try {
return $this->render();
} catch (Exception $e) {
} catch (Throwable $e) {
return Error::render($e);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Text.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace ipl\Html;

use Exception;
use Throwable;

/**
* A text node
Expand Down Expand Up @@ -100,7 +100,7 @@ public function __toString()
{
try {
return $this->render();
} catch (Exception $e) {
} catch (Throwable $e) {
return Error::render($e);
}
}
Expand Down
Loading