Skip to content

Commit 425ea44

Browse files
authored
Update Infection (#951)
1 parent 041a3a7 commit 425ea44

File tree

4 files changed

+45
-51
lines changed

4 files changed

+45
-51
lines changed

.dev-tools/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"require": {
44
"php": "^8.3",
55
"ergebnis/composer-normalize": "^2.41.1",
6-
"infection/infection": "^0.26.21",
6+
"infection/infection": "^0.27.9",
77
"kubawerlos/composer-smaller-lock": "^1.0.1",
88
"kubawerlos/php-cs-fixer-config": "^3.22",
99
"maglnet/composer-require-checker": "^4.8",

.dev-tools/composer.lock

Lines changed: 35 additions & 36 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.dev-tools/infection.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
"DivEqual": true,
5757
"Division": true,
5858
"DoWhile": true,
59+
"ElseIfNegation": true,
5960
"Equal": true,
6061
"EqualIdentical": true,
6162
"Exponentiation": true,
@@ -69,6 +70,7 @@
6970
"GreaterThanNegotiation": true,
7071
"GreaterThanOrEqualToNegotiation": true,
7172
"Identical": true,
73+
"IfNegation": true,
7274
"Increment": true,
7375
"InstanceOf_": {
7476
"ignoreSourceCodeByRegex": [
@@ -82,10 +84,16 @@
8284
"PhpCsFixerCustomFixers\\Fixer\\*::isCandidate"
8385
]
8486
},
87+
"LogicalAndAllSubExprNegation": true,
88+
"LogicalAndNegation": true,
89+
"LogicalAndSingleSubExprNegation": true,
8590
"LogicalLowerAnd": true,
8691
"LogicalLowerOr": true,
8792
"LogicalNot": true,
8893
"LogicalOr": true,
94+
"LogicalOrAllSubExprNegation": true,
95+
"LogicalOrNegation": true,
96+
"LogicalOrSingleSubExprNegation": true,
8997
"MBString": true,
9098
"MatchArmRemoval": true,
9199
"MethodCallRemoval": true,

src/Fixer/NoDuplicatedImportsFixer.php

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ static function (NamespaceUseAnalysis $useDeclaration) use ($namespace): bool {
6666

6767
$foundDeclarations = [];
6868
foreach ($currentNamespaceUseDeclarations as $useDeclaration) {
69-
$key = $this->getUniqueKey($useDeclaration);
69+
$key = \sprintf('key_%d_%s', $useDeclaration->getType(), $useDeclaration->getShortName());
7070
if (\in_array($key, $foundDeclarations, true)) {
7171
$this->removeUseDeclaration($tokens, $useDeclaration);
7272
}
@@ -75,19 +75,6 @@ static function (NamespaceUseAnalysis $useDeclaration) use ($namespace): bool {
7575
}
7676
}
7777

78-
private function getUniqueKey(NamespaceUseAnalysis $useDeclaration): string
79-
{
80-
if ($useDeclaration->isClass()) {
81-
return $useDeclaration->getShortName();
82-
}
83-
84-
if ($useDeclaration->isFunction()) {
85-
return 'function ' . $useDeclaration->getShortName();
86-
}
87-
88-
return 'constant ' . $useDeclaration->getShortName();
89-
}
90-
9178
private function removeUseDeclaration(Tokens $tokens, NamespaceUseAnalysis $useDeclaration): void
9279
{
9380
$removeUseDeclaration = static function (

0 commit comments

Comments
 (0)