From c1d9d8b056ef3fee35b64f09fcd95f56010b734b Mon Sep 17 00:00:00 2001 From: Anders Bilfeldt Date: Mon, 19 Apr 2021 21:03:31 +0200 Subject: [PATCH 1/2] Fix psalm issues --- src/LaravelHttpClientLoggerServiceProvider.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/LaravelHttpClientLoggerServiceProvider.php b/src/LaravelHttpClientLoggerServiceProvider.php index ed8582c..952beef 100644 --- a/src/LaravelHttpClientLoggerServiceProvider.php +++ b/src/LaravelHttpClientLoggerServiceProvider.php @@ -36,6 +36,7 @@ public function packageBooted() ?HttpLoggerInterface $logger = null, ?HttpLoggingFilterInterface $filter = null ) { + /** @var \Illuminate\Http\Client\PendingRequest $this */ return $this->withMiddleware((new LoggingMiddleware( $logger ?? resolve(HttpLoggerInterface::class), $filter ?? resolve(HttpLoggingFilterInterface::class) @@ -50,6 +51,7 @@ public function packageBooted() ?HttpLoggingFilterInterface $filter = null ) { if (value($condition)) { + /** @var \Illuminate\Http\Client\PendingRequest $this */ return $this->log($context, $config, $logger, $filter); } else { return $this; From e2ecb45326fd02e6d091da358ea536e5268dbb2e Mon Sep 17 00:00:00 2001 From: Anders Bilfeldt Date: Mon, 19 Apr 2021 21:10:13 +0200 Subject: [PATCH 2/2] Fix psalm error --- src/LaravelHttpClientLoggerServiceProvider.php | 1 + src/Middleware/LoggingMiddleware.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/LaravelHttpClientLoggerServiceProvider.php b/src/LaravelHttpClientLoggerServiceProvider.php index 952beef..e0d4a41 100644 --- a/src/LaravelHttpClientLoggerServiceProvider.php +++ b/src/LaravelHttpClientLoggerServiceProvider.php @@ -54,6 +54,7 @@ public function packageBooted() /** @var \Illuminate\Http\Client\PendingRequest $this */ return $this->log($context, $config, $logger, $filter); } else { + /** @var \Illuminate\Http\Client\PendingRequest $this */ return $this; } }); diff --git a/src/Middleware/LoggingMiddleware.php b/src/Middleware/LoggingMiddleware.php index 73f95b2..b1da77a 100644 --- a/src/Middleware/LoggingMiddleware.php +++ b/src/Middleware/LoggingMiddleware.php @@ -24,7 +24,7 @@ public function __construct(HttpLoggerInterface $logger, HttpLoggingFilterInterf * Called when the middleware is handled by the client. * * @param array $context - * @return callable(RequestInterface, array): PromiseInterface + * @return callable */ public function __invoke($context = [], $config = []): callable {