From ddc0e6fb1ee6a8bd61faca70c5561c6414995673 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0tancl?= <33033094+stancl@users.noreply.github.com> Date: Mon, 4 Mar 2019 22:19:38 +0100 Subject: [PATCH] Remove support for onFail without arguments to improve performance --- src/Middleware/InitializeTenancy.php | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/Middleware/InitializeTenancy.php b/src/Middleware/InitializeTenancy.php index cd6383a5..3c37360a 100644 --- a/src/Middleware/InitializeTenancy.php +++ b/src/Middleware/InitializeTenancy.php @@ -25,13 +25,7 @@ class InitializeTenancy try { tenancy()->init(); } catch (\Exception $e) { - // Pass the exception to the onFail function if it takes any parameters. - $callback = $this->onFail; - if ((new \ReflectionFunction($callback))->getNumberOfParameters() > 0) { - $callback($e); - } else { - $callback(); - } + ($this->onFail)($e); } return $next($request);