From c6e9bb6a38ca62cb10b7404e5810693a60f5538f Mon Sep 17 00:00:00 2001 From: Dave Mc Nicoll Date: Fri, 12 Sep 2025 19:54:00 +0000 Subject: [PATCH] - Added MethodNotAllowed interface --- meta/definitions/http.php | 2 +- src/ApplicationStrategy.php | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/meta/definitions/http.php b/meta/definitions/http.php index 07783ea..148bfe1 100644 --- a/meta/definitions/http.php +++ b/meta/definitions/http.php @@ -7,7 +7,7 @@ use Laminas\{ Diactoros\ServerRequestFactory, HttpHandlerRunner\Emitter\EmitterI use Lean\Factory\{ HttpFactory, HttpFactoryInterface }; use Picea\Picea; -use function DI\autowire, DI\create, DI\get; +use function DI\{ autowire, create, get }; return [ ServerRequestInterface::class => function ($c) { diff --git a/src/ApplicationStrategy.php b/src/ApplicationStrategy.php index 2897e70..eae8c63 100644 --- a/src/ApplicationStrategy.php +++ b/src/ApplicationStrategy.php @@ -38,4 +38,9 @@ class ApplicationStrategy extends Strategy\ApplicationStrategy { { return $this->getContainer()->has(MethodNotAllowedInterface::class) ? $this->getContainer()->get(MethodNotAllowedInterface::class) : parent::getMethodNotAllowedDecorator($exception); } + + public function getMethodNotAllowedDecorator(MethodNotAllowedException $exception): MiddlewareInterface + { + return $this->getContainer()->has(MethodNotAllowedInterface::class) ? $this->getContainer()->get(MethodNotAllowedInterface::class) : parent::getMethodNotAllowedDecorator($exception); + } } \ No newline at end of file