Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/Analyser/Analyser.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
use Boundwize\StructArmed\Rule\UsedTraitAwareRuleInterface;
use Boundwize\StructArmed\Util\Path;

use function array_change_key_case;
use function array_fill_keys;
use function array_filter;
use function array_key_exists;
Expand Down Expand Up @@ -1080,7 +1081,7 @@ private function markFunctionUsage(array $classNodes, ExtractionResult $extracti

foreach ([...$classNodes, ...$extractionResult->anonymousClassNodes] as $classLikeNode) {
foreach ($classLikeNode->functionCalls as $functionCall) {
$used[strtolower($functionCall)] = true;
$used[$functionCall] = true;
}
}

Expand All @@ -1094,7 +1095,7 @@ private function markFunctionUsage(array $classNodes, ExtractionResult $extracti
}

foreach ($anonymousFunctionNode->functionCalls as $functionCall) {
$used[strtolower($functionCall)] = true;
$used[$functionCall] = true;
}
}

Expand All @@ -1107,11 +1108,14 @@ private function markFunctionUsage(array $classNodes, ExtractionResult $extracti

foreach ($functionNode->functionCalls as $functionCall) {
if (strcasecmp($functionCall, $functionNode->functionName) !== 0) {
$used[strtolower($functionCall)] = true;
$used[$functionCall] = true;
}
}
}

// Deduplicate call spellings across scopes before normalizing their case.
$used = array_change_key_case($used);

foreach ($extractionResult->fileReferences as $references) {
foreach ($references as $reference) {
$referenceKey = strtolower($reference);
Expand Down
Loading