Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Declaration of Smalot\Cups\Transport\Client::sendRequest(Psr\Http\Message\RequestInterface $request) must be compatible with Psr\Http\Client\ClientInterface::sendRequest(Psr\Http\Message\RequestInterface $request): Psr\Http\Message\ResponseInterface #29

Open
cjprinse opened this issue Jul 12, 2021 · 8 comments

Comments

@cjprinse
Copy link

After update from 0.4 to 0.5 I get this error:

"Declaration of Smalot\Cups\Transport\Client::sendRequest(Psr\Http\Message\RequestInterface $request) must be compatible with Psr\Http\Client\ClientInterface::sendRequest(Psr\Http\Message\RequestInterface $request): Psr\Http\Message\ResponseInterface"

This is because of version constraints of dependencies has been removed

  - Upgrading php-http/promise (v1.0.0 => 1.1.0): Extracting archive
  - Upgrading php-http/httplug (v1.1.0 => 2.2.0): Extracting archive
  - Upgrading php-http/socket-client (v1.4.1 => 2.1.0): Extracting archive
  - Upgrading php-http/message (1.8.0 => 1.11.1): Extracting archive
  - Upgrading php-http/client-common (1.10.0 => 2.4.0): Extracting archive
  - Upgrading smalot/cups-ipp (v0.4 => v0.5): Extracting archive

php-http/httplug ^2.0 introduces a new interface for ClientInterface

@rvdsarr
Copy link

rvdsarr commented Oct 28, 2021

Is there any fix to this?

@Fasterpast
Copy link

Fasterpast commented Feb 7, 2022

Here is some temporary workaround:

in Transport/Client.php
add: use Psr\Http\Client\ClientInterface;
add: use Psr\Http\Message\ResponseInterface;

del: class Client implements HttpClient
add: class Client implements ClientInterface

del: public function sendRequest(RequestInterface $request)
add: public function sendRequest(RequestInterface $request): ResponseInterface

in Manager/ManagerAbstract.php

del: use Http\Client\HttpClient;
add: use Psr\Http\Client\ClientInterface;

del: * @var \Http\Client\HttpClient
add: * @var \use Psr\Http\Client\ClientInterface;

del:  public function __construct(Builder $builder, HttpClient $client, ResponseParser $responseParser)
add: public function __construct(Builder $builder, ClientInterface $client, ResponseParser $responseParser)

del:      * @param \Http\Client\HttpClient $client
add:      * @param \Psr\Http\Client\ClientInterface $client

That should do the trick. Also I had some hostname issues, so in Client.php I made this:
$host = 'https://<domain>:631;

@skrilax91
Copy link

Maybe a fork of this project ? The author has not maintained the project for 2 years

@Bartheyrman22
Copy link

I can advise using: JulianOsorio078/cups-ipp

@ro0NL
Copy link

ro0NL commented Dec 7, 2022

@Bartheyrman22 this just trades the deps issue for another one:

    - julianosorio078/cups-ipp 0.9 requires guzzlehttp/psr7 ^1.2 -> found guzzlehttp/psr7[1.2.0, ..., 1.9.0] but the package is fixed to 2.4.3

@Bartheyrman22
Copy link

If you need guzzlehttp/psr7 2.4.3 then you have to find another solution.

@ro0NL
Copy link

ro0NL commented Dec 7, 2022

yeah, im putting my money on #32 still 😅

@ro0NL
Copy link

ro0NL commented Dec 8, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants