From 466f2e1a2da660af1f90a198c4ee82e1ea37ca72 Mon Sep 17 00:00:00 2001 From: Akihito Koriyama Date: Wed, 20 Nov 2024 01:21:52 +0900 Subject: [PATCH] Remove redundant is_string check and cast view to string This commit removes the unnecessary check for is_string before processing the view. Instead, the view is directly cast to a string, ensuring type safety and simplifying the code. This change is also annotated to ignore specific PHPStan warnings. --- tests/IntegrateTest.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/IntegrateTest.php b/tests/IntegrateTest.php index 748815e..61672c9 100644 --- a/tests/IntegrateTest.php +++ b/tests/IntegrateTest.php @@ -14,7 +14,6 @@ use Ray\Di\Injector; use function assert; -use function is_string; use function method_exists; use function ob_get_clean; use function ob_start; @@ -79,8 +78,7 @@ public function testRender(string $uri, string $expected): void $ro->setRenderer($this->renderer); assert(method_exists($ro, 'onGet')); $view = $ro->onGet(); - assert(is_string($view)); - $stream = $this->streamer->getStream($view); + $stream = $this->streamer->getStream((string) $view); // @phpstan-ignore-line rewind($stream); $view = stream_get_contents($stream); $this->assertSame($expected, $view);