StringCastDebugResponseRector

Cast responses in PHPUnit assert message to string, as required by PHPUnit

 use PHPUnit\Framework\TestCase;

 class SomeClass extends TestCase
 {
     public function run()
     {
         /** @var \Symfony\Component\HttpFoundation\Response $response */
         $response = $this->processResult();

-        $this->assertSame(200, $response->getStatusCode(), $response->getContent());
+        $this->assertSame(200, $response->getStatusCode(), (string) $response->getContent());
     }
 }

Configure your rector.php:

<?php

use Rector\Config\RectorConfig;
use Rector\Symfony\CodeQuality\Rector\MethodCall\StringCastDebugResponseRector;

return RectorConfig::configure()
    ->withRules([
        StringCastDebugResponseRector::class,
    ]);
SETS:  Code Quality