rectorphp / rector

Instant Upgrades and Automated Refactoring of any PHP 5.3+ code
https://getrector.com
MIT License
8.68k stars 683 forks source link

AssertSameResponseCodeWithDebugContentsRector false positive #8304

Closed astronom closed 9 months ago

astronom commented 11 months ago

Bug Report

Subject Details
Rector version e.g. v0.18.7

This rule does not check that it should be Response

$commandTester = new CommandTester($this->command);
$commandTester->execute();

$this->assertSame(64, $commandTester->getStatusCode());

Rector will be fix like this

+        $this->assertSame(64, $commandTester->getStatusCode(), $commandTester->getContent());

Expected Behaviour

Need to check that it is Response or smth else

samsonasik commented 10 months ago

@astronom could you try provide a patch? Using isObjectType() check on method call var seems can be used.

Thank you.