Skip to content

Commit 5c43c9f

Browse files
authored
Upgrade phpstan (#1458)
* Upgrade phpstan * Remove dead generated code The isset check ensures that this value is not null or missing. * Remove dead code * Fix the case when calling the fixCs method
1 parent 2ccb286 commit 5c43c9f

File tree

7 files changed

+10
-10
lines changed

7 files changed

+10
-10
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"nette/php-generator": "^3.6.4",
3131
"nette/utils": "^3.0",
3232
"nyholm/symfony-bundle-test": "^2.0",
33-
"phpstan/phpstan": "1.6.0",
33+
"phpstan/phpstan": "1.10.21",
3434
"psr/cache": "^1.0 || ^2.0 || ^3.0",
3535
"swaggest/json-diff": "^3.7",
3636
"symfony/cache": "^4.4 || ^5.0 || ^6.0 || ^7.0",

src/CodeGenerator/src/Command/GenerateCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ private function generateService(SymfonyStyle $io, InputInterface $input, array
295295
$this->composerWriter->setRequirements($namespace, $this->generator->getUpdatedRequirements(), $input->getOption('all') && 'Sts' !== $serviceName);
296296

297297
if (!$input->getOption('raw')) {
298-
$this->fixCS($clientClass, $io);
298+
$this->fixCs($clientClass, $io);
299299
}
300300

301301
return $manifest;

src/CodeGenerator/src/Generator/InputGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ public function generate(Operation $operation): ClassName
193193
$constructorBody .= strtr('
194194
if (isset($input["NAME"])) {
195195
$this->PROPERTY = [];
196-
foreach ($input["NAME"] ?? [] as $key => $item) {
196+
foreach ($input["NAME"] as $key => $item) {
197197
$this->PROPERTY[$key] = array_map([CLASS::class, "create"], $item);
198198
}
199199
}

src/Integration/Laravel/Cache/src/ServiceProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ private function getClosure(): \Closure
3737
return \Closure::fromCallable(function ($app, array $config) {
3838
$clientConfig = [];
3939
if (isset($config['key']) && isset($config['secret'])) {
40-
$clientConfig['accessKeyId'] = $config['key'] ?? null;
41-
$clientConfig['accessKeySecret'] = $config['secret'] ?? null;
40+
$clientConfig['accessKeyId'] = $config['key'];
41+
$clientConfig['accessKeySecret'] = $config['secret'];
4242
$clientConfig['sessionToken'] = $config['token'] ?? null;
4343
}
4444

src/Integration/Laravel/Mail/src/ServiceProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ public function createTransport(array $config): AsyncAwsSesTransport
2323
{
2424
$clientConfig = [];
2525
if (isset($config['key']) && isset($config['secret'])) {
26-
$clientConfig['accessKeyId'] = $config['key'] ?? null;
27-
$clientConfig['accessKeySecret'] = $config['secret'] ?? null;
26+
$clientConfig['accessKeyId'] = $config['key'];
27+
$clientConfig['accessKeySecret'] = $config['secret'];
2828
$clientConfig['sessionToken'] = $config['token'] ?? null;
2929
}
3030

src/Integration/Laravel/Queue/src/Connector/AsyncAwsSqsConnector.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ public function connect(array $config)
1818
{
1919
$clientConfig = [];
2020
if (isset($config['key']) && isset($config['secret'])) {
21-
$clientConfig['accessKeyId'] = $config['key'] ?? null;
22-
$clientConfig['accessKeySecret'] = $config['secret'] ?? null;
21+
$clientConfig['accessKeyId'] = $config['key'];
22+
$clientConfig['accessKeySecret'] = $config['secret'];
2323
$clientConfig['sessionToken'] = $config['token'] ?? null;
2424
}
2525

src/Service/DynamoDb/src/Input/BatchWriteItemInput.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function __construct(array $input = [])
7171
{
7272
if (isset($input['RequestItems'])) {
7373
$this->requestItems = [];
74-
foreach ($input['RequestItems'] ?? [] as $key => $item) {
74+
foreach ($input['RequestItems'] as $key => $item) {
7575
$this->requestItems[$key] = array_map([WriteRequest::class, 'create'], $item);
7676
}
7777
}

0 commit comments

Comments
 (0)