Skip to content

Commit 4ba842a

Browse files
committed
fix(tests): Refine parameter checks and improve code clarity
- Adjust parameter handling in HasOptions trait to enhance logic flow. - Remove unnecessary inspection annotations from HasSudoPassword trait. - Simplify array explosion in ComposerScripts to ensure better readability. - Clean up annotations in ToInternalExceptionRector for consistency.
1 parent 5fba139 commit 4ba842a

File tree

4 files changed

+4
-12
lines changed

4 files changed

+4
-12
lines changed

src/Concerns/HasOptions.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
/** @noinspection MissingParameterTypeDeclarationInspection */
4+
35
declare(strict_types=1);
46

57
/**
@@ -1571,7 +1573,7 @@ protected function normalizeOption(int|string $key, mixed $value): string
15711573
}
15721574

15731575
if (\is_array($value)) {
1574-
if (\in_array($key, ['-test-dsn', '-online-dsn'], true) && !($value['disable'] ?? false)) {
1576+
if (!($value['disable'] ?? false) && \in_array($key, ['-test-dsn', '-online-dsn'], true)) {
15751577
$dsn = "{$value['username']}:{$value['password']}@{$value['host']}:{$value['port']}/{$value['dbname']}";
15761578

15771579
return "$key=$dsn";

src/Concerns/HasSudoPassword.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ public function getSudoPassword(): ?string
2828
return $this->sudoPassword;
2929
}
3030

31-
/**
32-
* @noinspection PhpLanguageLevelInspection
33-
*/
3431
public function setSudoPassword(
3532
#[\SensitiveParameter]
3633
?string $sudoPassword

src/Support/ComposerScripts.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ public static function extractOptionsFromHelp(): array
169169
}, explode(\PHP_EOL, Soar::create()->help()));
170170

171171
$options = array_reduce(array_chunk(array_filter($arrayMap), 2), static function (array $options, array $option): array {
172-
$names = (array) explode(' ', $option[0]);
172+
$names = explode(' ', $option[0]);
173173
preg_match('/\\(default .*\\)/', $option[1], $defaults);
174174

175175
$default = $defaults[0] ?? null;

src/Support/Rectors/ToInternalExceptionRector.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,7 @@ public function getNodeTypes(): array
6767
}
6868

6969
/**
70-
* @noinspection PhpInconsistentReturnPointsInspection
71-
*
7270
* @param Node\Expr\New_ $node
73-
*
74-
* @throws \ReflectionException
7571
*/
7672
public function refactor(Node $node): ?Node
7773
{
@@ -97,9 +93,6 @@ public function refactor(Node $node): ?Node
9793
return $node;
9894
}
9995

100-
/**
101-
* @throws \ReflectionException
102-
*/
10396
private function createInternalException(Name $name): void
10497
{
10598
/** @var class-string $externalExceptionClass */

0 commit comments

Comments
 (0)