Hi rector team! Is there a rector rule to remove named arguments #8995
Answered
by
alexandreelise
alexandreelise
asked this question in
Q&A
|
Here the thing. |
Answered by
alexandreelise
Jan 30, 2025
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. |
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
So the latest config file might look like
Is it better?
Hope it helps someone that stumbled upon the same hurdle.