Skip to content

Commit

Permalink
ExceptionInterface cannot be caught
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
gsteel committed Jan 10, 2023
1 parent 11da679 commit 00d3f86
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Exception/ExceptionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

namespace Mezzio\Helper\Exception;

interface ExceptionInterface
use Throwable;

interface ExceptionInterface extends Throwable
{
}
1 change: 1 addition & 0 deletions src/Exception/MalformedRequestBodyException.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Exception;
use InvalidArgumentException;

/** @final */
class MalformedRequestBodyException extends InvalidArgumentException implements ExceptionInterface
{
/** @param string $message */
Expand Down
1 change: 1 addition & 0 deletions src/Exception/MissingHelperException.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use DomainException;
use Psr\Container\ContainerExceptionInterface;

/** @final */
class MissingHelperException extends DomainException implements
ContainerExceptionInterface,
ExceptionInterface
Expand Down
1 change: 1 addition & 0 deletions src/Exception/MissingRouterException.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use DomainException;
use Psr\Container\ContainerExceptionInterface;

/** @final */
class MissingRouterException extends DomainException implements
ContainerExceptionInterface,
ExceptionInterface
Expand Down
1 change: 1 addition & 0 deletions src/Exception/RuntimeException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Mezzio\Helper\Exception;

/** @final */
class RuntimeException extends \RuntimeException implements ExceptionInterface
{
}

0 comments on commit 00d3f86

Please sign in to comment.