Skip to content

Commit 6b5f57f

Browse files
authored
Merge pull request #261 from xabbuh/php-8.4
explicitly mark nullable parameters as nullable
2 parents 664ded6 + 78f7427 commit 6b5f57f

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

src/Psr17Factory.php

+9-9
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@ class Psr17Factory implements RequestFactoryInterface, ResponseFactoryInterface,
4949
private $uriFactory;
5050

5151
public function __construct(
52-
RequestFactoryInterface $requestFactory = null,
53-
ResponseFactoryInterface $responseFactory = null,
54-
ServerRequestFactoryInterface $serverRequestFactory = null,
55-
StreamFactoryInterface $streamFactory = null,
56-
UploadedFileFactoryInterface $uploadedFileFactory = null,
57-
UriFactoryInterface $uriFactory = null
52+
?RequestFactoryInterface $requestFactory = null,
53+
?ResponseFactoryInterface $responseFactory = null,
54+
?ServerRequestFactoryInterface $serverRequestFactory = null,
55+
?StreamFactoryInterface $streamFactory = null,
56+
?UploadedFileFactoryInterface $uploadedFileFactory = null,
57+
?UriFactoryInterface $uriFactory = null
5858
) {
5959
$this->requestFactory = $requestFactory;
6060
$this->responseFactory = $responseFactory;
@@ -98,7 +98,7 @@ public function createServerRequest(string $method, $uri, array $serverParams =
9898
return $factory->createServerRequest(...\func_get_args());
9999
}
100100

101-
public function createServerRequestFromGlobals(array $server = null, array $get = null, array $post = null, array $cookie = null, array $files = null, StreamInterface $body = null): ServerRequestInterface
101+
public function createServerRequestFromGlobals(?array $server = null, ?array $get = null, ?array $post = null, ?array $cookie = null, ?array $files = null, ?StreamInterface $body = null): ServerRequestInterface
102102
{
103103
$server = $server ?? $_SERVER;
104104
$request = $this->createServerRequest($server['REQUEST_METHOD'] ?? 'GET', $this->createUriFromGlobals($server), $server);
@@ -134,7 +134,7 @@ public function createStreamFromResource($resource): StreamInterface
134134
return $factory->createStreamFromResource($resource);
135135
}
136136

137-
public function createUploadedFile(StreamInterface $stream, int $size = null, int $error = \UPLOAD_ERR_OK, string $clientFilename = null, string $clientMediaType = null): UploadedFileInterface
137+
public function createUploadedFile(StreamInterface $stream, ?int $size = null, int $error = \UPLOAD_ERR_OK, ?string $clientFilename = null, ?string $clientMediaType = null): UploadedFileInterface
138138
{
139139
$factory = $this->uploadedFileFactory ?? $this->setFactory(Psr17FactoryDiscovery::findUploadedFileFactory());
140140

@@ -148,7 +148,7 @@ public function createUri(string $uri = ''): UriInterface
148148
return $factory->createUri(...\func_get_args());
149149
}
150150

151-
public function createUriFromGlobals(array $server = null): UriInterface
151+
public function createUriFromGlobals(?array $server = null): UriInterface
152152
{
153153
return $this->buildUriFromGlobals($this->createUri(''), $server ?? $_SERVER);
154154
}

src/Psr18Client.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ class Psr18Client extends Psr17Factory implements ClientInterface
2525
private $client;
2626

2727
public function __construct(
28-
ClientInterface $client = null,
29-
RequestFactoryInterface $requestFactory = null,
30-
ResponseFactoryInterface $responseFactory = null,
31-
ServerRequestFactoryInterface $serverRequestFactory = null,
32-
StreamFactoryInterface $streamFactory = null,
33-
UploadedFileFactoryInterface $uploadedFileFactory = null,
34-
UriFactoryInterface $uriFactory = null
28+
?ClientInterface $client = null,
29+
?RequestFactoryInterface $requestFactory = null,
30+
?ResponseFactoryInterface $responseFactory = null,
31+
?ServerRequestFactoryInterface $serverRequestFactory = null,
32+
?StreamFactoryInterface $streamFactory = null,
33+
?UploadedFileFactoryInterface $uploadedFileFactory = null,
34+
?UriFactoryInterface $uriFactory = null
3535
) {
3636
parent::__construct($requestFactory, $responseFactory, $serverRequestFactory, $streamFactory, $uploadedFileFactory, $uriFactory);
3737

0 commit comments

Comments
 (0)