ResponseCreateToNewRector
Change deprecated Response::create() and its children to use __construct() instead
use Symfony\Component\HttpFoundation\JsonResponse;
final class SomeClass
{
public function run()
{
- return JsonResponse::create(['key' => 'value'], 200);
+ return new JsonResponse(['key' => 'value'], 200);
}
}
Configure your rector.php:
<?php
use Rector\Config\RectorConfig;
use Rector\Symfony\Symfony51\Rector\StaticCall\ResponseCreateToNewRector;
return RectorConfig::configure()
->withRules([
ResponseCreateToNewRector::class,
]);
PACKAGE:
symfony/http-foundation >=5.1