Skip to content

Commit

Permalink
Incorrect behavior of RemoveUnusedPrivateMethodRector (#227)
Browse files Browse the repository at this point in the history
  • Loading branch information
tugmaks committed Jun 15, 2021
1 parent b44261f commit bad9871
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/NodeCollector/NodeCollector/NodeRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ private function collectArray(Array_ $array): void
return;
}

$this->arrayCallablesByTypeAndMethod[$arrayCallable->getClass()][$arrayCallable->getMethod()][] = $arrayCallable;
$this->arrayCallablesByTypeAndMethod[$arrayCallable->getClass()][strtolower($arrayCallable->getMethod())][] = $arrayCallable;
}

private function addMethod(ClassMethod $classMethod): void
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

namespace Rector\Tests\DeadCode\Rector\ClassMethod\RemoveUnusedPrivateMethodRector\Fixture;

final class SkipArrayCallablesThisCaseInsensitiveMethodName
{
public function run()
{
$array = [3, 2, 1];

usort($array, [$this, 'sortCamelCasedMethodName']);
usort($array, [$this, 'sortCaseInSensitiveMETHODName']);

return $array;
}

private function sortCamelCasedMethodName($a, $b)
{
return $a <=> $b;
}

private function SOrtCAseINSENsitivEMEthodnaME($a, $b)
{
return $a <=> $b;
}
}

0 comments on commit bad9871

Please sign in to comment.