Move required parameters after optional ones
class SomeObject
{
- public function run($optional = 1, $required)
+ public function run($required, $optional = 1)
{
}
}
Configure your rector.php
:
<?php
use Rector\CodeQuality\Rector\ClassMethod\OptionalParametersAfterRequiredRector;
use Rector\Config\RectorConfig;
return RectorConfig::configure()
->withRules([
OptionalParametersAfterRequiredRector::class,
]);