Skip to content

Commit

Permalink
Merge pull request #261 from xabbuh/php-8.4
Browse files Browse the repository at this point in the history
explicitly mark nullable parameters as nullable
  • Loading branch information
dbu authored Mar 28, 2024
2 parents 664ded6 + 78f7427 commit 6b5f57f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
18 changes: 9 additions & 9 deletions src/Psr17Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ class Psr17Factory implements RequestFactoryInterface, ResponseFactoryInterface,
private $uriFactory;

public function __construct(
RequestFactoryInterface $requestFactory = null,
ResponseFactoryInterface $responseFactory = null,
ServerRequestFactoryInterface $serverRequestFactory = null,
StreamFactoryInterface $streamFactory = null,
UploadedFileFactoryInterface $uploadedFileFactory = null,
UriFactoryInterface $uriFactory = null
?RequestFactoryInterface $requestFactory = null,
?ResponseFactoryInterface $responseFactory = null,
?ServerRequestFactoryInterface $serverRequestFactory = null,
?StreamFactoryInterface $streamFactory = null,
?UploadedFileFactoryInterface $uploadedFileFactory = null,
?UriFactoryInterface $uriFactory = null
) {
$this->requestFactory = $requestFactory;
$this->responseFactory = $responseFactory;
Expand Down Expand Up @@ -98,7 +98,7 @@ public function createServerRequest(string $method, $uri, array $serverParams =
return $factory->createServerRequest(...\func_get_args());
}

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

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

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

public function createUriFromGlobals(array $server = null): UriInterface
public function createUriFromGlobals(?array $server = null): UriInterface
{
return $this->buildUriFromGlobals($this->createUri(''), $server ?? $_SERVER);
}
Expand Down
14 changes: 7 additions & 7 deletions src/Psr18Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ class Psr18Client extends Psr17Factory implements ClientInterface
private $client;

public function __construct(
ClientInterface $client = null,
RequestFactoryInterface $requestFactory = null,
ResponseFactoryInterface $responseFactory = null,
ServerRequestFactoryInterface $serverRequestFactory = null,
StreamFactoryInterface $streamFactory = null,
UploadedFileFactoryInterface $uploadedFileFactory = null,
UriFactoryInterface $uriFactory = null
?ClientInterface $client = null,
?RequestFactoryInterface $requestFactory = null,
?ResponseFactoryInterface $responseFactory = null,
?ServerRequestFactoryInterface $serverRequestFactory = null,
?StreamFactoryInterface $streamFactory = null,
?UploadedFileFactoryInterface $uploadedFileFactory = null,
?UriFactoryInterface $uriFactory = null
) {
parent::__construct($requestFactory, $responseFactory, $serverRequestFactory, $streamFactory, $uploadedFileFactory, $uriFactory);

Expand Down

0 comments on commit 6b5f57f

Please sign in to comment.