From fcf4951e8c554ae35a815f45f6980539954180a4 Mon Sep 17 00:00:00 2001 From: Mohamed Said Date: Wed, 11 Mar 2020 11:42:05 +0200 Subject: [PATCH] replace DiactorosFactory --- composer.json | 5 +++-- src/Runtime/Handlers/AppHandler.php | 15 ++++++++++++--- src/Runtime/Handlers/LoadBalancedAppHandler.php | 2 +- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/composer.json b/composer.json index db3310e..ad77ee1 100644 --- a/composer.json +++ b/composer.json @@ -25,8 +25,9 @@ "monolog/monolog": "^1.12|^2.0", "riverline/multipart-parser": "^2.0", "symfony/process": "^4.3|^5.0", - "symfony/psr-http-message-bridge": "^1.2", - "zendframework/zend-diactoros": "^2.1" + "laminas/laminas-diactoros": "^2.2", + "nyholm/psr7": "^1.0", + "symfony/psr-http-message-bridge": "^2.0" }, "require-dev": { "mockery/mockery": "^1.2", diff --git a/src/Runtime/Handlers/AppHandler.php b/src/Runtime/Handlers/AppHandler.php index b4112c9..96bcbf0 100644 --- a/src/Runtime/Handlers/AppHandler.php +++ b/src/Runtime/Handlers/AppHandler.php @@ -12,8 +12,12 @@ use Laravel\Vapor\Runtime\Http\PsrRequestFactory; use Laravel\Vapor\Runtime\PsrLambdaResponseFactory; use Illuminate\Console\Application as ConsoleApplication; -use Symfony\Bridge\PsrHttpMessage\Factory\DiactorosFactory; use Symfony\Bridge\PsrHttpMessage\Factory\HttpFoundationFactory; +use Symfony\Bridge\PsrHttpMessage\Factory\PsrHttpFactory; +use Laminas\Diactoros\ResponseFactory; +use Laminas\Diactoros\ServerRequestFactory; +use Laminas\Diactoros\StreamFactory; +use Laminas\Diactoros\UploadedFileFactory; class AppHandler implements LambdaEventHandler { @@ -33,7 +37,12 @@ public function handle(array $event) )); return $this->marshalResponse( - (new DiactorosFactory)->createResponse($response) + (new PsrHttpFactory( + new ServerRequestFactory, + new StreamFactory, + new UploadedFileFactory, + new ResponseFactory + ))->createResponse($response) ); } finally { if (isset($app)) { @@ -57,7 +66,7 @@ protected function marshalRequest(array $event) /** * Marshal the PSR-7 response to a Lambda response. * - * @param Psr\Http\Message\ResponseInterface $response + * @param \Psr\Http\Message\ResponseInterface $response * @return \Laravel\Vapor\Runtime\ArrayLambdaResponse */ protected function marshalResponse(ResponseInterface $response) diff --git a/src/Runtime/Handlers/LoadBalancedAppHandler.php b/src/Runtime/Handlers/LoadBalancedAppHandler.php index a40e434..6ca9599 100644 --- a/src/Runtime/Handlers/LoadBalancedAppHandler.php +++ b/src/Runtime/Handlers/LoadBalancedAppHandler.php @@ -21,7 +21,7 @@ protected function marshalRequest(array $event) /** * Marshal the PSR-7 response to a Lambda response. * - * @param Psr\Http\Message\ResponseInterface $response + * @param \Psr\Http\Message\ResponseInterface $response * @return \Laravel\Vapor\Runtime\ArrayLambdaResponse */ protected function marshalResponse(ResponseInterface $response)