Simplify use of assertions in WebTestCase
 use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
 final class SomeClass extends WebTestCase
 {
     public function test()
     {
-        $response = self::getClient()->getResponse();
-
-        $this->assertSame(301, $response->getStatusCode());
-        $this->assertSame('https://example.com', $response->headers->get('Location'));
+        $this->assertResponseStatusCodeSame(301);
+        $this->assertResponseRedirects('https://example.com');
     }
 }Configure your rector.php:
<?php
use Rector\Config\RectorConfig;
use Rector\Symfony\Symfony43\Rector\MethodCall\WebTestCaseAssertResponseCodeRector;
return RectorConfig::configure()
    ->withRules([
        WebTestCaseAssertResponseCodeRector::class,
    ]);