From abbb2a0a55681bad5c31bdef8019be3cfc406714 Mon Sep 17 00:00:00 2001 From: puzzledmonkey Date: Sun, 29 Sep 2024 17:42:01 +1300 Subject: [PATCH] PHP 8.4 support --- build/Burgomaster.php | 18 ++++----- .../bootstrap/Aws/Test/Integ/SmokeContext.php | 4 +- .../bootstrap/Aws/Test/UsesServiceTrait.php | 8 ++-- src/Api/ApiProvider.php | 6 +-- src/Api/ErrorParser/AbstractErrorParser.php | 4 +- src/Api/ErrorParser/JsonRpcErrorParser.php | 4 +- src/Api/ErrorParser/RestJsonErrorParser.php | 4 +- src/Api/ErrorParser/XmlErrorParser.php | 4 +- src/Api/Parser/JsonRpcParser.php | 6 +-- src/Api/Parser/QueryParser.php | 8 ++-- src/Api/Parser/RestJsonParser.php | 6 +-- src/Api/Parser/RestXmlParser.php | 6 +-- src/Api/Serializer/JsonRpcSerializer.php | 8 ++-- src/Api/Serializer/QuerySerializer.php | 2 +- src/Api/Serializer/RestJsonSerializer.php | 8 ++-- src/Api/Serializer/RestXmlSerializer.php | 8 ++-- src/Api/Service.php | 2 +- src/Api/Validator.php | 10 ++--- src/Auth/AuthSchemeResolver.php | 2 +- .../CloudSearchDomainClient.php | 2 +- src/Command.php | 8 ++-- src/EndpointV2/EndpointV2Middleware.php | 2 +- src/Exception/AwsException.php | 4 +- .../CouldNotCreateChecksumException.php | 2 +- src/Glacier/GlacierClient.php | 4 +- src/Handler/GuzzleV5/GuzzleHandler.php | 2 +- src/Handler/GuzzleV6/GuzzleHandler.php | 2 +- src/HandlerList.php | 6 +-- src/HashingStream.php | 4 +- src/IdempotencyTokenMiddleware.php | 6 +-- src/MachineLearning/MachineLearningClient.php | 2 +- src/Middleware.php | 38 +++++++++---------- src/MockHandler.php | 10 ++--- src/Multipart/AbstractUploadManager.php | 2 +- src/PresignUrlMiddleware.php | 2 +- src/ResultPaginator.php | 2 +- src/RetryMiddleware.php | 6 +-- src/Route53/Route53Client.php | 2 +- src/S3/ExpiresParsingMiddleware.php | 2 +- .../ValidateResponseChecksumResultMutator.php | 4 +- src/S3/PermanentRedirectMiddleware.php | 2 +- src/S3/PutObjectUrlMiddleware.php | 2 +- src/S3/S3Client.php | 4 +- src/S3/SSECMiddleware.php | 2 +- src/S3/StreamWrapper.php | 8 ++-- src/Script/Composer/Composer.php | 6 +-- src/Signature/S3SignatureV4.php | 2 +- src/Signature/SignatureV4.php | 2 +- src/Sqs/SqsClient.php | 2 +- src/Token/SsoTokenProvider.php | 2 +- src/TraceMiddleware.php | 4 +- .../Credentials/EcsCredentialProviderTest.php | 4 +- tests/Glacier/MultipartUploaderTest.php | 2 +- tests/Integ/SmokeContext.php | 4 +- tests/S3/Crypto/S3EncryptionClientTest.php | 2 +- .../S3EncryptionMultipartUploaderTest.php | 2 +- tests/S3/MultipartUploaderTest.php | 2 +- tests/S3/TransferTest.php | 2 +- tests/UsesServiceTrait.php | 8 ++-- ...nit_Framework_MockObject_Generator_7.4.php | 4 +- 60 files changed, 148 insertions(+), 148 deletions(-) diff --git a/build/Burgomaster.php b/build/Burgomaster.php index 32cb3145b0..b9e2279559 100644 --- a/build/Burgomaster.php +++ b/build/Burgomaster.php @@ -150,21 +150,21 @@ public function deepCopy($from, $to) * * Any LICENSE file is automatically copied. * - * @param string $sourceDir Source directory to copy from - * @param string $destDir Directory to copy the files to that is relative - * to the the stage base directory. - * @param array $extensions File extensions to copy from the $sourceDir. - * Defaults to "php" files only (e.g., ['php']). - * @param Iterator|null $files Files to copy from the source directory, each - * yielded out as an SplFileInfo object. - * Defaults to a recursive iterator of $sourceDir + * @param string $sourceDir Source directory to copy from + * @param string $destDir Directory to copy the files to that is relative + * to the the stage base directory. + * @param array $extensions File extensions to copy from the $sourceDir. + * Defaults to "php" files only (e.g., ['php']). + * @param Iterator|null $files Files to copy from the source directory, each + * yielded out as an SplFileInfo object. + * Defaults to a recursive iterator of $sourceDir * @throws \InvalidArgumentException if the source directory is invalid. */ function recursiveCopy( $sourceDir, $destDir, $extensions = array('php', 'php.gz'), - Iterator $files = null + Iterator|null $files = null ) { if (!realpath($sourceDir)) { throw new \InvalidArgumentException("$sourceDir not found"); diff --git a/features/bootstrap/Aws/Test/Integ/SmokeContext.php b/features/bootstrap/Aws/Test/Integ/SmokeContext.php index 2d03730f8b..d4fe6ef035 100644 --- a/features/bootstrap/Aws/Test/Integ/SmokeContext.php +++ b/features/bootstrap/Aws/Test/Integ/SmokeContext.php @@ -391,9 +391,9 @@ public function theResponseShouldContainA($key) * @Then the error code should be :errorCode * * @param string $errorCode - * @param PyStringNode $string + * @param PyStringNode|null $string */ - public function theErrorCodeShouldBe($errorCode, PyStringNode $string = null) + public function theErrorCodeShouldBe($errorCode, PyStringNode|null $string = null) { $this->iExpectTheResponseErrorCodeToBe($errorCode); diff --git a/features/bootstrap/Aws/Test/UsesServiceTrait.php b/features/bootstrap/Aws/Test/UsesServiceTrait.php index 41870bf848..8e66306379 100644 --- a/features/bootstrap/Aws/Test/UsesServiceTrait.php +++ b/features/bootstrap/Aws/Test/UsesServiceTrait.php @@ -59,16 +59,16 @@ private function getTestClient($service, array $args = []) * * @param AwsClientInterface $client * @param Result[]|array[] $results - * @param callable $onFulfilled Callback to invoke when the return value is fulfilled. - * @param callable $onRejected Callback to invoke when the return value is rejected. + * @param callable|null $onFulfilled Callback to invoke when the return value is fulfilled. + * @param callable|null $onRejected Callback to invoke when the return value is rejected. * * @return AwsClientInterface */ private function addMockResults( AwsClientInterface $client, array $results, - callable $onFulfilled = null, - callable $onRejected = null + callable|null $onFulfilled = null, + callable|null $onRejected = null ) { foreach ($results as &$res) { if (is_array($res)) { diff --git a/src/Api/ApiProvider.php b/src/Api/ApiProvider.php index b6a3a559d8..77a97ff3e7 100644 --- a/src/Api/ApiProvider.php +++ b/src/Api/ApiProvider.php @@ -202,10 +202,10 @@ public function __invoke($type, $service, $version) } /** - * @param string $modelsDir Directory containing service models. - * @param array $manifest The API version manifest data. + * @param string $modelsDir Directory containing service models. + * @param array|null $manifest The API version manifest data. */ - private function __construct($modelsDir, array $manifest = null) + private function __construct($modelsDir, array|null $manifest = null) { $this->manifest = $manifest; $this->modelsDir = rtrim($modelsDir, '/'); diff --git a/src/Api/ErrorParser/AbstractErrorParser.php b/src/Api/ErrorParser/AbstractErrorParser.php index efce3d466a..d85ab65117 100644 --- a/src/Api/ErrorParser/AbstractErrorParser.php +++ b/src/Api/ErrorParser/AbstractErrorParser.php @@ -21,7 +21,7 @@ abstract class AbstractErrorParser /** * @param Service $api */ - public function __construct(Service $api = null) + public function __construct(Service|null $api = null) { $this->api = $api; } @@ -47,7 +47,7 @@ protected function extractPayload( protected function populateShape( array &$data, ResponseInterface $response, - CommandInterface $command = null + CommandInterface|null $command = null ) { $data['body'] = []; diff --git a/src/Api/ErrorParser/JsonRpcErrorParser.php b/src/Api/ErrorParser/JsonRpcErrorParser.php index 8ac530e945..5d47560852 100644 --- a/src/Api/ErrorParser/JsonRpcErrorParser.php +++ b/src/Api/ErrorParser/JsonRpcErrorParser.php @@ -15,7 +15,7 @@ class JsonRpcErrorParser extends AbstractErrorParser private $parser; - public function __construct(Service $api = null, JsonParser $parser = null) + public function __construct(Service|null $api = null, JsonParser|null $parser = null) { parent::__construct($api); $this->parser = $parser ?: new JsonParser(); @@ -23,7 +23,7 @@ public function __construct(Service $api = null, JsonParser $parser = null) public function __invoke( ResponseInterface $response, - CommandInterface $command = null + CommandInterface|null $command = null ) { $data = $this->genericHandler($response); diff --git a/src/Api/ErrorParser/RestJsonErrorParser.php b/src/Api/ErrorParser/RestJsonErrorParser.php index 2f7ba818e1..751cde9fd7 100644 --- a/src/Api/ErrorParser/RestJsonErrorParser.php +++ b/src/Api/ErrorParser/RestJsonErrorParser.php @@ -16,7 +16,7 @@ class RestJsonErrorParser extends AbstractErrorParser private $parser; - public function __construct(Service $api = null, JsonParser $parser = null) + public function __construct(Service|null $api = null, JsonParser|null $parser = null) { parent::__construct($api); $this->parser = $parser ?: new JsonParser(); @@ -24,7 +24,7 @@ public function __construct(Service $api = null, JsonParser $parser = null) public function __invoke( ResponseInterface $response, - CommandInterface $command = null + CommandInterface|null $command = null ) { $data = $this->genericHandler($response); diff --git a/src/Api/ErrorParser/XmlErrorParser.php b/src/Api/ErrorParser/XmlErrorParser.php index 41f61a4d30..dfdfdd6d13 100644 --- a/src/Api/ErrorParser/XmlErrorParser.php +++ b/src/Api/ErrorParser/XmlErrorParser.php @@ -17,7 +17,7 @@ class XmlErrorParser extends AbstractErrorParser protected $parser; - public function __construct(Service $api = null, XmlParser $parser = null) + public function __construct(Service|null $api = null, XmlParser|null $parser = null) { parent::__construct($api); $this->parser = $parser ?: new XmlParser(); @@ -25,7 +25,7 @@ public function __construct(Service $api = null, XmlParser $parser = null) public function __invoke( ResponseInterface $response, - CommandInterface $command = null + CommandInterface|null $command = null ) { $code = (string) $response->getStatusCode(); diff --git a/src/Api/Parser/JsonRpcParser.php b/src/Api/Parser/JsonRpcParser.php index a33da119b8..bae70b14a1 100644 --- a/src/Api/Parser/JsonRpcParser.php +++ b/src/Api/Parser/JsonRpcParser.php @@ -17,10 +17,10 @@ class JsonRpcParser extends AbstractParser use PayloadParserTrait; /** - * @param Service $api Service description - * @param JsonParser $parser JSON body builder + * @param Service $api Service description + * @param JsonParser|null $parser JSON body builder */ - public function __construct(Service $api, JsonParser $parser = null) + public function __construct(Service $api, JsonParser|null $parser = null) { parent::__construct($api); $this->parser = $parser ?: new JsonParser(); diff --git a/src/Api/Parser/QueryParser.php b/src/Api/Parser/QueryParser.php index 50e4e3a59d..54e055fbed 100644 --- a/src/Api/Parser/QueryParser.php +++ b/src/Api/Parser/QueryParser.php @@ -19,15 +19,15 @@ class QueryParser extends AbstractParser private $honorResultWrapper; /** - * @param Service $api Service description - * @param XmlParser $xmlParser Optional XML parser - * @param bool $honorResultWrapper Set to false to disable the peeling + * @param Service $api Service description + * @param XmlParser|null $xmlParser Optional XML parser + * @param bool $honorResultWrapper Set to false to disable the peeling * back of result wrappers from the * output structure. */ public function __construct( Service $api, - XmlParser $xmlParser = null, + XmlParser|null $xmlParser = null, $honorResultWrapper = true ) { parent::__construct($api); diff --git a/src/Api/Parser/RestJsonParser.php b/src/Api/Parser/RestJsonParser.php index 76d8098901..55fabd0f82 100644 --- a/src/Api/Parser/RestJsonParser.php +++ b/src/Api/Parser/RestJsonParser.php @@ -14,10 +14,10 @@ class RestJsonParser extends AbstractRestParser use PayloadParserTrait; /** - * @param Service $api Service description - * @param JsonParser $parser JSON body builder + * @param Service $api Service description + * @param JsonParser|null $parser JSON body builder */ - public function __construct(Service $api, JsonParser $parser = null) + public function __construct(Service $api, JsonParser|null $parser = null) { parent::__construct($api); $this->parser = $parser ?: new JsonParser(); diff --git a/src/Api/Parser/RestXmlParser.php b/src/Api/Parser/RestXmlParser.php index d04429f677..502c2394b8 100644 --- a/src/Api/Parser/RestXmlParser.php +++ b/src/Api/Parser/RestXmlParser.php @@ -14,10 +14,10 @@ class RestXmlParser extends AbstractRestParser use PayloadParserTrait; /** - * @param Service $api Service description - * @param XmlParser $parser XML body parser + * @param Service $api Service description + * @param XmlParser|null $parser XML body parser */ - public function __construct(Service $api, XmlParser $parser = null) + public function __construct(Service $api, XmlParser|null $parser = null) { parent::__construct($api); $this->parser = $parser ?: new XmlParser(); diff --git a/src/Api/Serializer/JsonRpcSerializer.php b/src/Api/Serializer/JsonRpcSerializer.php index 643b5c0ff8..f596032758 100644 --- a/src/Api/Serializer/JsonRpcSerializer.php +++ b/src/Api/Serializer/JsonRpcSerializer.php @@ -29,14 +29,14 @@ class JsonRpcSerializer private $contentType; /** - * @param Service $api Service description - * @param string $endpoint Endpoint to connect to - * @param JsonBody $jsonFormatter Optional JSON formatter to use + * @param Service $api Service description + * @param string $endpoint Endpoint to connect to + * @param JsonBody|null $jsonFormatter Optional JSON formatter to use */ public function __construct( Service $api, $endpoint, - JsonBody $jsonFormatter = null + JsonBody|null $jsonFormatter = null ) { $this->endpoint = $endpoint; $this->api = $api; diff --git a/src/Api/Serializer/QuerySerializer.php b/src/Api/Serializer/QuerySerializer.php index 7d60661af9..f3dcf4e3a7 100644 --- a/src/Api/Serializer/QuerySerializer.php +++ b/src/Api/Serializer/QuerySerializer.php @@ -24,7 +24,7 @@ class QuerySerializer public function __construct( Service $api, $endpoint, - callable $paramBuilder = null + callable|null $paramBuilder = null ) { $this->api = $api; $this->endpoint = $endpoint; diff --git a/src/Api/Serializer/RestJsonSerializer.php b/src/Api/Serializer/RestJsonSerializer.php index 8a2aa993b1..a52bfc8649 100644 --- a/src/Api/Serializer/RestJsonSerializer.php +++ b/src/Api/Serializer/RestJsonSerializer.php @@ -17,14 +17,14 @@ class RestJsonSerializer extends RestSerializer private $contentType; /** - * @param Service $api Service API description - * @param string $endpoint Endpoint to connect to - * @param JsonBody $jsonFormatter Optional JSON formatter to use + * @param Service $api Service API description + * @param string $endpoint Endpoint to connect to + * @param JsonBody|null $jsonFormatter Optional JSON formatter to use */ public function __construct( Service $api, $endpoint, - JsonBody $jsonFormatter = null + JsonBody|null $jsonFormatter = null ) { parent::__construct($api, $endpoint); $this->contentType = JsonBody::getContentType($api); diff --git a/src/Api/Serializer/RestXmlSerializer.php b/src/Api/Serializer/RestXmlSerializer.php index 200b89aaa8..c2c8fc1f5d 100644 --- a/src/Api/Serializer/RestXmlSerializer.php +++ b/src/Api/Serializer/RestXmlSerializer.php @@ -13,14 +13,14 @@ class RestXmlSerializer extends RestSerializer private $xmlBody; /** - * @param Service $api Service API description - * @param string $endpoint Endpoint to connect to - * @param XmlBody $xmlBody Optional XML formatter to use + * @param Service $api Service API description + * @param string $endpoint Endpoint to connect to + * @param XmlBody|null $xmlBody Optional XML formatter to use */ public function __construct( Service $api, $endpoint, - XmlBody $xmlBody = null + XmlBody|null $xmlBody = null ) { parent::__construct($api, $endpoint); $this->xmlBody = $xmlBody ?: new XmlBody($api); diff --git a/src/Api/Service.php b/src/Api/Service.php index 52cc731776..826aefb0b4 100644 --- a/src/Api/Service.php +++ b/src/Api/Service.php @@ -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|null $api = null) { static $mapping = [ 'json' => ErrorParser\JsonRpcErrorParser::class, diff --git a/src/Api/Validator.php b/src/Api/Validator.php index a09aa2c6b5..e83a576f57 100644 --- a/src/Api/Validator.php +++ b/src/Api/Validator.php @@ -20,12 +20,12 @@ class Validator ]; /** - * @param array $constraints Associative array of constraints to enforce. - * Accepts the following keys: "required", "min", - * "max", and "pattern". If a key is not - * provided, the constraint will assume false. + * @param array|null $constraints Associative array of constraints to enforce. + * Accepts the following keys: "required", "min", + * "max", and "pattern". If a key is not + * provided, the constraint will assume false. */ - public function __construct(array $constraints = null) + public function __construct(array|null $constraints = null) { static $assumedFalseValues = [ 'required' => false, diff --git a/src/Auth/AuthSchemeResolver.php b/src/Auth/AuthSchemeResolver.php index b477468094..de26b3e032 100644 --- a/src/Auth/AuthSchemeResolver.php +++ b/src/Auth/AuthSchemeResolver.php @@ -37,7 +37,7 @@ class AuthSchemeResolver implements AuthSchemeResolverInterface public function __construct( callable $credentialProvider, - callable $tokenProvider = null, + callable|null $tokenProvider = null, array $authSchemeMap = [] ){ $this->credentialProvider = $credentialProvider; diff --git a/src/CloudSearchDomain/CloudSearchDomainClient.php b/src/CloudSearchDomain/CloudSearchDomainClient.php index a5971b7830..615dab22d1 100644 --- a/src/CloudSearchDomain/CloudSearchDomainClient.php +++ b/src/CloudSearchDomain/CloudSearchDomainClient.php @@ -51,7 +51,7 @@ private function searchByPost() return static function (callable $handler) { return function ( CommandInterface $c, - RequestInterface $r = null + RequestInterface|null $r = null ) use ($handler) { if ($c->getName() !== 'Search') { return $handler($c, $r); diff --git a/src/Command.php b/src/Command.php index b15af4df4e..5fa41013aa 100644 --- a/src/Command.php +++ b/src/Command.php @@ -22,11 +22,11 @@ class Command implements CommandInterface * * - @http: (array) Associative array of transfer options. * - * @param string $name Name of the command - * @param array $args Arguments to pass to the command - * @param HandlerList $list Handler list + * @param string $name Name of the command + * @param array $args Arguments to pass to the command + * @param HandlerList|null $list Handler list */ - public function __construct($name, array $args = [], HandlerList $list = null) + public function __construct($name, array $args = [], HandlerList|null $list = null) { $this->name = $name; $this->data = $args; diff --git a/src/EndpointV2/EndpointV2Middleware.php b/src/EndpointV2/EndpointV2Middleware.php index b1628bcb47..832020ac18 100644 --- a/src/EndpointV2/EndpointV2Middleware.php +++ b/src/EndpointV2/EndpointV2Middleware.php @@ -77,7 +77,7 @@ public function __construct( EndpointProviderV2 $endpointProvider, Service $api, array $args, - callable $credentialProvider = null + callable|null $credentialProvider = null ) { $this->nextHandler = $nextHandler; diff --git a/src/Exception/AwsException.php b/src/Exception/AwsException.php index 2873d29a35..2d17a14ef5 100644 --- a/src/Exception/AwsException.php +++ b/src/Exception/AwsException.php @@ -42,13 +42,13 @@ class AwsException extends \RuntimeException implements * @param string $message Exception message * @param CommandInterface $command * @param array $context Exception context - * @param \Exception $previous Previous exception (if any) + * @param \Exception|null $previous Previous exception (if any) */ public function __construct( $message, CommandInterface $command, array $context = [], - \Exception $previous = null + \Exception|null $previous = null ) { $this->data = isset($context['body']) ? $context['body'] : []; $this->command = $command; diff --git a/src/Exception/CouldNotCreateChecksumException.php b/src/Exception/CouldNotCreateChecksumException.php index 5c5f80efdd..79eda50658 100644 --- a/src/Exception/CouldNotCreateChecksumException.php +++ b/src/Exception/CouldNotCreateChecksumException.php @@ -9,7 +9,7 @@ class CouldNotCreateChecksumException extends \RuntimeException implements { use HasMonitoringEventsTrait; - public function __construct($algorithm, \Exception $previous = null) + public function __construct($algorithm, \Exception|null $previous = null) { $prefix = $algorithm === 'md5' ? "An" : "A"; parent::__construct("{$prefix} {$algorithm} checksum could not be " diff --git a/src/Glacier/GlacierClient.php b/src/Glacier/GlacierClient.php index a9a335c3e1..2469eb7e25 100644 --- a/src/Glacier/GlacierClient.php +++ b/src/Glacier/GlacierClient.php @@ -124,7 +124,7 @@ private function getChecksumsMiddleware() return function (callable $handler) { return function ( CommandInterface $command, - RequestInterface $request = null + RequestInterface|null $request = null ) use ($handler) { // Accept "ContentSHA256" with a lowercase "c" to match other Glacier params. if (!$command['ContentSHA256'] && $command['contentSHA256']) { @@ -195,7 +195,7 @@ private function getApiVersionMiddleware() return function (callable $handler) { return function ( CommandInterface $command, - RequestInterface $request = null + RequestInterface|null $request = null ) use ($handler) { return $handler($command, $request->withHeader( 'x-amz-glacier-version', diff --git a/src/Handler/GuzzleV5/GuzzleHandler.php b/src/Handler/GuzzleV5/GuzzleHandler.php index cbe78eb74d..13bb57f102 100644 --- a/src/Handler/GuzzleV5/GuzzleHandler.php +++ b/src/Handler/GuzzleV5/GuzzleHandler.php @@ -44,7 +44,7 @@ class GuzzleHandler /** * @param ClientInterface $client */ - public function __construct(ClientInterface $client = null) + public function __construct(ClientInterface|null $client = null) { $this->client = $client ?: new Client(); } diff --git a/src/Handler/GuzzleV6/GuzzleHandler.php b/src/Handler/GuzzleV6/GuzzleHandler.php index 5cbaed070e..5dda556732 100644 --- a/src/Handler/GuzzleV6/GuzzleHandler.php +++ b/src/Handler/GuzzleV6/GuzzleHandler.php @@ -21,7 +21,7 @@ class GuzzleHandler /** * @param ClientInterface $client */ - public function __construct(ClientInterface $client = null) + public function __construct(ClientInterface|null $client = null) { $this->client = $client ?: new Client(); } diff --git a/src/HandlerList.php b/src/HandlerList.php index fccfdb4723..3e36007140 100644 --- a/src/HandlerList.php +++ b/src/HandlerList.php @@ -59,9 +59,9 @@ class HandlerList implements \Countable ]; /** - * @param callable $handler HTTP handler. + * @param callable|null $handler HTTP handler. */ - public function __construct(callable $handler = null) + public function __construct(callable|null $handler = null) { $this->handler = $handler; } @@ -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|null $fn = null) { $this->sorted = null; $this->interposeFn = $fn; diff --git a/src/HashingStream.php b/src/HashingStream.php index 6622178e91..e1481199a0 100644 --- a/src/HashingStream.php +++ b/src/HashingStream.php @@ -23,13 +23,13 @@ class HashingStream implements StreamInterface /** * @param StreamInterface $stream Stream that is being read. * @param HashInterface $hash Hash used to calculate checksum. - * @param callable $onComplete Optional function invoked when the + * @param callable|null $onComplete Optional function invoked when the * hash calculation is completed. */ public function __construct( StreamInterface $stream, HashInterface $hash, - callable $onComplete = null + callable|null $onComplete = null ) { $this->stream = $stream; $this->hash = $hash; diff --git a/src/IdempotencyTokenMiddleware.php b/src/IdempotencyTokenMiddleware.php index dd0de426b8..0f9fc65104 100644 --- a/src/IdempotencyTokenMiddleware.php +++ b/src/IdempotencyTokenMiddleware.php @@ -37,7 +37,7 @@ class IdempotencyTokenMiddleware */ public static function wrap( Service $service, - callable $bytesGenerator = null + callable|null $bytesGenerator = null ) { return function (callable $handler) use ($service, $bytesGenerator) { return new self($handler, $service, $bytesGenerator); @@ -47,7 +47,7 @@ public static function wrap( public function __construct( callable $nextHandler, Service $service, - callable $bytesGenerator = null + callable|null $bytesGenerator = null ) { $this->bytesGenerator = $bytesGenerator ?: $this->findCompatibleRandomSource(); @@ -57,7 +57,7 @@ public function __construct( public function __invoke( CommandInterface $command, - RequestInterface $request = null + RequestInterface|null $request = null ) { $handler = $this->nextHandler; if ($this->bytesGenerator) { diff --git a/src/MachineLearning/MachineLearningClient.php b/src/MachineLearning/MachineLearningClient.php index 72e5ae625d..efe767e6dc 100644 --- a/src/MachineLearning/MachineLearningClient.php +++ b/src/MachineLearning/MachineLearningClient.php @@ -85,7 +85,7 @@ private function predictEndpoint() return static function (callable $handler) { return function ( CommandInterface $command, - RequestInterface $request = null + RequestInterface|null $request = null ) use ($handler) { if ($command->getName() === 'Predict') { $request = $request->withUri(new Uri($command['PredictEndpoint'])); diff --git a/src/Middleware.php b/src/Middleware.php index cb627efc04..a7f755d90c 100644 --- a/src/Middleware.php +++ b/src/Middleware.php @@ -38,7 +38,7 @@ public static function sourceFile( ) { return function ( CommandInterface $command, - RequestInterface $request = null) + RequestInterface|null $request = null) use ( $handler, $api, @@ -67,13 +67,13 @@ public static function sourceFile( * * @return callable */ - public static function validation(Service $api, Validator $validator = null) + public static function validation(Service $api, Validator|null $validator = null) { $validator = $validator ?: new Validator(); return function (callable $handler) use ($api, $validator) { return function ( CommandInterface $command, - RequestInterface $request = null + RequestInterface|null $request = null ) use ($api, $validator, $handler) { if ($api->isModifiedModel()) { $api = new Service( @@ -178,7 +178,7 @@ public static function tap(callable $fn) return function (callable $handler) use ($fn) { return function ( CommandInterface $command, - RequestInterface $request = null + RequestInterface|null $request = null ) use ($handler, $fn) { $fn($command, $request); return $handler($command, $request); @@ -193,19 +193,19 @@ public static function tap(callable $fn) * If no delay function is provided, a simple implementation of exponential * backoff will be utilized. * - * @param callable $decider Function that accepts the number of retries, - * a request, [result], and [exception] and - * returns true if the command is to be retried. - * @param callable $delay Function that accepts the number of retries and - * returns the number of milliseconds to delay. - * @param bool $stats Whether to collect statistics on retries and the - * associated delay. + * @param callable|null $decider Function that accepts the number of retries, + * a request, [result], and [exception] and + * returns true if the command is to be retried. + * @param callable|null $delay Function that accepts the number of retries and + * returns the number of milliseconds to delay. + * @param bool $stats Whether to collect statistics on retries and the + * associated delay. * * @return callable */ public static function retry( - callable $decider = null, - callable $delay = null, + callable|null $decider = null, + callable|null $delay = null, $stats = false ) { $decider = $decider ?: RetryMiddleware::createDefaultDecider(); @@ -253,7 +253,7 @@ public static function contentType(array $operations) return function (callable $handler) use ($operations) { return function ( CommandInterface $command, - RequestInterface $request = null + RequestInterface|null $request = null ) use ($handler, $operations) { if (!$request->hasHeader('Content-Type') && in_array($command->getName(), $operations, true) @@ -322,7 +322,7 @@ public static function history(History $history) return function (callable $handler) use ($history) { return function ( CommandInterface $command, - RequestInterface $request = null + RequestInterface|null $request = null ) use ($handler, $history) { $ticket = $history->start($command, $request); return $handler($command, $request) @@ -354,7 +354,7 @@ public static function mapRequest(callable $f) return function (callable $handler) use ($f) { return function ( CommandInterface $command, - RequestInterface $request = null + RequestInterface|null $request = null ) use ($handler, $f) { return $handler($command, $f($request)); }; @@ -375,7 +375,7 @@ public static function mapCommand(callable $f) return function (callable $handler) use ($f) { return function ( CommandInterface $command, - RequestInterface $request = null + RequestInterface|null $request = null ) use ($handler, $f) { return $handler($f($command), $request); }; @@ -395,7 +395,7 @@ public static function mapResult(callable $f) return function (callable $handler) use ($f) { return function ( CommandInterface $command, - RequestInterface $request = null + RequestInterface|null $request = null ) use ($handler, $f) { return $handler($command, $request)->then($f); }; @@ -407,7 +407,7 @@ public static function timer() return function (callable $handler) { return function ( CommandInterface $command, - RequestInterface $request = null + RequestInterface|null $request = null ) use ($handler) { $start = microtime(true); return $handler($command, $request) diff --git a/src/MockHandler.php b/src/MockHandler.php index 22b1421758..ac6246dab8 100644 --- a/src/MockHandler.php +++ b/src/MockHandler.php @@ -24,14 +24,14 @@ class MockHandler implements \Countable * {@see AwsException} objects that acts as a queue of results or * exceptions to return each time the handler is invoked. * - * @param array $resultOrQueue - * @param callable $onFulfilled Callback to invoke when the return value is fulfilled. - * @param callable $onRejected Callback to invoke when the return value is rejected. + * @param array $resultOrQueue + * @param callable|null $onFulfilled Callback to invoke when the return value is fulfilled. + * @param callable|null $onRejected Callback to invoke when the return value is rejected. */ public function __construct( array $resultOrQueue = [], - callable $onFulfilled = null, - callable $onRejected = null + callable|null $onFulfilled = null, + callable|null $onRejected = null ) { $this->queue = []; $this->onFulfilled = $onFulfilled; diff --git a/src/Multipart/AbstractUploadManager.php b/src/Multipart/AbstractUploadManager.php index e663245e0d..fbe75f281f 100644 --- a/src/Multipart/AbstractUploadManager.php +++ b/src/Multipart/AbstractUploadManager.php @@ -287,7 +287,7 @@ protected function getResultHandler(&$errors = []) return function (callable $handler) use (&$errors) { return function ( CommandInterface $command, - RequestInterface $request = null + RequestInterface|null $request = null ) use ($handler, &$errors) { return $handler($command, $request)->then( function (ResultInterface $result) use ($command) { diff --git a/src/PresignUrlMiddleware.php b/src/PresignUrlMiddleware.php index f1f41e1acc..7e172a7f2f 100644 --- a/src/PresignUrlMiddleware.php +++ b/src/PresignUrlMiddleware.php @@ -56,7 +56,7 @@ public static function wrap( }; } - public function __invoke(CommandInterface $cmd, RequestInterface $request = null) + public function __invoke(CommandInterface $cmd, RequestInterface|null $request = null) { if (in_array($cmd->getName(), $this->commandPool) && (!isset($cmd['__skip' . $cmd->getName()])) diff --git a/src/ResultPaginator.php b/src/ResultPaginator.php index 2b0c7c9af0..e9f2c09f3c 100644 --- a/src/ResultPaginator.php +++ b/src/ResultPaginator.php @@ -162,7 +162,7 @@ public function rewind() $this->result = null; } - private function createNextCommand(array $args, array $nextToken = null) + private function createNextCommand(array $args, array|null $nextToken = null) { return $this->client->getCommand($this->operation, array_merge($args, ($nextToken ?: []))); } diff --git a/src/RetryMiddleware.php b/src/RetryMiddleware.php index 4fa81e9871..8d4d7d9bcc 100644 --- a/src/RetryMiddleware.php +++ b/src/RetryMiddleware.php @@ -87,7 +87,7 @@ public static function createDefaultDecider( $retries, CommandInterface $command, RequestInterface $request, - ResultInterface $result = null, + ResultInterface|null $result = null, $error = null ) use ($maxRetries, $retryCurlErrors, $extraConfig) { // Allow command-level options to override this value @@ -210,13 +210,13 @@ public static function exponentialDelay($retries) /** * @param CommandInterface $command - * @param RequestInterface $request + * @param RequestInterface|null $request * * @return PromiseInterface */ public function __invoke( CommandInterface $command, - RequestInterface $request = null + RequestInterface|null $request = null ) { $retries = 0; $requestStats = []; diff --git a/src/Route53/Route53Client.php b/src/Route53/Route53Client.php index 60165b276c..2092613025 100644 --- a/src/Route53/Route53Client.php +++ b/src/Route53/Route53Client.php @@ -160,7 +160,7 @@ public function __construct(array $args) private function cleanIdFn() { return function (callable $handler) { - return function (CommandInterface $c, RequestInterface $r = null) use ($handler) { + return function (CommandInterface $c, RequestInterface|null $r = null) use ($handler) { foreach (['Id', 'HostedZoneId', 'DelegationSetId'] as $clean) { if ($c->hasParam($clean)) { $c[$clean] = $this->cleanId($c[$clean]); diff --git a/src/S3/ExpiresParsingMiddleware.php b/src/S3/ExpiresParsingMiddleware.php index 5ceccd1eaa..ea7bccec4b 100644 --- a/src/S3/ExpiresParsingMiddleware.php +++ b/src/S3/ExpiresParsingMiddleware.php @@ -36,7 +36,7 @@ public function __construct(callable $nextHandler) $this->nextHandler = $nextHandler; } - public function __invoke(CommandInterface $command, RequestInterface $request = null) + public function __invoke(CommandInterface $command, RequestInterface|null $request = null) { $next = $this->nextHandler; return $next($command, $request)->then( diff --git a/src/S3/Parser/ValidateResponseChecksumResultMutator.php b/src/S3/Parser/ValidateResponseChecksumResultMutator.php index d1abd995b1..1694138e27 100644 --- a/src/S3/Parser/ValidateResponseChecksumResultMutator.php +++ b/src/S3/Parser/ValidateResponseChecksumResultMutator.php @@ -37,8 +37,8 @@ public function __construct(Service $api) */ public function __invoke( ResultInterface $result, - CommandInterface $command = null, - ResponseInterface $response = null + CommandInterface|null $command = null, + ResponseInterface|null $response = null ): ResultInterface { $operation = $this->api->getOperation($command->getName()); diff --git a/src/S3/PermanentRedirectMiddleware.php b/src/S3/PermanentRedirectMiddleware.php index eb4b8e337f..53843b2432 100644 --- a/src/S3/PermanentRedirectMiddleware.php +++ b/src/S3/PermanentRedirectMiddleware.php @@ -37,7 +37,7 @@ public function __construct(callable $nextHandler) $this->nextHandler = $nextHandler; } - public function __invoke(CommandInterface $command, RequestInterface $request = null) + public function __invoke(CommandInterface $command, RequestInterface|null $request = null) { $next = $this->nextHandler; return $next($command, $request)->then( diff --git a/src/S3/PutObjectUrlMiddleware.php b/src/S3/PutObjectUrlMiddleware.php index 4ad4ebbf44..8f9d8bab56 100644 --- a/src/S3/PutObjectUrlMiddleware.php +++ b/src/S3/PutObjectUrlMiddleware.php @@ -35,7 +35,7 @@ public function __construct(callable $nextHandler) $this->nextHandler = $nextHandler; } - public function __invoke(CommandInterface $command, RequestInterface $request = null) + public function __invoke(CommandInterface $command, RequestInterface|null $request = null) { $next = $this->nextHandler; return $next($command, $request)->then( diff --git a/src/S3/S3Client.php b/src/S3/S3Client.php index eec113a1ef..fe39cbbbd1 100644 --- a/src/S3/S3Client.php +++ b/src/S3/S3Client.php @@ -628,7 +628,7 @@ private function getHeadObjectMiddleware() return static function (callable $handler) { return function ( CommandInterface $command, - RequestInterface $request = null + RequestInterface|null $request = null ) use ($handler) { if ($command->getName() === 'HeadObject' && !isset($command['@http']['decode_content']) @@ -729,7 +729,7 @@ private function getDisableExpressSessionAuthMiddleware() return function (callable $handler) { return function ( CommandInterface $command, - RequestInterface $request = null + RequestInterface|null $request = null ) use ($handler) { if (!empty($command['@context']['signature_version']) && $command['@context']['signature_version'] === 'v4-s3express' diff --git a/src/S3/SSECMiddleware.php b/src/S3/SSECMiddleware.php index 9435a209dd..608cf35a92 100644 --- a/src/S3/SSECMiddleware.php +++ b/src/S3/SSECMiddleware.php @@ -35,7 +35,7 @@ public function __construct($endpointScheme, callable $nextHandler) public function __invoke( CommandInterface $command, - RequestInterface $request = null + RequestInterface|null $request = null ) { // Allows only HTTPS connections when using SSE-C if (($command['SSECustomerKey'] || $command['CopySourceSSECustomerKey']) diff --git a/src/S3/StreamWrapper.php b/src/S3/StreamWrapper.php index a70e5cd52d..7068007a88 100644 --- a/src/S3/StreamWrapper.php +++ b/src/S3/StreamWrapper.php @@ -103,14 +103,14 @@ class StreamWrapper /** * Register the 's3://' stream wrapper * - * @param S3ClientInterface $client Client to use with the stream wrapper - * @param string $protocol Protocol to register as. - * @param CacheInterface $cache Default cache for the protocol. + * @param S3ClientInterface $client Client to use with the stream wrapper + * @param string $protocol Protocol to register as. + * @param CacheInterface|null $cache Default cache for the protocol. */ public static function register( S3ClientInterface $client, $protocol = 's3', - CacheInterface $cache = null, + CacheInterface|null $cache = null, $v2Existence = false ) { self::$useV2Existence = $v2Existence; diff --git a/src/Script/Composer/Composer.php b/src/Script/Composer/Composer.php index d2b18cb359..8f1cdec977 100644 --- a/src/Script/Composer/Composer.php +++ b/src/Script/Composer/Composer.php @@ -8,17 +8,17 @@ class Composer { - public static function removeUnusedServicesInDev(Event $event, Filesystem $filesystem = null) + public static function removeUnusedServicesInDev(Event $event, Filesystem|null $filesystem = null) { self::removeUnusedServicesWithConfig($event, $filesystem, true); } - public static function removeUnusedServices(Event $event, Filesystem $filesystem = null) + public static function removeUnusedServices(Event $event, Filesystem|null $filesystem = null) { self::removeUnusedServicesWithConfig($event, $filesystem, false); } - private static function removeUnusedServicesWithConfig(Event $event, Filesystem $filesystem = null, $isDev = false) + private static function removeUnusedServicesWithConfig(Event $event, Filesystem|null $filesystem = null, $isDev = false) { if ($isDev && !$event->isDevMode()){ return; diff --git a/src/Signature/S3SignatureV4.php b/src/Signature/S3SignatureV4.php index b47c0d5dbe..a1a6c6210f 100644 --- a/src/Signature/S3SignatureV4.php +++ b/src/Signature/S3SignatureV4.php @@ -58,7 +58,7 @@ protected function signWithV4a( CredentialsInterface $credentials, RequestInterface $request, $signingService, - SigningConfigAWS $signingConfig = null + SigningConfigAWS|null $signingConfig = null ){ $this->verifyCRTLoaded(); $credentials_provider = $this->createCRTStaticCredentialsProvider($credentials); diff --git a/src/Signature/SignatureV4.php b/src/Signature/SignatureV4.php index cf94befa77..91b70191f7 100644 --- a/src/Signature/SignatureV4.php +++ b/src/Signature/SignatureV4.php @@ -508,7 +508,7 @@ protected function signWithV4a( CredentialsInterface $credentials, RequestInterface $request, $signingService, - SigningConfigAWS $signingConfig = null + SigningConfigAWS|null $signingConfig = null ){ $this->verifyCRTLoaded(); $signingConfig = $signingConfig ?? new SigningConfigAWS([ diff --git a/src/Sqs/SqsClient.php b/src/Sqs/SqsClient.php index b54e12a79c..4327b2c9a5 100644 --- a/src/Sqs/SqsClient.php +++ b/src/Sqs/SqsClient.php @@ -169,7 +169,7 @@ private function validateMd5() return static function (callable $handler) { return function ( CommandInterface $c, - RequestInterface $r = null + RequestInterface|null $r = null ) use ($handler) { if ($c->getName() !== 'ReceiveMessage') { return $handler($c, $r); diff --git a/src/Token/SsoTokenProvider.php b/src/Token/SsoTokenProvider.php index 777fe25dcc..0506b5c11f 100644 --- a/src/Token/SsoTokenProvider.php +++ b/src/Token/SsoTokenProvider.php @@ -37,7 +37,7 @@ class SsoTokenProvider implements RefreshableTokenProviderInterface public function __construct( $profileName, $configFilePath = null, - SSOOIDCClient $ssoOidcClient = null + SSOOIDCClient|null $ssoOidcClient = null ) { $this->profileName = $this->resolveProfileName($profileName); $this->configFilePath = $this->resolveConfigFile($configFilePath); diff --git a/src/TraceMiddleware.php b/src/TraceMiddleware.php index 46f1d5198f..5ca1c5aa38 100644 --- a/src/TraceMiddleware.php +++ b/src/TraceMiddleware.php @@ -61,7 +61,7 @@ class TraceMiddleware * headers contained in this array will be replaced with the if * "scrub_auth" is set to true. */ - public function __construct(array $config = [], Service $service = null) + public function __construct(array $config = [], Service|null $service = null) { $this->config = $config + [ 'logfn' => function ($value) { echo $value; }, @@ -179,7 +179,7 @@ private function requestArray($request = null) ]); } - private function responseArray(ResponseInterface $response = null) + private function responseArray(ResponseInterface|null $response = null) { return !$response ? [] : [ 'instance' => spl_object_hash($response), diff --git a/tests/Credentials/EcsCredentialProviderTest.php b/tests/Credentials/EcsCredentialProviderTest.php index 78cf54a209..34ebcb2460 100644 --- a/tests/Credentials/EcsCredentialProviderTest.php +++ b/tests/Credentials/EcsCredentialProviderTest.php @@ -215,7 +215,7 @@ private function getCredentialArray( ]; } - private function getTestCreds($result, Response $more = null) + private function getTestCreds($result, Response|null $more = null) { $responses = []; $responses[] = new Response(200, [], Psr7\Utils::streamFor(json_encode($result))); @@ -237,7 +237,7 @@ private function getTestCreds($result, Response $more = null) return $provider(); } - private function resolveCredentials($result, Response $more = null) + private function resolveCredentials($result, Response|null $more = null) { $responses = []; $responses[] = new Response(200, [], Psr7\Utils::streamFor(json_encode($result))); diff --git a/tests/Glacier/MultipartUploaderTest.php b/tests/Glacier/MultipartUploaderTest.php index eb32d8aad1..2c7f1c128b 100644 --- a/tests/Glacier/MultipartUploaderTest.php +++ b/tests/Glacier/MultipartUploaderTest.php @@ -28,7 +28,7 @@ public static function _tearDownAfterClass() */ public function testGlacierMultipartUploadWorkflow( array $uploadOptions = [], - StreamInterface $source = null, + StreamInterface|null $source = null, $error = false ) { $client = $this->getTestClient('glacier'); diff --git a/tests/Integ/SmokeContext.php b/tests/Integ/SmokeContext.php index 2d03730f8b..d4fe6ef035 100644 --- a/tests/Integ/SmokeContext.php +++ b/tests/Integ/SmokeContext.php @@ -391,9 +391,9 @@ public function theResponseShouldContainA($key) * @Then the error code should be :errorCode * * @param string $errorCode - * @param PyStringNode $string + * @param PyStringNode|null $string */ - public function theErrorCodeShouldBe($errorCode, PyStringNode $string = null) + public function theErrorCodeShouldBe($errorCode, PyStringNode|null $string = null) { $this->iExpectTheResponseErrorCodeToBe($errorCode); diff --git a/tests/S3/Crypto/S3EncryptionClientTest.php b/tests/S3/Crypto/S3EncryptionClientTest.php index 6eb53f30fa..4b3cce6e3a 100644 --- a/tests/S3/Crypto/S3EncryptionClientTest.php +++ b/tests/S3/Crypto/S3EncryptionClientTest.php @@ -254,7 +254,7 @@ public function testPutObjectWithOperationInstructionFileSuffix() public function testPutObjectValidatesCipher( $cipher, $exception = null, - callable $skipCheck = null + callable|null $skipCheck = null ) { if ($skipCheck && $skipCheck()) { $this->markTestSkipped( diff --git a/tests/S3/Crypto/S3EncryptionMultipartUploaderTest.php b/tests/S3/Crypto/S3EncryptionMultipartUploaderTest.php index 328cf8b46c..d8e949f711 100644 --- a/tests/S3/Crypto/S3EncryptionMultipartUploaderTest.php +++ b/tests/S3/Crypto/S3EncryptionMultipartUploaderTest.php @@ -251,7 +251,7 @@ public function testPutObjectWithClientInstructionFileSuffix() public function testPutObjectValidatesCipher( $cipher, $exception = null, - callable $skipCheck = null + callable|null $skipCheck = null ) { if ($skipCheck && $skipCheck()) { $this->markTestSkipped( diff --git a/tests/S3/MultipartUploaderTest.php b/tests/S3/MultipartUploaderTest.php index 6abfaa8277..abbda426f8 100644 --- a/tests/S3/MultipartUploaderTest.php +++ b/tests/S3/MultipartUploaderTest.php @@ -32,7 +32,7 @@ public static function tear_down_after_class() public function testS3MultipartUploadWorkflow( array $clientOptions = [], array $uploadOptions = [], - StreamInterface $source = null, + StreamInterface|null $source = null, $error = false ) { $client = $this->getTestClient('s3', $clientOptions); diff --git a/tests/S3/TransferTest.php b/tests/S3/TransferTest.php index 170d20c4d2..2dc3171cf9 100644 --- a/tests/S3/TransferTest.php +++ b/tests/S3/TransferTest.php @@ -407,7 +407,7 @@ private function mockResult(callable $fn) return function (callable $handler) use ($fn) { return function ( CommandInterface $command, - RequestInterface $request = null + RequestInterface|null $request = null ) use ($handler, $fn) { return Promise\Create::promiseFor($fn($command, $request)); }; diff --git a/tests/UsesServiceTrait.php b/tests/UsesServiceTrait.php index 41870bf848..8e66306379 100644 --- a/tests/UsesServiceTrait.php +++ b/tests/UsesServiceTrait.php @@ -59,16 +59,16 @@ private function getTestClient($service, array $args = []) * * @param AwsClientInterface $client * @param Result[]|array[] $results - * @param callable $onFulfilled Callback to invoke when the return value is fulfilled. - * @param callable $onRejected Callback to invoke when the return value is rejected. + * @param callable|null $onFulfilled Callback to invoke when the return value is fulfilled. + * @param callable|null $onRejected Callback to invoke when the return value is rejected. * * @return AwsClientInterface */ private function addMockResults( AwsClientInterface $client, array $results, - callable $onFulfilled = null, - callable $onRejected = null + callable|null $onFulfilled = null, + callable|null $onRejected = null ) { foreach ($results as &$res) { if (is_array($res)) { diff --git a/tests/bootstrap/PHPUnit_Framework_MockObject_Generator_7.4.php b/tests/bootstrap/PHPUnit_Framework_MockObject_Generator_7.4.php index a326dd06cb..f08ac0f4d7 100644 --- a/tests/bootstrap/PHPUnit_Framework_MockObject_Generator_7.4.php +++ b/tests/bootstrap/PHPUnit_Framework_MockObject_Generator_7.4.php @@ -535,7 +535,7 @@ public function getObjectForTrait($traitName, array $arguments = [], $traitClass /** * @param array|string $type - * @param array $methods + * @param array|null $methods * @param string $mockClassName * @param bool $callOriginalClone * @param bool $callAutoload @@ -544,7 +544,7 @@ public function getObjectForTrait($traitName, array $arguments = [], $traitClass * * @return array */ - public function generate($type, array $methods = null, $mockClassName = '', $callOriginalClone = true, $callAutoload = true, $cloneArguments = true, $callOriginalMethods = false) + public function generate($type, array|null $methods = null, $mockClassName = '', $callOriginalClone = true, $callAutoload = true, $cloneArguments = true, $callOriginalMethods = false) { if (is_array($type)) { sort($type);