Compare commits

...

3 Commits

Author SHA1 Message Date
crazywhalecc
ac7109fa0f
Update funding 2025-03-10 10:20:38 +08:00
crazywhalecc
56416d9b55
Update 1.0.3, support PHP 8.4 2025-03-10 10:17:16 +08:00
crazywhalecc
d7a05ac929
Update 1.0.3, support PHP 8.4 2025-03-10 10:14:46 +08:00
12 changed files with 12 additions and 30 deletions

6
.github/FUNDING.yml vendored
View File

@ -1,16 +1,12 @@
# These are supported funding model platforms # These are supported funding model platforms
buymeacoffee: crazywhalecc github: crazywhalecc # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username open_collective: # Replace with a single Open Collective username
ko_fi: crazywhalecc # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username otechie: # Replace with a single Otechie username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
custom:
- https://github.com/crazywhalecc/crazywhalecc/blob/master/FUNDING.md
# Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

View File

@ -16,7 +16,7 @@
} }
], ],
"require": { "require": {
"php": "^7.4 || ^8.0 || ^8.1 || ^8.2", "php": "^7.4 || ^8.0 || ^8.1 || ^8.2 || ^8.3 || ^8.4",
"psr/http-client": "^1.0" "psr/http-client": "^1.0"
}, },
"require-dev": { "require-dev": {
@ -64,7 +64,7 @@
"[ $COMPOSER_DEV_MODE -eq 0 ] || vendor/bin/cghooks add" "[ $COMPOSER_DEV_MODE -eq 0 ] || vendor/bin/cghooks add"
], ],
"analyse": "phpstan analyse --memory-limit 300M", "analyse": "phpstan analyse --memory-limit 300M",
"cs-fix": "php-cs-fixer fix", "cs-fix": "PHP_CS_FIXER_IGNORE_ENV=1 php-cs-fixer fix",
"test": "phpunit --no-coverage" "test": "phpunit --no-coverage"
} }
} }

View File

@ -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);

View File

@ -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 {}
{
}

View File

@ -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);

View File

@ -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;

View File

@ -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

View File

@ -35,7 +35,7 @@ class Response implements ResponseInterface
* @param string $version Protocol version * @param string $version Protocol version
* @param null|string $reason Reason phrase (when empty a default will be used based on the status code) * @param null|string $reason Reason phrase (when empty a default will be used based on the status code)
*/ */
public function __construct($status = 200, array $headers = [], $body = null, string $version = '1.1', string $reason = null) public function __construct($status = 200, array $headers = [], $body = null, string $version = '1.1', ?string $reason = null)
{ {
// If we got nobody, defer initialization of the stream until Response::getBody() // If we got nobody, defer initialization of the stream until Response::getBody()
if ($body !== '' && $body !== null) { if ($body !== '' && $body !== null) {

View File

@ -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.

View File

@ -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);
} }

View File

@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
const CHOIR_PSR_HTTP_VERSION = '1.0.2'; const CHOIR_PSR_HTTP_VERSION = '1.0.3';
// Choir TCP 连接状态 // Choir TCP 连接状态
const CHOIR_TCP_INITIAL = 0; const CHOIR_TCP_INITIAL = 0;