slimphp / Slim-Psr7

PSR-7 implementation for use with Slim 4
MIT License
133 stars 45 forks source link

Fix StreamFactoryTest error #191

Closed Stilch closed 3 years ago

Stilch commented 3 years ago

Fix phpstan error for php 8.0 Parameter #1 $callback of function set_error_handler expects (callable(int, string, string, int, array): bool)|null, Closure(int, string): void given.

Stilch commented 3 years ago

@l0gicgate the current version of slim/psr7 does not pass this test either. Because this test is incorrect. Expected exception "ValueError", but PSR-17 states that "createStreamFromFile" only throw "RuntimeException" or "InvalidArgumentException".

Error message:

1) Slim\Tests\Psr7\Factory\StreamFactoryTest::testCreateStreamFromInvalidFileName
Failed asserting that exception of type "RuntimeException" matches expected exception "ValueError". Message was: "Unable to open  using mode r: Path cannot be empty" at
/home/runner/work/Slim-Psr7/Slim-Psr7/src/Factory/StreamFactory.php:68
/home/runner/work/Slim-Psr7/Slim-Psr7/vendor/http-interop/http-factory-tests/test/StreamFactoryTestCase.php:96

I can fix this, but it is a PSR-17 violation.

Stilch commented 3 years ago

This discrepancy was fixed in http-interop/http-factory-tests v0. 9. 0 I update http-interop/http-factory-tests requirement from ^0.8.0 to ^0.9.0