Correct expected type in assertSame() method to match strict type of passed variable
use PHPUnit\Framework\TestCase;
class SomeTest extends TestCase
{
public function test()
{
- $this->assertSame('123', $this->getOrderId());
+ $this->assertSame(123, $this->getOrderId());
}
private function getOrderId(): int
{
return 123;
}
}
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\PHPUnit\CodeQuality\Rector\MethodCall\MatchAssertSameExpectedTypeRector;
return RectorConfig::configure()
->withRules([
MatchAssertSameExpectedTypeRector::class,
]);