Skip to content

Match rename map case-insensitively in IdentifierManipulator - #808

Merged
TomasVotruba merged 1 commit into
mainfrom
fix-assert-isset-case
Oct 21, 2026
Merged

TomasVotruba merged 1 commit into
mainfrom
fix-assert-isset-case

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Fixes rectorphp/rector#9934.

AssertIssetToSpecificMethodRector (and the other assert rules sharing IdentifierManipulator::renameNodeWithMap()) crashed on method calls written in a different case, e.g. $this->asserttrue(...).

Detection goes through NodeNameResolver::isNames(), which compares with strcasecmp() and so matches asserttrue. The rename then looked the method up as an exact array key ($renameMethodMap['asserttrue']), got no match, and built new Identifier(null), throwing a TypeError.

PHP method names are case-insensitive, so the map lookup now matches the same way. Added a fixture with asserttrue / ASSERTFALSE covering it.

@TomasVotruba
TomasVotruba merged commit 3558b70 into main Oct 21, 2026
8 checks passed
@TomasVotruba
TomasVotruba deleted the fix-assert-isset-case branch October 21, 2026 06:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

AssertIssetToSpecificMethod errors on incorrectly cased methods

1 participant