Skip to content

Commit

Permalink
implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed Jan 8, 2022
1 parent 8f18542 commit 7df7bca
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@
namespace Rector\DowngradePhp80\Rector\FuncCall;

use PhpParser\Node;
use PhpParser\Node\Arg;
use PhpParser\Node\Expr\FuncCall;
use PhpParser\Node\Scalar\String_;
use Rector\Core\NodeAnalyzer\ArgsAnalyzer;
use Rector\Core\Rector\AbstractRector;
use Rector\Core\Reflection\ReflectionResolver;
use ReflectionFunction;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;

Expand All @@ -19,7 +23,8 @@
final class DowngradeNumberFormatNoFourthArgRector extends AbstractRector
{
public function __construct(
private readonly ArgsAnalyzer $argsAnalyzer
private readonly ArgsAnalyzer $argsAnalyzer,
private readonly ReflectionResolver $reflectionResolver
) {
}

Expand Down Expand Up @@ -70,6 +75,9 @@ public function refactor(Node $node): ?Node
return null;
}

$reflectionFunction = new ReflectionFunction('number_format');
$node->args[3] = new Arg(new String_($reflectionFunction->getParameters()[3]->getDefaultValue()));

return $node;
}

Expand Down

0 comments on commit 7df7bca

Please sign in to comment.