Skip to content

Commit de7abf9

Browse files
committed
fixup! Replaced with a simple foreach
1 parent 81efc72 commit de7abf9

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

src/Rules/Methods/CallStaticMethodsRule.php

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
use PHPStan\Rules\FunctionCallParametersCheck;
1313
use PHPStan\Rules\IdentifierRuleError;
1414
use PHPStan\Rules\Rule;
15-
use PHPStan\Type\Constant\ConstantStringType;
16-
use function array_column;
17-
use function array_map;
1815
use function array_merge;
1916
use function sprintf;
2017

@@ -43,13 +40,11 @@ public function processNode(Node $node, Scope $scope): array
4340
$methodNameScopes = [$node->name->name => $scope];
4441
} else {
4542
$nameType = $scope->getType($node->name);
46-
$methodNameScopes = array_column(array_map(
47-
static fn (ConstantStringType $constantString) => [
48-
$name = $constantString->getValue(),
49-
$scope->filterByTruthyValue(new Identical($node->name, new String_($name))),
50-
],
51-
$nameType->getConstantStrings(),
52-
), 1, 0);
43+
$methodNameScopes = [];
44+
foreach ($nameType->getConstantStrings() as $constantString) {
45+
$name = $constantString->getValue();
46+
$methodNameScopes[$name] = $scope->filterByTruthyValue(new Identical($node->name, new String_($name)));
47+
}
5348
}
5449

5550
foreach ($methodNameScopes as $methodName => $methodScope) {

0 commit comments

Comments
 (0)