Skip to content

adjust to latest cs fixer #248

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

Merged
merged 1 commit into from
Sep 23, 2024
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
2 changes: 1 addition & 1 deletion src/Deferred.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function __construct(callable $waitCallback)
$this->onRejectedCallbacks = [];
}

public function then(callable $onFulfilled = null, callable $onRejected = null): Promise
public function then(?callable $onFulfilled = null, ?callable $onRejected = null): Promise
{
$deferred = new self($this->waitCallback);

Expand Down
2 changes: 1 addition & 1 deletion src/Exception/HttpClientNoMatchException.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ final class HttpClientNoMatchException extends TransferException
*/
private $request;

public function __construct(string $message, RequestInterface $request, \Exception $previous = null)
public function __construct(string $message, RequestInterface $request, ?\Exception $previous = null)
{
$this->request = $request;

Expand Down
2 changes: 1 addition & 1 deletion src/HttpClientPool/HttpClientPoolItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class HttpClientPoolItem implements HttpClient, HttpAsyncClient
* @param ClientInterface|HttpAsyncClient $client
* @param int|null $reenableAfter Number of seconds until this client is enabled again after an error
*/
public function __construct($client, int $reenableAfter = null)
public function __construct($client, ?int $reenableAfter = null)
{
if (!$client instanceof ClientInterface && !$client instanceof HttpAsyncClient) {
throw new \TypeError(
Expand Down
2 changes: 1 addition & 1 deletion src/HttpMethodsClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ final class HttpMethodsClient implements HttpMethodsClientInterface
/**
* @param RequestFactory|RequestFactoryInterface $requestFactory
*/
public function __construct(ClientInterface $httpClient, $requestFactory, StreamFactoryInterface $streamFactory = null)
public function __construct(ClientInterface $httpClient, $requestFactory, ?StreamFactoryInterface $streamFactory = null)
{
if (!$requestFactory instanceof RequestFactory && !$requestFactory instanceof RequestFactoryInterface) {
throw new \TypeError(
Expand Down
2 changes: 1 addition & 1 deletion src/Plugin/RedirectPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ public function guessStreamFactory(): ?StreamFactoryInterface
return new Psr17Factory();
}
if (class_exists(Utils::class)) {
return new class() implements StreamFactoryInterface {
return new class implements StreamFactoryInterface {
public function createStream(string $content = ''): StreamInterface
{
return Utils::streamFor($content);
Expand Down
2 changes: 1 addition & 1 deletion src/Plugin/RequestMatcherPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ final class RequestMatcherPlugin implements Plugin
*/
private $failurePlugin;

public function __construct(RequestMatcher $requestMatcher, ?Plugin $delegateOnMatch, Plugin $delegateOnNoMatch = null)
public function __construct(RequestMatcher $requestMatcher, ?Plugin $delegateOnMatch, ?Plugin $delegateOnNoMatch = null)
{
$this->requestMatcher = $requestMatcher;
$this->successPlugin = $delegateOnMatch;
Expand Down
2 changes: 1 addition & 1 deletion tests/HttpMethodsClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function testOptions(): void
*
* As there is no data provider in phpspec, we keep separate methods to get new mocks for each test.
*/
private function expectSendRequest(string $method, string $body = null): void
private function expectSendRequest(string $method, ?string $body = null): void
{
$response = new Response();
$this->httpClient->expects($this->once())
Expand Down
2 changes: 1 addition & 1 deletion tests/Plugin/RedirectPluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public function provideRedirections(): array
'relative-path with ./' => ['https://example.com:8000/path/', './other?query=value', 'https://example.com:8000/path/other?query=value'],
'relative-path with //' => ['https://example.com:8000/path/', 'other//sub?query=value', 'https://example.com:8000/path/other//sub?query=value'],
'relative-path redirect with only query' => ['https://example.com:8000/path', '?query=value', 'https://example.com:8000/path?query=value'],
];
];
}

/**
Expand Down
6 changes: 3 additions & 3 deletions tests/PluginClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ public function testRestartChain(PluginClient $client, string $method, string $r

public function clientAndMethodProvider()
{
$syncClient = new class() implements ClientInterface {
$syncClient = new class implements ClientInterface {
public function sendRequest(RequestInterface $request): ResponseInterface
{
return new Response();
}
};

$asyncClient = new class() implements HttpAsyncClient {
$asyncClient = new class implements HttpAsyncClient {
public function sendAsyncRequest(RequestInterface $request)
{
return new HttpFulfilledPromise(new Response());
Expand All @@ -49,7 +49,7 @@ public function sendAsyncRequest(RequestInterface $request)

$headerAppendPlugin = new HeaderAppendPlugin(['Content-Type' => 'text/html']);
$redirectPlugin = new RedirectPlugin();
$restartOncePlugin = new class() implements Plugin {
$restartOncePlugin = new class implements Plugin {
private $firstRun = true;

public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise
Expand Down