Skip to content
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

fix: PHP 8.4 deprecations with implicit nullable parameters #2995

Merged
merged 2 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,3 @@
}
}
}

2 changes: 1 addition & 1 deletion features/bootstrap/Aws/Test/Integ/SmokeContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ public function theResponseShouldContainA($key)
* @param string $errorCode
* @param PyStringNode $string
*/
public function theErrorCodeShouldBe($errorCode, PyStringNode $string = null)
public function theErrorCodeShouldBe($errorCode, ?PyStringNode $string = null)
{
$this->iExpectTheResponseErrorCodeToBe($errorCode);

Expand Down
4 changes: 2 additions & 2 deletions features/bootstrap/Aws/Test/UsesServiceTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ private function getTestClient($service, array $args = [])
private function addMockResults(
AwsClientInterface $client,
array $results,
callable $onFulfilled = null,
callable $onRejected = null
?callable $onFulfilled = null,
?callable $onRejected = null
) {
foreach ($results as &$res) {
if (is_array($res)) {
Expand Down
2 changes: 1 addition & 1 deletion src/Api/ApiProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ public function __invoke($type, $service, $version)
* @param string $modelsDir Directory containing service models.
* @param array $manifest The API version manifest data.
*/
private function __construct($modelsDir, array $manifest = null)
private function __construct($modelsDir, ?array $manifest = null)
{
$this->manifest = $manifest;
$this->modelsDir = rtrim($modelsDir, '/');
Expand Down
4 changes: 2 additions & 2 deletions src/Api/ErrorParser/AbstractErrorParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ abstract class AbstractErrorParser
/**
* @param Service $api
*/
public function __construct(Service $api = null)
public function __construct(?Service $api = null)
{
$this->api = $api;
}
Expand All @@ -47,7 +47,7 @@ protected function extractPayload(
protected function populateShape(
array &$data,
ResponseInterface $response,
CommandInterface $command = null
?CommandInterface $command = null
) {
$data['body'] = [];

Expand Down
4 changes: 2 additions & 2 deletions src/Api/ErrorParser/JsonRpcErrorParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ class JsonRpcErrorParser extends AbstractErrorParser

private $parser;

public function __construct(Service $api = null, JsonParser $parser = null)
public function __construct(?Service $api = null, ?JsonParser $parser = null)
{
parent::__construct($api);
$this->parser = $parser ?: new JsonParser();
}

public function __invoke(
ResponseInterface $response,
CommandInterface $command = null
?CommandInterface $command = null
) {
$data = $this->genericHandler($response);

Expand Down
4 changes: 2 additions & 2 deletions src/Api/ErrorParser/RestJsonErrorParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ class RestJsonErrorParser extends AbstractErrorParser

private $parser;

public function __construct(Service $api = null, JsonParser $parser = null)
public function __construct(?Service $api = null, ?JsonParser $parser = null)
{
parent::__construct($api);
$this->parser = $parser ?: new JsonParser();
}

public function __invoke(
ResponseInterface $response,
CommandInterface $command = null
?CommandInterface $command = null
) {
$data = $this->genericHandler($response);

Expand Down
4 changes: 2 additions & 2 deletions src/Api/ErrorParser/XmlErrorParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ class XmlErrorParser extends AbstractErrorParser

protected $parser;

public function __construct(Service $api = null, XmlParser $parser = null)
public function __construct(?Service $api = null, ?XmlParser $parser = null)
{
parent::__construct($api);
$this->parser = $parser ?: new XmlParser();
}

public function __invoke(
ResponseInterface $response,
CommandInterface $command = null
?CommandInterface $command = null
) {
$code = (string) $response->getStatusCode();

Expand Down
2 changes: 1 addition & 1 deletion src/Api/Parser/JsonRpcParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class JsonRpcParser extends AbstractParser
* @param Service $api Service description
* @param JsonParser $parser JSON body builder
*/
public function __construct(Service $api, JsonParser $parser = null)
public function __construct(Service $api, ?JsonParser $parser = null)
{
parent::__construct($api);
$this->parser = $parser ?: new JsonParser();
Expand Down
2 changes: 1 addition & 1 deletion src/Api/Parser/QueryParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class QueryParser extends AbstractParser
*/
public function __construct(
Service $api,
XmlParser $xmlParser = null,
?XmlParser $xmlParser = null,
$honorResultWrapper = true
) {
parent::__construct($api);
Expand Down
2 changes: 1 addition & 1 deletion src/Api/Parser/RestJsonParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class RestJsonParser extends AbstractRestParser
* @param Service $api Service description
* @param JsonParser $parser JSON body builder
*/
public function __construct(Service $api, JsonParser $parser = null)
public function __construct(Service $api, ?JsonParser $parser = null)
{
parent::__construct($api);
$this->parser = $parser ?: new JsonParser();
Expand Down
2 changes: 1 addition & 1 deletion src/Api/Parser/RestXmlParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class RestXmlParser extends AbstractRestParser
* @param Service $api Service description
* @param XmlParser $parser XML body parser
*/
public function __construct(Service $api, XmlParser $parser = null)
public function __construct(Service $api, ?XmlParser $parser = null)
{
parent::__construct($api);
$this->parser = $parser ?: new XmlParser();
Expand Down
2 changes: 1 addition & 1 deletion src/Api/Serializer/JsonRpcSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class JsonRpcSerializer
public function __construct(
Service $api,
$endpoint,
JsonBody $jsonFormatter = null
?JsonBody $jsonFormatter = null
) {
$this->endpoint = $endpoint;
$this->api = $api;
Expand Down
2 changes: 1 addition & 1 deletion src/Api/Serializer/QuerySerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class QuerySerializer
public function __construct(
Service $api,
$endpoint,
callable $paramBuilder = null
?callable $paramBuilder = null
) {
$this->api = $api;
$this->endpoint = $endpoint;
Expand Down
2 changes: 1 addition & 1 deletion src/Api/Serializer/RestJsonSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class RestJsonSerializer extends RestSerializer
public function __construct(
Service $api,
$endpoint,
JsonBody $jsonFormatter = null
?JsonBody $jsonFormatter = null
) {
parent::__construct($api, $endpoint);
$this->contentType = JsonBody::getContentType($api);
Expand Down
2 changes: 1 addition & 1 deletion src/Api/Serializer/RestXmlSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class RestXmlSerializer extends RestSerializer
public function __construct(
Service $api,
$endpoint,
XmlBody $xmlBody = null
?XmlBody $xmlBody = null
) {
parent::__construct($api, $endpoint);
$this->xmlBody = $xmlBody ?: new XmlBody($api);
Expand Down
2 changes: 1 addition & 1 deletion src/Api/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public static function createSerializer(Service $api, $endpoint)
* @return callable
* @throws \UnexpectedValueException
*/
public static function createErrorParser($protocol, Service $api = null)
public static function createErrorParser($protocol, ?Service $api = null)
{
static $mapping = [
'json' => ErrorParser\JsonRpcErrorParser::class,
Expand Down
2 changes: 1 addition & 1 deletion src/Api/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Validator
* "max", and "pattern". If a key is not
* provided, the constraint will assume false.
*/
public function __construct(array $constraints = null)
public function __construct(?array $constraints = null)
{
static $assumedFalseValues = [
'required' => false,
Expand Down
2 changes: 1 addition & 1 deletion src/Auth/AuthSchemeResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class AuthSchemeResolver implements AuthSchemeResolverInterface

public function __construct(
callable $credentialProvider,
callable $tokenProvider = null,
?callable $tokenProvider = null,
array $authSchemeMap = []
){
$this->credentialProvider = $credentialProvider;
Expand Down
2 changes: 1 addition & 1 deletion src/CloudSearchDomain/CloudSearchDomainClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ private function searchByPost()
return static function (callable $handler) {
return function (
CommandInterface $c,
RequestInterface $r = null
?RequestInterface $r = null
) use ($handler) {
if ($c->getName() !== 'Search') {
return $handler($c, $r);
Expand Down
2 changes: 1 addition & 1 deletion src/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Command implements CommandInterface
* @param array $args Arguments to pass to the command
* @param HandlerList $list Handler list
*/
public function __construct($name, array $args = [], HandlerList $list = null)
public function __construct($name, array $args = [], ?HandlerList $list = null)
{
$this->name = $name;
$this->data = $args;
Expand Down
2 changes: 1 addition & 1 deletion src/EndpointV2/EndpointV2Middleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function __construct(
EndpointProviderV2 $endpointProvider,
Service $api,
array $args,
callable $credentialProvider = null
?callable $credentialProvider = null
)
{
$this->nextHandler = $nextHandler;
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/AwsException.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function __construct(
$message,
CommandInterface $command,
array $context = [],
\Exception $previous = null
?\Exception $previous = null
) {
$this->data = isset($context['body']) ? $context['body'] : [];
$this->command = $command;
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/CouldNotCreateChecksumException.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class CouldNotCreateChecksumException extends \RuntimeException implements
{
use HasMonitoringEventsTrait;

public function __construct($algorithm, \Exception $previous = null)
public function __construct($algorithm, ?\Exception $previous = null)
{
$prefix = $algorithm === 'md5' ? "An" : "A";
parent::__construct("{$prefix} {$algorithm} checksum could not be "
Expand Down
4 changes: 2 additions & 2 deletions src/Glacier/GlacierClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ private function getChecksumsMiddleware()
return function (callable $handler) {
return function (
CommandInterface $command,
RequestInterface $request = null
?RequestInterface $request = null
) use ($handler) {
// Accept "ContentSHA256" with a lowercase "c" to match other Glacier params.
if (!$command['ContentSHA256'] && $command['contentSHA256']) {
Expand Down Expand Up @@ -195,7 +195,7 @@ private function getApiVersionMiddleware()
return function (callable $handler) {
return function (
CommandInterface $command,
RequestInterface $request = null
?RequestInterface $request = null
) use ($handler) {
return $handler($command, $request->withHeader(
'x-amz-glacier-version',
Expand Down
2 changes: 1 addition & 1 deletion src/Handler/GuzzleV5/GuzzleHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class GuzzleHandler
/**
* @param ClientInterface $client
*/
public function __construct(ClientInterface $client = null)
public function __construct(?ClientInterface $client = null)
{
$this->client = $client ?: new Client();
}
Expand Down
2 changes: 1 addition & 1 deletion src/Handler/GuzzleV6/GuzzleHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class GuzzleHandler
/**
* @param ClientInterface $client
*/
public function __construct(ClientInterface $client = null)
public function __construct(?ClientInterface $client = null)
{
$this->client = $client ?: new Client();
}
Expand Down
4 changes: 2 additions & 2 deletions src/HandlerList.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class HandlerList implements \Countable
/**
* @param callable $handler HTTP handler.
*/
public function __construct(callable $handler = null)
public function __construct(?callable $handler = null)
{
$this->handler = $handler;
}
Expand Down Expand Up @@ -277,7 +277,7 @@ public function remove($nameOrInstance)
*
* @param callable|null $fn Pass null to remove any previously set function
*/
public function interpose(callable $fn = null)
public function interpose(?callable $fn = null)
{
$this->sorted = null;
$this->interposeFn = $fn;
Expand Down
2 changes: 1 addition & 1 deletion src/HashingStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class HashingStream implements StreamInterface
public function __construct(
StreamInterface $stream,
HashInterface $hash,
callable $onComplete = null
?callable $onComplete = null
) {
$this->stream = $stream;
$this->hash = $hash;
Expand Down
6 changes: 3 additions & 3 deletions src/IdempotencyTokenMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class IdempotencyTokenMiddleware
*/
public static function wrap(
Service $service,
callable $bytesGenerator = null
?callable $bytesGenerator = null
) {
return function (callable $handler) use ($service, $bytesGenerator) {
return new self($handler, $service, $bytesGenerator);
Expand All @@ -47,7 +47,7 @@ public static function wrap(
public function __construct(
callable $nextHandler,
Service $service,
callable $bytesGenerator = null
?callable $bytesGenerator = null
) {
$this->bytesGenerator = $bytesGenerator
?: $this->findCompatibleRandomSource();
Expand All @@ -57,7 +57,7 @@ public function __construct(

public function __invoke(
CommandInterface $command,
RequestInterface $request = null
?RequestInterface $request = null
) {
$handler = $this->nextHandler;
if ($this->bytesGenerator) {
Expand Down
2 changes: 1 addition & 1 deletion src/MachineLearning/MachineLearningClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ private function predictEndpoint()
return static function (callable $handler) {
return function (
CommandInterface $command,
RequestInterface $request = null
?RequestInterface $request = null
) use ($handler) {
if ($command->getName() === 'Predict') {
$request = $request->withUri(new Uri($command['PredictEndpoint']));
Expand Down
Loading