mirror of
https://github.com/rectorphp/rector.git
synced 2025-04-20 15:31:58 +02:00
remove Argument deprecations
This commit is contained in:
parent
04626f4e5d
commit
a3a451f3ab
@ -1,10 +0,0 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace Rector\Contract\Configuration\Rector;
|
||||
|
||||
interface ArgumentRecipeInterface
|
||||
{
|
||||
public function getClass(): string;
|
||||
|
||||
public function getMethod(): string;
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace Rector\Rector\Argument;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr\MethodCall;
|
||||
use PhpParser\Node\Expr\StaticCall;
|
||||
use PhpParser\Node\Param;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use Rector\Contract\Configuration\Rector\ArgumentRecipeInterface;
|
||||
use Rector\Rector\AbstractRector;
|
||||
|
||||
abstract class AbstractArgumentRector extends AbstractRector
|
||||
{
|
||||
protected function isNodeToRecipeMatch(Node $node, ArgumentRecipeInterface $argumentRecipe): bool
|
||||
{
|
||||
$type = $argumentRecipe->getClass();
|
||||
$method = $argumentRecipe->getMethod();
|
||||
|
||||
if (! $this->isType($node, $type)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this->isName($node, $method);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Arg[]|Param[]
|
||||
*/
|
||||
protected function getNodeArgumentsOrParameters(Node $node): array
|
||||
{
|
||||
if ($node instanceof MethodCall || $node instanceof StaticCall) {
|
||||
return $node->args;
|
||||
}
|
||||
|
||||
if ($node instanceof ClassMethod) {
|
||||
return $node->params;
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param MethodCall|StaticCall|ClassMethod $node
|
||||
* @param mixed[] $argumentsOrParameters
|
||||
*/
|
||||
protected function setNodeArgumentsOrParameters(Node $node, array $argumentsOrParameters): void
|
||||
{
|
||||
if ($node instanceof MethodCall || $node instanceof StaticCall) {
|
||||
$node->args = $argumentsOrParameters;
|
||||
}
|
||||
|
||||
if ($node instanceof ClassMethod) {
|
||||
$node->params = $argumentsOrParameters;
|
||||
}
|
||||
}
|
||||
}
|
@ -10,10 +10,11 @@ use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr\MethodCall;
|
||||
use PhpParser\Node\Expr\StaticCall;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use Rector\Rector\AbstractRector;
|
||||
use Rector\RectorDefinition\ConfiguredCodeSample;
|
||||
use Rector\RectorDefinition\RectorDefinition;
|
||||
|
||||
final class ArgumentDefaultValueReplacerRector extends AbstractArgumentRector
|
||||
final class ArgumentDefaultValueReplacerRector extends AbstractRector
|
||||
{
|
||||
/**
|
||||
* @var mixed[]
|
||||
|
Loading…
x
Reference in New Issue
Block a user