diff --git a/src/Handlers/AbstractHandler.php b/src/Handlers/AbstractHandler.php index 6cbdf30..31508a2 100644 --- a/src/Handlers/AbstractHandler.php +++ b/src/Handlers/AbstractHandler.php @@ -4,14 +4,14 @@ use Exception; use Illuminate\Auth\Access\AuthorizationException; -use Illuminate\Support\Str; -use InvalidArgumentException; use Illuminate\Auth\AuthenticationException; -use Illuminate\Validation\ValidationException; -use SMartins\Exceptions\Response\ErrorHandledInterface; use Illuminate\Database\Eloquent\ModelNotFoundException; +use Illuminate\Support\Str; +use Illuminate\Validation\ValidationException; +use InvalidArgumentException; use SMartins\Exceptions\JsonApi\Response as JsonApiResponse; use SMartins\Exceptions\Response\ErrorHandledCollectionInterface; +use SMartins\Exceptions\Response\ErrorHandledInterface; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; diff --git a/src/Handlers/ModelNotFoundHandler.php b/src/Handlers/ModelNotFoundHandler.php index f385ea4..4a24563 100644 --- a/src/Handlers/ModelNotFoundHandler.php +++ b/src/Handlers/ModelNotFoundHandler.php @@ -2,10 +2,10 @@ namespace SMartins\Exceptions\Handlers; +use Illuminate\Database\Eloquent\ModelNotFoundException; use Illuminate\Support\Str; use SMartins\Exceptions\JsonApi\Error; use SMartins\Exceptions\JsonApi\Source; -use Illuminate\Database\Eloquent\ModelNotFoundException; class ModelNotFoundHandler extends AbstractHandler { diff --git a/src/Handlers/OAuthServerHandler.php b/src/Handlers/OAuthServerHandler.php index 7aaba84..9b752f0 100644 --- a/src/Handlers/OAuthServerHandler.php +++ b/src/Handlers/OAuthServerHandler.php @@ -2,9 +2,9 @@ namespace SMartins\Exceptions\Handlers; +use League\OAuth2\Server\Exception\OAuthServerException; use SMartins\Exceptions\JsonApi\Error; use SMartins\Exceptions\JsonApi\Source; -use League\OAuth2\Server\Exception\OAuthServerException; class OAuthServerHandler extends AbstractHandler { diff --git a/src/Handlers/ValidationHandler.php b/src/Handlers/ValidationHandler.php index f71f9db..b22b3b2 100644 --- a/src/Handlers/ValidationHandler.php +++ b/src/Handlers/ValidationHandler.php @@ -3,8 +3,8 @@ namespace SMartins\Exceptions\Handlers; use SMartins\Exceptions\JsonApi\Error; -use SMartins\Exceptions\JsonApi\Source; use SMartins\Exceptions\JsonApi\ErrorCollection; +use SMartins\Exceptions\JsonApi\Source; class ValidationHandler extends AbstractHandler { diff --git a/src/JsonApi/Error.php b/src/JsonApi/Error.php index df6b9e8..7af2385 100644 --- a/src/JsonApi/Error.php +++ b/src/JsonApi/Error.php @@ -3,9 +3,9 @@ namespace SMartins\Exceptions\JsonApi; use Illuminate\Contracts\Support\Arrayable; -use SMartins\Exceptions\Traits\NotNullArrayable; -use SMartins\Exceptions\Response\ErrorHandledInterface; use SMartins\Exceptions\Response\ErrorHandledCollectionInterface; +use SMartins\Exceptions\Response\ErrorHandledInterface; +use SMartins\Exceptions\Traits\NotNullArrayable; class Error implements Arrayable, ErrorHandledInterface { diff --git a/src/JsonApi/ErrorCollection.php b/src/JsonApi/ErrorCollection.php index c7de286..8efb248 100644 --- a/src/JsonApi/ErrorCollection.php +++ b/src/JsonApi/ErrorCollection.php @@ -3,8 +3,8 @@ namespace SMartins\Exceptions\JsonApi; use Illuminate\Support\Collection; -use SMartins\Exceptions\Response\InvalidContentException; use SMartins\Exceptions\Response\ErrorHandledCollectionInterface; +use SMartins\Exceptions\Response\InvalidContentException; class ErrorCollection extends Collection implements ErrorHandledCollectionInterface { diff --git a/src/JsonHandler.php b/src/JsonHandler.php index 69f6c39..af19e7c 100644 --- a/src/JsonHandler.php +++ b/src/JsonHandler.php @@ -2,8 +2,8 @@ namespace SMartins\Exceptions; -use Exception; use SMartins\Exceptions\Handlers\Handler; +use Throwable; trait JsonHandler { @@ -11,11 +11,11 @@ trait JsonHandler * Handle the json response. Check if exception is treated. If true call * the specific handler. If false set the default response to be returned. * - * @param \Exception $exception + * @param \Throwable $exception * * @return \Illuminate\Http\JsonResponse */ - public function jsonResponse(Exception $exception) + public function jsonResponse(Throwable $exception) { $handler = new Handler($exception);