Fix Exceptions namespaces

This commit is contained in:
Maarten 2019-12-24 00:39:09 +01:00
parent 69c761c3b1
commit df52bab204
23 changed files with 40 additions and 46 deletions

View file

@ -1,5 +1,5 @@
<?php <?php
namespace Runtime\Exceptions; namespace Runtime\Exceptions\Exceptions;
class ClassNotFoundException extends \BadMethodCallException {} class ClassNotFoundException extends \BadMethodCallException {}

View file

@ -0,0 +1,5 @@
<?php
namespace Runtime\Exceptions\Exceptions;
class HttpException extends \Exception {}

View file

@ -1,5 +1,5 @@
<?php <?php
namespace Runtime\Exceptions; namespace Runtime\Exceptions\Exceptions;
class InvalidArgumentException extends \InvalidArgumentException {} class InvalidArgumentException extends \InvalidArgumentException {}

View file

@ -1,5 +1,5 @@
<?php <?php
namespace Runtime\Exceptions; namespace Runtime\Exceptions\Exceptions;
class MalformedUrlException extends \Exception {} class MalformedUrlException extends \Exception {}

View file

@ -0,0 +1,5 @@
<?php
namespace Runtime\Exceptions\Exceptions;
class NotFoundHttpException extends HttpException {}

View file

@ -1,5 +1,5 @@
<?php <?php
namespace Runtime\Exceptions; namespace Runtime\Exceptions\Exceptions;
class SecurityException extends \Exception {} class SecurityException extends \Exception {}

View file

@ -1,5 +1,5 @@
<?php <?php
namespace Runtime\Exceptions; namespace Runtime\Exceptions\Exceptions;
class TokenMismatchException extends \Exception {} class TokenMismatchException extends \Exception {}

View file

@ -2,7 +2,7 @@
namespace Runtime\Factory; namespace Runtime\Factory;
use Runtime\Exceptions\ClassNotFoundException; use Runtime\Exceptions\Exceptions\ClassNotFoundException;
use Runtime\Http\View\ViewEngine; use Runtime\Http\View\ViewEngine;
use Runtime\Router\Route; use Runtime\Router\Route;
use Runtime\Exceptions\ExceptionHandler; use Runtime\Exceptions\ExceptionHandler;

View file

@ -2,7 +2,7 @@
namespace Runtime\Http\Input; namespace Runtime\Http\Input;
use Runtime\Exceptions\InvalidArgumentException; use Runtime\Exceptions\Exceptions\InvalidArgumentException;
class InputFile implements IInputItem class InputFile implements IInputItem
{ {

View file

@ -2,7 +2,7 @@
namespace Runtime\Http\Input; namespace Runtime\Http\Input;
use Runtime\Exceptions\InvalidArgumentException; use Runtime\Exceptions\Exceptions\InvalidArgumentException;
use Runtime\Http\Request; use Runtime\Http\Request;
class InputHandler class InputHandler

View file

@ -2,7 +2,7 @@
namespace Runtime\Http\Middleware; namespace Runtime\Http\Middleware;
use Runtime\Exceptions\TokenMismatchException; use Runtime\Exceptions\Exceptions\TokenMismatchException;
use Runtime\Http\Request; use Runtime\Http\Request;
use Runtime\Http\Security\CookieTokenProvider; use Runtime\Http\Security\CookieTokenProvider;
use Runtime\Http\Security\ITokenProvider; use Runtime\Http\Security\ITokenProvider;
@ -17,7 +17,7 @@ class BaseCsrfVerifier implements IMiddleware
/** /**
* BaseCsrfVerifier constructor. * BaseCsrfVerifier constructor.
* @throws \Runtime\Exceptions\SecurityException * @throws \Runtime\Exceptions\Exceptions\SecurityException
*/ */
public function __construct() public function __construct()
{ {

View file

@ -2,7 +2,7 @@
namespace Runtime\Http; namespace Runtime\Http;
use Runtime\Exceptions\MalformedUrlException; use Runtime\Exceptions\Exceptions\MalformedUrlException;
use Runtime\Http\Input\InputHandler; use Runtime\Http\Input\InputHandler;
use Runtime\Router\Route\ILoadableRoute; use Runtime\Router\Route\ILoadableRoute;
use Runtime\Router\Route\RouteUrl; use Runtime\Router\Route\RouteUrl;

View file

@ -2,7 +2,7 @@
namespace Runtime\Http; namespace Runtime\Http;
use Runtime\Exceptions\InvalidArgumentException; use Runtime\Exceptions\Exceptions\InvalidArgumentException;
class Response class Response
{ {

View file

@ -2,7 +2,7 @@
namespace Runtime\Http\Security; namespace Runtime\Http\Security;
use Runtime\Exceptions\SecurityException; use Runtime\Exceptions\Exceptions\SecurityException;
class CookieTokenProvider implements ITokenProvider class CookieTokenProvider implements ITokenProvider
{ {

View file

@ -2,7 +2,7 @@
namespace Runtime\Http; namespace Runtime\Http;
use Runtime\Exceptions\MalformedUrlException; use Runtime\Exceptions\Exceptions\MalformedUrlException;
class Url implements \JsonSerializable class Url implements \JsonSerializable
{ {

View file

@ -3,7 +3,7 @@
namespace Runtime\Router\ClassLoader; namespace Runtime\Router\ClassLoader;
use DI\Container; use DI\Container;
use Runtime\Router\Exceptions\NotFoundHttpException; use Runtime\Exceptions\Exceptions\NotFoundHttpException;
class ClassLoader implements IClassLoader class ClassLoader implements IClassLoader
{ {

View file

@ -1,8 +0,0 @@
<?php
namespace Runtime\Router\Exceptions;
class HttpException extends \Exception
{
}

View file

@ -1,8 +0,0 @@
<?php
namespace Runtime\Router\Exceptions;
class NotFoundHttpException extends HttpException
{
}

View file

@ -12,14 +12,14 @@ namespace Runtime\Router;
use DI\Container; use DI\Container;
use Runtime\Exceptions\ExceptionHandler; use Runtime\Exceptions\ExceptionHandler;
use Runtime\Exceptions\InvalidArgumentException; use Runtime\Exceptions\Exceptions\InvalidArgumentException;
use Runtime\Exceptions\MalformedUrlException; use Runtime\Exceptions\Exceptions\MalformedUrlException;
use Runtime\Http\Middleware\BaseCsrfVerifier; use Runtime\Http\Middleware\BaseCsrfVerifier;
use Runtime\Http\Request; use Runtime\Http\Request;
use Runtime\Http\Response; use Runtime\Http\Response;
use Runtime\Http\Url; use Runtime\Http\Url;
use Runtime\Router\ClassLoader\IClassLoader; use Runtime\Router\ClassLoader\IClassLoader;
use Runtime\Router\Exceptions\HttpException; use Runtime\Exceptions\Exceptions\HttpException;
use Runtime\Router\Handlers\CallbackExceptionHandler; use Runtime\Router\Handlers\CallbackExceptionHandler;
use Runtime\Router\Handlers\IEventHandler; use Runtime\Router\Handlers\IEventHandler;
use Runtime\Router\Route\IGroupRoute; use Runtime\Router\Route\IGroupRoute;
@ -54,8 +54,8 @@ class Route
/** /**
* Start routing * Start routing
* *
* @throws \Runtime\Router\Exceptions\NotFoundHttpException * @throws \Runtime\Exceptions\Exceptions\NotFoundHttpException
* @throws \Runtime\Exceptions\TokenMismatchException * @throws \Runtime\Exceptions\Exceptions\TokenMismatchException
* @throws HttpException * @throws HttpException
* @throws \Exception * @throws \Exception
*/ */

View file

@ -23,7 +23,7 @@ interface IRoute
* @param Request $request * @param Request $request
* @param Router $router * @param Router $router
* @return string * @return string
* @throws \Runtime\Router\Exceptions\NotFoundHttpException * @throws \Runtime\Exceptions\Exceptions\NotFoundHttpException
*/ */
public function renderRoute(Request $request, Router $router): ?string; public function renderRoute(Request $request, Router $router): ?string;

View file

@ -4,7 +4,7 @@ namespace Runtime\Router\Route;
use Runtime\Http\Middleware\IMiddleware; use Runtime\Http\Middleware\IMiddleware;
use Runtime\Http\Request; use Runtime\Http\Request;
use Runtime\Router\Exceptions\HttpException; use Runtime\Exceptions\Exceptions\HttpException;
use Runtime\Router\Router; use Runtime\Router\Router;
abstract class LoadableRoute extends Route implements ILoadableRoute abstract class LoadableRoute extends Route implements ILoadableRoute

View file

@ -4,7 +4,7 @@ namespace Runtime\Router\Route;
use Runtime\Http\Middleware\IMiddleware; use Runtime\Http\Middleware\IMiddleware;
use Runtime\Http\Request; use Runtime\Http\Request;
use Runtime\Router\Exceptions\NotFoundHttpException; use Runtime\Exceptions\Exceptions\NotFoundHttpException;
use Runtime\Router\Router; use Runtime\Router\Router;
abstract class Route implements IRoute abstract class Route implements IRoute

View file

@ -2,15 +2,15 @@
namespace Runtime\Router; namespace Runtime\Router;
use Runtime\Exceptions\InvalidArgumentException; use Runtime\Exceptions\Exceptions\InvalidArgumentException;
use Runtime\Exceptions\MalformedUrlException; use Runtime\Exceptions\Exceptions\MalformedUrlException;
use Runtime\Http\Middleware\BaseCsrfVerifier; use Runtime\Http\Middleware\BaseCsrfVerifier;
use Runtime\Http\Request; use Runtime\Http\Request;
use Runtime\Http\Url; use Runtime\Http\Url;
use Runtime\Router\ClassLoader\ClassLoader; use Runtime\Router\ClassLoader\ClassLoader;
use Runtime\Router\ClassLoader\IClassLoader; use Runtime\Router\ClassLoader\IClassLoader;
use Runtime\Router\Exceptions\HttpException; use Runtime\Exceptions\Exceptions\HttpException;
use Runtime\Router\Exceptions\NotFoundHttpException; use Runtime\Exceptions\Exceptions\NotFoundHttpException;
use Runtime\Router\Handlers\EventHandler; use Runtime\Router\Handlers\EventHandler;
use Runtime\Router\Handlers\IEventHandler; use Runtime\Router\Handlers\IEventHandler;
use Runtime\Router\Handlers\IExceptionHandler; use Runtime\Router\Handlers\IExceptionHandler;
@ -305,8 +305,8 @@ class Router
* Start the routing * Start the routing
* *
* @return string|null * @return string|null
* @throws \Runtime\Router\Exceptions\NotFoundHttpException * @throws \Runtime\Exceptions\Exceptions\NotFoundHttpException
* @throws \Runtime\Exceptions\TokenMismatchException * @throws \Runtime\Exceptions\Exceptions\TokenMismatchException
* @throws HttpException * @throws HttpException
* @throws \Exception * @throws \Exception
*/ */
@ -625,7 +625,7 @@ class Router
* @param array|null $getParams * @param array|null $getParams
* @return Url * @return Url
* @throws InvalidArgumentException * @throws InvalidArgumentException
* @throws \Runtime\Exceptions\MalformedUrlException * @throws \Runtime\Exceptions\Exceptions\MalformedUrlException
*/ */
public function getUrl(?string $name = null, $parameters = null, ?array $getParams = null): Url public function getUrl(?string $name = null, $parameters = null, ?array $getParams = null): Url
{ {