slimphp / Slim-Psr7

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

Declaration of Slim\Psr7\Uri::withScheme($scheme) must be compatible with Psr\Http\Message\UriInterface::withScheme(string $scheme): Psr\Http\Message\UriInterface #292

Closed george-slastnoy closed 4 months ago

george-slastnoy commented 1 year ago

Hello, after updating The psr/http-message to the latest version I have the following error: Declaration of Slim\Psr7\Uri::withScheme($scheme) must be compatible with Psr\Http\Message\UriInterface::withScheme(string $scheme): Psr\Http\Message\UriInterface. Will there be an update to Slim\PSR7?

l0gicgate commented 1 year ago

What version of PSR are you using?

george-slastnoy commented 1 year ago

Thanks for reply. How to check PSR version? I see now that the URI interface of the psr/http-message package is newer, the composer shows version 1.1. Link to zip: https://api.github.com/repos/php-fig/http-message/zipball/cb6ce4845ce34a8ad9e68117c10ee90a29919eba

george-slastnoy commented 1 year ago

Also, there is psr/http-message version 2.0. We have 2 psr/http-message packages (one that came with a product we use, the other one came with a particular module of this application, but both of them are, I think, of April 2023).

george-slastnoy commented 1 year ago

I think the problem is that there are no type hints.

george-slastnoy commented 1 year ago

The active package is 2.0. Now the slim/psr7 package lacks function parameter and return hints.

willy-opale commented 11 months ago

It's a big problem for us too. For now we have to freeze psr/http-message to version 1.1 although all of our other dependencies (like Symfony and Laminas) allow 2.0. The only dependency still stuck @ 1.1 is Slim. Thankfully, other dependencies also allow version 1 (^1.1 || ^2.0) but it's a matter of time until ^2.0 will be the minimum for a package. This will probably force us to move everything to Symfony, because they would never allow such an old version to rot in their source code for too long.

clownmeister commented 7 months ago

Here is a workaround. Shouldn't really be used in production tho. I believe the pipeline is failing.

Hey so I started using `"slim/psr7": "dev-master#08dbc65964bf2c1fb0fe54256322a272cd02596b as 1.6.1",` as a workaround but only for some dev testing. 
We are kind of forced to stop using slim because of this. We will slowly make a transition to do so.

Note to the devs: Please try to release current master if possible

Originally posted by @clownmeister in https://github.com/slimphp/Slim-Psr7/issues/296#issuecomment-2047947928

odan commented 4 months ago

This have been fixed in v1.7.0.