Hi rector team! Is there a rector rule to remove named arguments #8995
-
Here the thing. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
I think I found it. I used your rector playground to try it out. <?php
final class DemoFile
{
public function run(bool $param)
{
if ($this->isTrue(value: $param)) {
return 5;
}
return '10';
}
private function isTrue($value)
{
return $value === true;
}
}
and the config is <?php
use Rector\Config\RectorConfig;
use Rector\ValueObject\PhpVersion;
use Rector\Set\ValueObject\DowngradeLevelSetList;
return RectorConfig::configure()
->withPhpVersion(PhpVersion::PHP_83)
->withSets([DowngradeLevelSetList::DOWN_TO_PHP_74]);
I don't know if it's the best practice but in the playground it seem to work. It removes the named arguments. Please confirm if it's the right way to do it @TomasVotruba . Enjoy your day. |
Beta Was this translation helpful? Give feedback.
So the latest config file might look like
Is it better?
Hope it helps someone that stumbled upon the same hurdle.