Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace Rector\PHPUnit\Tests\CodeQuality\Rector\MethodCall\AssertIssetToSpecificMethodRector\Fixture;

final class DifferentCaseMethodTest extends \PHPUnit\Framework\TestCase
{
public function test()
{
$this->asserttrue(isset($node['value1']), 'message');
$this->ASSERTFALSE(isset($node['value2']));
}
}

?>
-----
<?php

namespace Rector\PHPUnit\Tests\CodeQuality\Rector\MethodCall\AssertIssetToSpecificMethodRector\Fixture;

final class DifferentCaseMethodTest extends \PHPUnit\Framework\TestCase
{
public function test()
{
$this->assertArrayHasKey('value1', $node, 'message');
$this->assertArrayNotHasKey('value2', $node);
}
}

?>
11 changes: 9 additions & 2 deletions src/NodeAnalyzer/IdentifierManipulator.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,15 @@ public function renameNodeWithMap(
return false;
}

$node->name = new Identifier($renameMethodMap[$oldNodeMethodName]);
return true;
// method names are case-insensitive in PHP, match the map the same way
foreach ($renameMethodMap as $oldName => $newName) {
if (strcasecmp($oldName, $oldNodeMethodName) === 0) {
$node->name = new Identifier($newName);
return true;
}
}

return false;
}

private function resolveOldMethodName(
Expand Down
Loading