Compare commits

..

No commits in common. "master" and "1.0.2" have entirely different histories.

12 changed files with 30 additions and 12 deletions

6
.github/FUNDING.yml vendored
View File

@ -1,12 +1,16 @@
# These are supported funding model platforms
github: crazywhalecc # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
buymeacoffee: crazywhalecc
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon 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
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
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']

View File

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

View File

@ -32,11 +32,17 @@ class CurlClient implements ClientInterface, TimeoutInterface
$this->curl_options = $curl_options;
}
/**
* {@inheritDoc}
*/
public function setTimeout(int $timeout)
{
$this->curl_options[CURLOPT_TIMEOUT_MS] = $timeout;
}
/**
* {@inheritDoc}
*/
public function sendRequest(RequestInterface $request): ResponseInterface
{
$handle = $this->createHandle($request);

View File

@ -6,4 +6,6 @@ namespace Choir\Http\Client\Exception;
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;
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;
parent::__construct($message, $code, $previous);

View File

@ -11,12 +11,15 @@ class RequestException extends \Exception implements RequestExceptionInterface
{
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;
parent::__construct($message, $code, $previous);
}
/**
* {@inheritDoc}
*/
public function getRequest(): RequestInterface
{
return $this->request;

View File

@ -44,6 +44,7 @@ class StreamClient implements TimeoutInterface, ClientInterface
}
/**
* {@inheritdoc}
* @throws \Exception
*/
public function sendRequest(RequestInterface $request): ResponseInterface

View File

@ -35,7 +35,7 @@ class Response implements ResponseInterface
* @param string $version Protocol version
* @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 ($body !== '' && $body !== null) {

View File

@ -38,7 +38,9 @@ class Stream implements StreamInterface
private ?int $size = null;
private function __construct() {}
private function __construct()
{
}
/**
* Closes the stream when the destructed.

View File

@ -22,7 +22,7 @@ class UploadedFile implements UploadedFileInterface
* @var null|string
*/
private $file;
private string $key;
private bool $moved = false;
@ -53,7 +53,7 @@ class UploadedFile implements UploadedFileInterface
$this->file = $this->fileinfo['tmp_name'];
}
}
public function getKey(): string
{
return $this->key;

View File

@ -26,7 +26,7 @@ class FrameFactory
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);
}

View File

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