From 00d3f86d0a8130863b23575707366c93a1b060fc Mon Sep 17 00:00:00 2001 From: George Steel Date: Tue, 10 Jan 2023 21:17:25 +0000 Subject: [PATCH] ExceptionInterface cannot be caught Extends `ExceptionInterface` from `Throwable` so that consumers can catch the marker interface without static analysis errors. Also marks all existing concrete exceptions as soft `@final` so that the next major can finalise them. Signed-off-by: George Steel --- src/Exception/ExceptionInterface.php | 4 +++- src/Exception/MalformedRequestBodyException.php | 1 + src/Exception/MissingHelperException.php | 1 + src/Exception/MissingRouterException.php | 1 + src/Exception/RuntimeException.php | 1 + 5 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Exception/ExceptionInterface.php b/src/Exception/ExceptionInterface.php index 2bdf460..25bd69e 100644 --- a/src/Exception/ExceptionInterface.php +++ b/src/Exception/ExceptionInterface.php @@ -4,6 +4,8 @@ namespace Mezzio\Helper\Exception; -interface ExceptionInterface +use Throwable; + +interface ExceptionInterface extends Throwable { } diff --git a/src/Exception/MalformedRequestBodyException.php b/src/Exception/MalformedRequestBodyException.php index 61eb75c..1531bd2 100644 --- a/src/Exception/MalformedRequestBodyException.php +++ b/src/Exception/MalformedRequestBodyException.php @@ -7,6 +7,7 @@ use Exception; use InvalidArgumentException; +/** @final */ class MalformedRequestBodyException extends InvalidArgumentException implements ExceptionInterface { /** @param string $message */ diff --git a/src/Exception/MissingHelperException.php b/src/Exception/MissingHelperException.php index 7a75a68..a2dd469 100644 --- a/src/Exception/MissingHelperException.php +++ b/src/Exception/MissingHelperException.php @@ -7,6 +7,7 @@ use DomainException; use Psr\Container\ContainerExceptionInterface; +/** @final */ class MissingHelperException extends DomainException implements ContainerExceptionInterface, ExceptionInterface diff --git a/src/Exception/MissingRouterException.php b/src/Exception/MissingRouterException.php index 57ab597..3a96f81 100644 --- a/src/Exception/MissingRouterException.php +++ b/src/Exception/MissingRouterException.php @@ -7,6 +7,7 @@ use DomainException; use Psr\Container\ContainerExceptionInterface; +/** @final */ class MissingRouterException extends DomainException implements ContainerExceptionInterface, ExceptionInterface diff --git a/src/Exception/RuntimeException.php b/src/Exception/RuntimeException.php index 24b7e31..d2232c1 100644 --- a/src/Exception/RuntimeException.php +++ b/src/Exception/RuntimeException.php @@ -4,6 +4,7 @@ namespace Mezzio\Helper\Exception; +/** @final */ class RuntimeException extends \RuntimeException implements ExceptionInterface { }