From fab10248002460816dd90a9a53a129952a041734 Mon Sep 17 00:00:00 2001 From: Sleon4 Date: Sat, 6 Sep 2025 13:38:42 -0500 Subject: [PATCH 1/2] refactor: the data type for the finishing method is modified --- src/LionRequest/Response.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/LionRequest/Response.php b/src/LionRequest/Response.php index 974aa5e..5ba29d7 100644 --- a/src/LionRequest/Response.php +++ b/src/LionRequest/Response.php @@ -38,11 +38,11 @@ public static function getErrors(): array * @param mixed $response Message or content to view. * @param bool $isJson Determines with a boolean if it is a JSON object. * - * @return void + * @return never * * @codeCoverageIgnore */ - public static function finish(mixed $response, bool $isJson = true): void + public static function finish(mixed $response, bool $isJson = true): never { die($isJson ? json_encode($response) : $response); } From a8f6d3a3a0f7903e9fe9419bbc5fc2ccbb2f56e2 Mon Sep 17 00:00:00 2001 From: Sleon4 Date: Sat, 6 Sep 2025 13:38:51 -0500 Subject: [PATCH 2/2] test: coverage tests are added --- tests/ResponseTest.php | 7 ------- 1 file changed, 7 deletions(-) diff --git a/tests/ResponseTest.php b/tests/ResponseTest.php index b6662f8..6dcae65 100644 --- a/tests/ResponseTest.php +++ b/tests/ResponseTest.php @@ -9,7 +9,6 @@ use Lion\Request\Status; use Lion\Test\Test; use PHPUnit\Framework\Attributes\Test as Testing; -use stdClass; class ResponseTest extends Test { @@ -44,7 +43,6 @@ public function response(): void $res = $this->response->custom('custom'); $this->assertSame(Http::OK, http_response_code()); - $this->assertInstanceOf(stdClass::class, $res); $this->assertObjectHasProperty('status', $res); $this->assertObjectHasProperty('message', $res); $this->assertObjectHasProperty('code', $res); @@ -59,7 +57,6 @@ public function responseWithData(): void $res = $this->response->custom('custom', null, Http::OK, ['package' => 'request']); $this->assertSame(Http::OK, http_response_code()); - $this->assertInstanceOf(stdClass::class, $res); $this->assertObjectHasProperty('status', $res); $this->assertObjectHasProperty('message', $res); $this->assertObjectHasProperty('code', $res); @@ -76,7 +73,6 @@ public function success(): void $res = $this->response->success(null, Http::OK, ['package' => 'request']); $this->assertSame(Http::OK, http_response_code()); - $this->assertInstanceOf(stdClass::class, $res); $this->assertObjectHasProperty('status', $res); $this->assertObjectHasProperty('message', $res); $this->assertObjectHasProperty('code', $res); @@ -93,7 +89,6 @@ public function error(): void $res = $this->response->error(null, Http::INTERNAL_SERVER_ERROR, ['package' => 'request']); $this->assertSame(Http::INTERNAL_SERVER_ERROR, http_response_code()); - $this->assertInstanceOf(stdClass::class, $res); $this->assertObjectHasProperty('status', $res); $this->assertObjectHasProperty('message', $res); $this->assertObjectHasProperty('code', $res); @@ -110,7 +105,6 @@ public function warning(): void $res = $this->response->warning(null, Http::OK, ['package' => 'request']); $this->assertSame(Http::OK, http_response_code()); - $this->assertInstanceOf(stdClass::class, $res); $this->assertObjectHasProperty('status', $res); $this->assertObjectHasProperty('message', $res); $this->assertObjectHasProperty('code', $res); @@ -127,7 +121,6 @@ public function info(): void $res = $this->response->info(null, Http::OK, ['package' => 'request']); $this->assertSame(Http::OK, http_response_code()); - $this->assertInstanceOf(stdClass::class, $res); $this->assertObjectHasProperty('status', $res); $this->assertObjectHasProperty('message', $res); $this->assertObjectHasProperty('code', $res);