From 9e583a601e393c4dccdddc2fd6e24e40397bd641 Mon Sep 17 00:00:00 2001 From: paramtamtam Date: Tue, 8 Dec 2020 16:36:50 +0500 Subject: GitHub actions updated, some PHP errors fixed This PR contains: - Ci actions (build) refactoring - Little `Makefile` fix (my mistake in previous PR) - Updated minimal required versions of composer packages: - `psr/http-factory` (`^1.0` → `^1.0.1`) - `psr/http-message` (`^1.0` → `^1.0.1`) - `laminas/laminas-diactoros` (`^1.3` → `^1.3.6`) - Tests using minimal and maximal composer package versions - Disabling `checkMissingIterableValueType` in `phpstan.neon.dist` - Some typos (wrong class namespaces and annotations) in PHP files :warning: - One improvement in `HttpClient::respond` method (variable type hint overriding fixed) - Added packages testing on CI: - `./service/gzip` - `./service/reload` --- src/HttpClient.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/HttpClient.php') diff --git a/src/HttpClient.php b/src/HttpClient.php index 4ca152c8..9b9048ca 100644 --- a/src/HttpClient.php +++ b/src/HttpClient.php @@ -62,14 +62,13 @@ final class HttpClient */ public function respond(int $status, string $body, array $headers = []): void { - if (empty($headers)) { - // this is required to represent empty header set as map and not as array - $headers = new \stdClass(); - } + $sendHeaders = empty($headers) + ? new \stdClass() // this is required to represent empty header set as map and not as array + : $headers; $this->getWorker()->send( $body, - (string) json_encode(['status' => $status, 'headers' => $headers]) + (string) json_encode(['status' => $status, 'headers' => $sendHeaders]) ); } } -- cgit v1.2.3