Skip to content

Commit fc63761

Browse files
committed
Replaced with a simple foreach
1 parent 4e890a3 commit fc63761

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

Diff for: src/Rules/Methods/CallMethodsRule.php

+5-10
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

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

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

0 commit comments

Comments
 (0)