Skip to content

Commit a165de2

Browse files
committed
Fix cache key for alternativeMethodKeys
1 parent 58ce292 commit a165de2

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/Rule/DeadMethodRule.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,9 +281,10 @@ private function isAnonymousClass(string $className): bool
281281
private function getAlternativeMethodKeys(Method $method, bool $possibleDescendant): array
282282
{
283283
$methodKey = $method->toString();
284+
$cacheKey = $methodKey . ';' . ($possibleDescendant ? '1' : '0');
284285

285-
if (isset($this->methodAlternativesCache[$methodKey])) {
286-
return $this->methodAlternativesCache[$methodKey];
286+
if (isset($this->methodAlternativesCache[$cacheKey])) {
287+
return $this->methodAlternativesCache[$cacheKey];
287288
}
288289

289290
$result = [$methodKey];
@@ -303,7 +304,7 @@ private function getAlternativeMethodKeys(Method $method, bool $possibleDescenda
303304
}
304305
}
305306

306-
$this->methodAlternativesCache[$methodKey] = $result;
307+
$this->methodAlternativesCache[$cacheKey] = $result;
307308

308309
return $result;
309310
}

0 commit comments

Comments
 (0)