Skip to content

Commit d2cfa14

Browse files
authored
Update php-cs-fixer rules (#754)
Add rules to PHP CS Fixer to modify implicit null parameters to explicitly null.
1 parent 53d0d69 commit d2cfa14

File tree

1,057 files changed

+1063
-1061
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,057 files changed

+1063
-1061
lines changed

.php-cs-fixer.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,8 @@
157157
'no_whitespace_in_blank_line' => true,
158158
'non_printable_character' => true,
159159
'normalize_index_brace' => true,
160+
'nullable_type_declaration' => ['syntax' => 'question_mark'],
161+
'nullable_type_declaration_for_default_null_value' => true,
160162
'object_operator_without_whitespace' => true,
161163
'ordered_class_elements' => [
162164
'order' => [

src/AmazonPHP/SellingPartner/Configuration.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ public function __construct(
2929
private string $accessKey,
3030
private string $secretKey,
3131
private ?string $securityToken = null,
32-
Extensions $extensions = null,
33-
LoggerConfiguration $loggerConfiguration = null
32+
?Extensions $extensions = null,
33+
?LoggerConfiguration $loggerConfiguration = null
3434
) {
3535
// https://github.com/amzn/selling-partner-api-docs/blob/main/guides/en-US/developer-guide/SellingPartnerApiDeveloperGuide.md#include-a-user-agent-header-in-all-requests
3636
$this->userAgent = 'Library amazon-php/sp-api-php (language=PHP ' . \phpversion() . '; Platform=' . \php_uname('s') . ' ' . \php_uname('r') . ' ' . \php_uname('m') . ')';
@@ -158,7 +158,7 @@ public function setLogLevel(string $api, string $operationMethod, string $logLev
158158
return $this;
159159
}
160160

161-
public function setSkipLogging(string $api, string $operation = null) : self
161+
public function setSkipLogging(string $api, ?string $operation = null) : self
162162
{
163163
if ($operation !== null) {
164164
$this->loggerConfiguration->skipAPIOperation($api, $operation);
@@ -171,7 +171,7 @@ public function setSkipLogging(string $api, string $operation = null) : self
171171
return $this;
172172
}
173173

174-
public function setEnableLogging(string $api, string $operation = null) : self
174+
public function setEnableLogging(string $api, ?string $operation = null) : self
175175
{
176176
if ($operation !== null) {
177177
$this->loggerConfiguration->enableAPIOperation($api, $operation);
@@ -184,7 +184,7 @@ public function setEnableLogging(string $api, string $operation = null) : self
184184
return $this;
185185
}
186186

187-
public function loggingEnabled(string $api, string $operation = null) : bool
187+
public function loggingEnabled(string $api, ?string $operation = null) : bool
188188
{
189189
return !$this->loggerConfiguration->isSkipped($api, $operation);
190190
}

src/AmazonPHP/SellingPartner/Configuration/LoggerConfiguration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public function enableAPIOperation(string $api, string $operation) : self
124124
return $this;
125125
}
126126

127-
public function isSkipped(string $api, string|null $operation = null) : bool
127+
public function isSkipped(string $api, ?string $operation = null) : bool
128128
{
129129
if (\in_array($api, $this->skippedAPIs, true)) {
130130
return true;

src/AmazonPHP/SellingPartner/Exception/ApiException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ final class ApiException extends Exception
1717
* @param null|string[] $responseHeaders HTTP response header
1818
* @param null|\stdClass|string $responseBody HTTP decoded body of the server response either as \stdClass or string
1919
*/
20-
public function __construct(string $message = '', int $code = 0, protected ?array $responseHeaders = null, protected $responseBody = null, \Throwable $previousException = null)
20+
public function __construct(string $message = '', int $code = 0, protected ?array $responseHeaders = null, protected $responseBody = null, ?\Throwable $previousException = null)
2121
{
2222
parent::__construct($message, $code, $previousException);
2323
}

src/AmazonPHP/SellingPartner/Model/APlus/AplusPaginatedResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ class AplusPaginatedResponse implements \ArrayAccess, \JsonSerializable, \String
100100
* @param null|mixed[] $data Associated array of property values
101101
* initializing the model
102102
*/
103-
public function __construct(array $data = null)
103+
public function __construct(?array $data = null)
104104
{
105105
$this->container['warnings'] = $data['warnings'] ?? null;
106106
$this->container['next_page_token'] = $data['next_page_token'] ?? null;

src/AmazonPHP/SellingPartner/Model/APlus/AplusResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ class AplusResponse implements \ArrayAccess, \JsonSerializable, \Stringable, Mod
9595
* @param null|mixed[] $data Associated array of property values
9696
* initializing the model
9797
*/
98-
public function __construct(array $data = null)
98+
public function __construct(?array $data = null)
9999
{
100100
$this->container['warnings'] = $data['warnings'] ?? null;
101101
}

src/AmazonPHP/SellingPartner/Model/APlus/AsinMetadata.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class AsinMetadata implements \ArrayAccess, \JsonSerializable, \Stringable, Mode
120120
* @param null|mixed[] $data Associated array of property values
121121
* initializing the model
122122
*/
123-
public function __construct(array $data = null)
123+
public function __construct(?array $data = null)
124124
{
125125
$this->container['asin'] = $data['asin'] ?? null;
126126
$this->container['badge_set'] = $data['badge_set'] ?? null;

src/AmazonPHP/SellingPartner/Model/APlus/ContentDocument.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class ContentDocument implements \ArrayAccess, \JsonSerializable, \Stringable, M
115115
* @param null|mixed[] $data Associated array of property values
116116
* initializing the model
117117
*/
118-
public function __construct(array $data = null)
118+
public function __construct(?array $data = null)
119119
{
120120
$this->container['name'] = $data['name'] ?? null;
121121
$this->container['content_type'] = $data['content_type'] ?? null;

src/AmazonPHP/SellingPartner/Model/APlus/ContentMetadata.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class ContentMetadata implements \ArrayAccess, \JsonSerializable, \Stringable, M
115115
* @param null|mixed[] $data Associated array of property values
116116
* initializing the model
117117
*/
118-
public function __construct(array $data = null)
118+
public function __construct(?array $data = null)
119119
{
120120
$this->container['name'] = $data['name'] ?? null;
121121
$this->container['marketplace_id'] = $data['marketplace_id'] ?? null;

src/AmazonPHP/SellingPartner/Model/APlus/ContentMetadataRecord.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ class ContentMetadataRecord implements \ArrayAccess, \JsonSerializable, \Stringa
100100
* @param null|mixed[] $data Associated array of property values
101101
* initializing the model
102102
*/
103-
public function __construct(array $data = null)
103+
public function __construct(?array $data = null)
104104
{
105105
$this->container['content_reference_key'] = $data['content_reference_key'] ?? null;
106106
$this->container['content_metadata'] = $data['content_metadata'] ?? null;

0 commit comments

Comments
 (0)