Skip to content

Conversation

@samsonasik
Copy link
Member

@TomasVotruba this is alternative solution to not change to assertSame on numeric string for failure test https://github.com/rectorphp/rector-phpunit/actions/runs/17128495249/job/48586074883#step:5:43

@samsonasik samsonasik changed the title [Alternative 1] Don't change to assertSame() on numeric string [Alternative 1] Don't change to assertSame() on numeric string on AssertEqualsToSameRector Aug 22, 2025
return true;
}

return $args[0]->value instanceof String_ && is_numeric($args[0]->value->value);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@TomasVotruba
Copy link
Member

Looks good 👍 I recall we use this approach in some other rules too, good job

@TomasVotruba TomasVotruba merged commit 57a7e1d into main Aug 22, 2025
6 checks passed
@TomasVotruba TomasVotruba deleted the alternative-1-numeric-string-skip branch August 22, 2025 06:50
@samsonasik
Copy link
Member Author

@TomasVotruba hm.., I still got error even on assertEquals:

--- Expected
+++ Actual
@@ @@
-'123'
+'0000000000000000000123'

seems because of "string", that "123" is not equals than "0000000000000000000123", it seems MatchAssertSameExpectedTypeRector needs to skip assertEquals + numeric string, I will create a PR for it.

@samsonasik
Copy link
Member Author

#522

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants