Remove unused $request parameter from controller action
use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
final class SomeController extends Controller
{
- public function run(Request $request, int $id)
+ public function run(int $id)
{
echo $id;
}
}
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\Symfony\CodeQuality\Rector\ClassMethod\RemoveUnusedRequestParamRector;
return RectorConfig::configure()
->withRules([
RemoveUnusedRequestParamRector::class,
]);