Skip to content

Commit a451859

Browse files
committed
Replaced with a simple foreach
1 parent e11a805 commit a451859

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/Rules/Methods/CallMethodsRule.php

+5-9
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
use PHPStan\Rules\IdentifierRuleError;
1414
use PHPStan\Rules\Rule;
1515
use PHPStan\Type\Constant\ConstantStringType;
16-
use function array_column;
17-
use function array_map;
1816
use function array_merge;
1917

2018
/**
@@ -42,13 +40,11 @@ public function processNode(Node $node, Scope $scope): array
4240
$methodNameScopes = [$node->name->name => $scope];
4341
} else {
4442
$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);
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+
}
5248
}
5349

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

0 commit comments

Comments
 (0)