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

[10.x] Remove workarounds for old Guzzle versions #47084

Merged
merged 1 commit into from
May 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion phpstan.src.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ parameters:
- "#Class [a-zA-Z0-9\\\\_]+ not found.#"
- "#has invalid type#"
- "#should always throw an exception or terminate script execution#"
- "#Function GuzzleHttp\\\\Psr7#"
- "#Instantiated class [a-zA-Z0-9\\\\_]+ not found.#"
- "#Unsafe usage of new static#"
excludePaths:
Expand Down
5 changes: 2 additions & 3 deletions src/Illuminate/Http/Client/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Illuminate\Http\Client;

use Closure;
use GuzzleHttp\Promise\Create;
use GuzzleHttp\Promise\PromiseInterface;
use GuzzleHttp\Psr7\Response as Psr7Response;
use GuzzleHttp\TransferStats;
Expand Down Expand Up @@ -93,9 +94,7 @@ public static function response($body = null, $status = 200, $headers = [])

$response = new Psr7Response($status, $headers, $body);

return class_exists(\GuzzleHttp\Promise\Create::class)
? \GuzzleHttp\Promise\Create::promiseFor($response)
: \GuzzleHttp\Promise\promise_for($response);
return Create::promiseFor($response);
}

/**
Expand Down
7 changes: 1 addition & 6 deletions src/Illuminate/Http/Client/Pool.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,7 @@ class Pool
public function __construct(Factory $factory = null)
{
$this->factory = $factory ?: new Factory();

if (method_exists(Utils::class, 'chooseHandler')) {
$this->handler = Utils::chooseHandler();
} else {
$this->handler = \GuzzleHttp\choose_handler();
}
$this->handler = Utils::chooseHandler();
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/Illuminate/Http/Client/RequestException.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Illuminate\Http\Client;

use GuzzleHttp\Psr7\Message;

class RequestException extends HttpClientException
{
/**
Expand Down Expand Up @@ -34,9 +36,7 @@ protected function prepareMessage(Response $response)
{
$message = "HTTP request returned status code {$response->status()}";

$summary = class_exists(\GuzzleHttp\Psr7\Message::class)
? \GuzzleHttp\Psr7\Message::bodySummary($response->toPsrResponse())
: \GuzzleHttp\Psr7\get_message_body_summary($response->toPsrResponse());
$summary = Message::bodySummary($response->toPsrResponse());

return is_null($summary) ? $message : $message .= ":\n{$summary}\n";
}
Expand Down