mirror of
https://github.com/crazywhalecc/choir-psr-http.git
synced 2026-03-17 20:24:52 +08:00
Update 1.0.3, support PHP 8.4
This commit is contained in:
parent
d7a05ac929
commit
56416d9b55
@ -32,17 +32,11 @@ class CurlClient implements ClientInterface, TimeoutInterface
|
|||||||
$this->curl_options = $curl_options;
|
$this->curl_options = $curl_options;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public function setTimeout(int $timeout)
|
public function setTimeout(int $timeout)
|
||||||
{
|
{
|
||||||
$this->curl_options[CURLOPT_TIMEOUT_MS] = $timeout;
|
$this->curl_options[CURLOPT_TIMEOUT_MS] = $timeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public function sendRequest(RequestInterface $request): ResponseInterface
|
public function sendRequest(RequestInterface $request): ResponseInterface
|
||||||
{
|
{
|
||||||
$handle = $this->createHandle($request);
|
$handle = $this->createHandle($request);
|
||||||
|
|||||||
@ -6,6 +6,4 @@ namespace Choir\Http\Client\Exception;
|
|||||||
|
|
||||||
use Psr\Http\Client\ClientExceptionInterface;
|
use Psr\Http\Client\ClientExceptionInterface;
|
||||||
|
|
||||||
class ClientException extends \Exception implements ClientExceptionInterface
|
class ClientException extends \Exception implements ClientExceptionInterface {}
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|||||||
@ -11,7 +11,7 @@ class NetworkException extends \Exception implements NetworkExceptionInterface
|
|||||||
{
|
{
|
||||||
private RequestInterface $request;
|
private RequestInterface $request;
|
||||||
|
|
||||||
public function __construct(RequestInterface $request, $message = '', $code = 0, \Throwable $previous = null)
|
public function __construct(RequestInterface $request, $message = '', $code = 0, ?\Throwable $previous = null)
|
||||||
{
|
{
|
||||||
$this->request = $request;
|
$this->request = $request;
|
||||||
parent::__construct($message, $code, $previous);
|
parent::__construct($message, $code, $previous);
|
||||||
|
|||||||
@ -11,15 +11,12 @@ class RequestException extends \Exception implements RequestExceptionInterface
|
|||||||
{
|
{
|
||||||
private RequestInterface $request;
|
private RequestInterface $request;
|
||||||
|
|
||||||
public function __construct(RequestInterface $request, $message = '', $code = 0, \Throwable $previous = null)
|
public function __construct(RequestInterface $request, $message = '', $code = 0, ?\Throwable $previous = null)
|
||||||
{
|
{
|
||||||
$this->request = $request;
|
$this->request = $request;
|
||||||
parent::__construct($message, $code, $previous);
|
parent::__construct($message, $code, $previous);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public function getRequest(): RequestInterface
|
public function getRequest(): RequestInterface
|
||||||
{
|
{
|
||||||
return $this->request;
|
return $this->request;
|
||||||
|
|||||||
@ -44,7 +44,6 @@ class StreamClient implements TimeoutInterface, ClientInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public function sendRequest(RequestInterface $request): ResponseInterface
|
public function sendRequest(RequestInterface $request): ResponseInterface
|
||||||
|
|||||||
@ -38,9 +38,7 @@ class Stream implements StreamInterface
|
|||||||
|
|
||||||
private ?int $size = null;
|
private ?int $size = null;
|
||||||
|
|
||||||
private function __construct()
|
private function __construct() {}
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Closes the stream when the destructed.
|
* Closes the stream when the destructed.
|
||||||
|
|||||||
@ -26,7 +26,7 @@ class FrameFactory
|
|||||||
return new Frame($payload, Opcode::BINARY, true, true);
|
return new Frame($payload, Opcode::BINARY, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function createCloseFrame(int $code = null, string $reason = null): Frame
|
public static function createCloseFrame(?int $code = null, ?string $reason = null): Frame
|
||||||
{
|
{
|
||||||
return new CloseFrame($code, $reason);
|
return new CloseFrame($code, $reason);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user