Skip to content

Conversation

@samsonasik
Copy link
Member

I will add test for invalid test after combined with AssertEqualsToSameRector

…chAssertEqualsExpectedTypeRector to only apply on assertEquals (#514)"

This reverts commit 84fe73a.
@samsonasik samsonasik marked this pull request as ready for review August 21, 2025 08:59
@samsonasik samsonasik closed this Aug 21, 2025
@samsonasik samsonasik reopened this Aug 21, 2025
@samsonasik
Copy link
Member Author

samsonasik commented Aug 21, 2025

@TomasVotruba test added a59c746

Here the summary:

  • Run:
vendor/bin/phpunit tests/Issues/AssertEqualsSame
  • when apply scalar 123 to string type, the 123 become "123" via MatchAssertSameExpectedTypeRector
  • then compare string vs string, it applied via AssertEqualsToSameRector, make "123" vs "0000000000000000000123", which invalid.
-'123'
+'0000000000000000000123'

This can be excluded only assertSame, but using assertSame means it already strict type on the very beginning, comparing this already error on very firs execution:

    public function test()
    {
        $this->assertSame('123', $this->getOrderId());
    }
    private function getOrderId(): int
    {
        return 123;
    }
There was 1 failure:

1) ArrayLookup\Tests\CollectorTest::test
Failed asserting that 123 is identical to '123'.

so, my propose was just remove the rule, because it doesn't make improvement.

@TomasVotruba TomasVotruba merged commit e561212 into main Aug 21, 2025
5 of 6 checks passed
@TomasVotruba TomasVotruba deleted the revert-rule-removal branch August 21, 2025 13:33
@TomasVotruba
Copy link
Member

Thanks 👌 I'll look into failing job today.

Next time ideally split revert + fixture, so we have passing CI and isolated test case.

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.

4 participants