Skip to content

Commit e74c941

Browse files
author
Sandu Luca
committed
fixed incompatibilities with illuminate 7.x
1 parent 8422d36 commit e74c941

File tree

4 files changed

+21
-16
lines changed

4 files changed

+21
-16
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"license": "MIT",
55
"require": {
66
"php-di/php-di": "^6.1",
7-
"illuminate/routing": "^7.21",
8-
"illuminate/events": "^7.21"
7+
"illuminate/routing": "^7.25",
8+
"illuminate/events": "^7.25"
99
},
1010
"autoload": {
1111
"psr-4": {

src/ExceptionHandler.php

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,19 @@
77
use GGbear\Routing\Exceptions\TokenAuthenticationException;
88
use Illuminate\Http\Response;
99
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
10+
use Throwable;
1011

1112
class ExceptionHandler
1213
{
1314
/**
1415
* Report or log an exception.
1516
*
16-
* @param \Exception $exception
17+
* @param \Throwable $e
1718
* @return void
19+
*
20+
* @throws \Exception
1821
*/
19-
public function report(Exception $exception)
22+
public function report(Throwable $e)
2023
{
2124
// parent::report($exception);
2225
}
@@ -25,30 +28,32 @@ public function report(Exception $exception)
2528
* Render an exception into an HTTP response.
2629
*
2730
* @param \Illuminate\Http\Request $request
28-
* @param \Exception $exception
29-
* @return \Illuminate\Http\Response
31+
* @param \Throwable $e
32+
* @return \Symfony\Component\HttpFoundation\Response
33+
*
34+
* @throws \Throwable
3035
*/
31-
public function render($request, Exception $exception)
36+
public function render($request, Throwable $e)
3237
{
3338

3439
$response = new Response();
3540
$response->header("Content-Type", "application/json");
3641

37-
if ($exception instanceof BasicAuthenticationException) {
42+
if ($e instanceof BasicAuthenticationException) {
3843
return $response->setContent([
3944
'error' => true,
4045
'message' => 'Basic authentication failed',
4146
]);
4247
}
4348

44-
if ($exception instanceof TokenAuthenticationException) {
49+
if ($e instanceof TokenAuthenticationException) {
4550
return $response->setContent([
4651
'error' => true,
4752
'message' => 'Token is invalid',
4853
]);
4954
}
5055

51-
if ($exception instanceof NotFoundHttpException) {
56+
if ($e instanceof NotFoundHttpException) {
5257
return $response->setContent([
5358
'error' => true,
5459
'message' => 'Invalid route',

src/Pipeline.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
namespace GGbear\Routing;
44

55
use DI\Container;
6-
use Exception;
76
use Illuminate\Contracts\Debug\ExceptionHandler;
87
use Illuminate\Http\Request;
8+
use Throwable;
99

1010
class Pipeline extends \Illuminate\Pipeline\Pipeline
1111
{
@@ -25,12 +25,12 @@ public function __construct(Container $container = null)
2525
* Handle the given exception.
2626
*
2727
* @param mixed $passable
28-
* @param \Exception $e
28+
* @param \Throwable $e
2929
* @return mixed
3030
*
31-
* @throws \Exception
31+
* @throws \Throwable
3232
*/
33-
protected function handleException($passable, Exception $e)
33+
protected function handleException($passable, Throwable $e)
3434
{
3535
if (
3636
!$this->container->has(ExceptionHandler::class) ||

src/Router.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ public function __construct(Dispatcher $events, Container $container = null)
5353
* @param array|string $methods
5454
* @param string $uri
5555
* @param mixed $action
56-
* @return Route
56+
* @return \Illuminate\Routing\Route
5757
*/
58-
protected function newRoute($methods, $uri, $action)
58+
public function newRoute($methods, $uri, $action)
5959
{
6060
$route = new Route($methods, $uri, $action);
6161
$route->setRouterDI($this);

0 commit comments

Comments
 (0)