Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions rules/Naming/Contract/RenameParamValueObjectInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,12 @@

namespace Rector\Naming\Contract;

use PhpParser\Node\Expr\ArrowFunction;
use PhpParser\Node\Expr\Closure;
use PhpParser\Node\FunctionLike;
use PhpParser\Node\Param;
use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\Node\Stmt\Function_;

interface RenameParamValueObjectInterface extends RenameValueObjectInterface
{
public function getFunctionLike(): ClassMethod | Function_ | Closure | ArrowFunction;
public function getFunctionLike(): FunctionLike;

public function getParam(): Param;
}
9 changes: 3 additions & 6 deletions rules/Naming/ValueObject/ParamRename.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@

namespace Rector\Naming\ValueObject;

use PhpParser\Node\Expr\ArrowFunction;
use PhpParser\Node\Expr\Closure;
use PhpParser\Node\Expr\Variable;
use PhpParser\Node\FunctionLike;
use PhpParser\Node\Param;
use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\Node\Stmt\Function_;
use Rector\Naming\Contract\RenameParamValueObjectInterface;

final class ParamRename implements RenameParamValueObjectInterface
Expand All @@ -19,7 +16,7 @@ public function __construct(
private readonly string $expectedName,
private readonly Param $param,
private readonly Variable $variable,
private readonly ClassMethod | Function_ | Closure | ArrowFunction $functionLike
private readonly FunctionLike $functionLike
) {
}

Expand All @@ -33,7 +30,7 @@ public function getExpectedName(): string
return $this->expectedName;
}

public function getFunctionLike(): ClassMethod | Function_ | Closure | ArrowFunction
public function getFunctionLike(): FunctionLike
{
return $this->functionLike;
}
Expand Down
7 changes: 2 additions & 5 deletions rules/Naming/ValueObjectFactory/ParamRenameFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@

namespace Rector\Naming\ValueObjectFactory;

use PhpParser\Node\Expr\ArrowFunction;
use PhpParser\Node\Expr\Closure;
use PhpParser\Node\Expr\Error;
use PhpParser\Node\FunctionLike;
use PhpParser\Node\Param;
use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\Node\Stmt\Function_;
use Rector\Naming\ValueObject\ParamRename;
use Rector\NodeNameResolver\NodeNameResolver;

Expand All @@ -21,7 +18,7 @@ public function __construct(
}

public function createFromResolvedExpectedName(
ClassMethod|Function_|ArrowFunction|Closure $functionLike,
FunctionLike $functionLike,
Param $param,
string $expectedName
): ?ParamRename {
Expand Down
5 changes: 1 addition & 4 deletions rules/Naming/VariableRenamer.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,11 @@
namespace Rector\Naming;

use PhpParser\Node;
use PhpParser\Node\Expr\ArrowFunction;
use PhpParser\Node\Expr\Assign;
use PhpParser\Node\Expr\Closure;
use PhpParser\Node\Expr\Variable;
use PhpParser\Node\Param;
use PhpParser\Node\Stmt;
use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\Node\Stmt\Function_;
use PhpParser\NodeTraverser;
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
Expand All @@ -31,7 +28,7 @@ public function __construct(
}

public function renameVariableInFunctionLike(
ClassMethod | Function_ | Closure | ArrowFunction $functionLike,
Node\FunctionLike $functionLike,
string $oldName,
string $expectedName,
?Assign $assign = null
Expand Down