代码同步

This commit is contained in:
Ghost
2025-03-24 14:59:19 +08:00
committed by 柳清爽
parent 4e96b79acb
commit 725ea30d25
716 changed files with 90318 additions and 26155 deletions

View File

@@ -1,4 +1,5 @@
<?php
namespace GuzzleHttp\Exception;
use Psr\Http\Message\RequestInterface;
@@ -10,18 +11,29 @@ use Psr\Http\Message\ResponseInterface;
class BadResponseException extends RequestException
{
public function __construct(
$message,
string $message,
RequestInterface $request,
ResponseInterface $response = null,
\Exception $previous = null,
ResponseInterface $response,
?\Throwable $previous = null,
array $handlerContext = []
) {
if (null === $response) {
@trigger_error(
'Instantiating the ' . __CLASS__ . ' class without a Response is deprecated since version 6.3 and will be removed in 7.0.',
E_USER_DEPRECATED
);
}
parent::__construct($message, $request, $response, $previous, $handlerContext);
}
/**
* Current exception and the ones that extend it will always have a response.
*/
public function hasResponse(): bool
{
return true;
}
/**
* This function narrows the return type from the parent class and does not allow it to be nullable.
*/
public function getResponse(): ResponseInterface
{
/** @var ResponseInterface */
return parent::getResponse();
}
}