REDROOM
PHP 8.2.31
Path:
Logout
Edit File
Size: 2.13 KB
Close
/opt/cpanel/ea-wappspector/vendor/rector/rector/rules/Naming/Matcher/VariableAndCallAssignMatcher.php
Text
Base64
<?php declare (strict_types=1); namespace Rector\Naming\Matcher; use PhpParser\Node; use PhpParser\Node\Expr\Assign; use PhpParser\Node\Expr\Closure; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Function_; use Rector\Naming\ValueObject\VariableAndCallAssign; use Rector\NodeNameResolver\NodeNameResolver; use Rector\PhpParser\Node\BetterNodeFinder; final class VariableAndCallAssignMatcher { /** * @readonly * @var \Rector\Naming\Matcher\CallMatcher */ private $callMatcher; /** * @readonly * @var \Rector\NodeNameResolver\NodeNameResolver */ private $nodeNameResolver; /** * @readonly * @var \Rector\PhpParser\Node\BetterNodeFinder */ private $betterNodeFinder; public function __construct(\Rector\Naming\Matcher\CallMatcher $callMatcher, NodeNameResolver $nodeNameResolver, BetterNodeFinder $betterNodeFinder) { $this->callMatcher = $callMatcher; $this->nodeNameResolver = $nodeNameResolver; $this->betterNodeFinder = $betterNodeFinder; } /** * @param \PhpParser\Node\Stmt\ClassMethod|\PhpParser\Node\Expr\Closure|\PhpParser\Node\Stmt\Function_ $functionLike */ public function match(Assign $assign, $functionLike) : ?VariableAndCallAssign { $call = $this->callMatcher->matchCall($assign); if (!$call instanceof Node) { return null; } if (!$assign->var instanceof Variable) { return null; } $variableName = $this->nodeNameResolver->getName($assign->var); if ($variableName === null) { return null; } $isVariableFoundInCallArgs = (bool) $this->betterNodeFinder->findFirst($call->isFirstClassCallable() ? [] : $call->getArgs(), function (Node $subNode) use($variableName) : bool { return $subNode instanceof Variable && $this->nodeNameResolver->isName($subNode, $variableName); }); if ($isVariableFoundInCallArgs) { return null; } return new VariableAndCallAssign($assign->var, $call, $assign, $variableName, $functionLike); } }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 3
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
CallMatcher.php
781 B
lrw-r--r--
2024-11-08 13:59:10
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ForeachMatcher.php
1.51 KB
lrw-r--r--
2024-11-08 13:59:10
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
VariableAndCallAssignMatcher.php
2.13 KB
lrw-r--r--
2024-11-08 13:59:10
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).