Skip to content

Commit

Permalink
Remove redundant is_string check and cast view to string
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
koriym committed Nov 19, 2024
1 parent cc380f9 commit 466f2e1
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions tests/IntegrateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 466f2e1

Please sign in to comment.