guzzle / guzzle

Guzzle, an extensible PHP HTTP client

Home Page:https://docs.guzzlephp.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Psalm param-out for history middleware

Guuzen opened this issue · comments

Description
Describe &$container parameter of \GuzzleHttp\Middleware::history by psalm annotation so we do not have to do it in a test code.

Example
At the moment we must describe types manually

$requests = [];
$history = Middleware::history($requests);
/** @var array<int, array{request: Request}> $requests */
$handlers->push($history);
$request = $requests[0]['request'];
$this->assertEquals('someUrl', request->getUri());

But it would be more convenient without manual annotations

WDYT?

I realized, that param-out would not be true, because type of $requests variable changes after request, not after middleware initialization and i think psalm can't infer type conditionally for another class

commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 2 weeks if no further activity occurs. Thank you for your contributions.