REDROOM
PHP 8.2.31
Path:
Logout
Edit File
Size: 3.08 KB
Close
//opt/cpanel/ea-wappspector/vendor/rector/rector/src/NodeManipulator/StmtsManipulator.php
Text
Base64
<?php declare (strict_types=1); namespace Rector\NodeManipulator; use PhpParser\Node; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Stmt; use PhpParser\Node\Stmt\ClassMethod; use PhpParser\Node\Stmt\Expression; use Rector\Contract\PhpParser\Node\StmtsAwareInterface; use Rector\DeadCode\NodeAnalyzer\ExprUsedInNodeAnalyzer; use Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser; use Rector\PhpParser\Comparing\NodeComparator; use Rector\PhpParser\Node\BetterNodeFinder; final class StmtsManipulator { /** * @readonly * @var \Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser */ private $simpleCallableNodeTraverser; /** * @readonly * @var \Rector\PhpParser\Node\BetterNodeFinder */ private $betterNodeFinder; /** * @readonly * @var \Rector\PhpParser\Comparing\NodeComparator */ private $nodeComparator; /** * @readonly * @var \Rector\DeadCode\NodeAnalyzer\ExprUsedInNodeAnalyzer */ private $exprUsedInNodeAnalyzer; public function __construct(SimpleCallableNodeTraverser $simpleCallableNodeTraverser, BetterNodeFinder $betterNodeFinder, NodeComparator $nodeComparator, ExprUsedInNodeAnalyzer $exprUsedInNodeAnalyzer) { $this->simpleCallableNodeTraverser = $simpleCallableNodeTraverser; $this->betterNodeFinder = $betterNodeFinder; $this->nodeComparator = $nodeComparator; $this->exprUsedInNodeAnalyzer = $exprUsedInNodeAnalyzer; } /** * @param Stmt[] $stmts */ public function getUnwrappedLastStmt(array $stmts) : ?Node { \end($stmts); $lastStmtKey = \key($stmts); \reset($stmts); $lastStmt = $stmts[$lastStmtKey]; if ($lastStmt instanceof Expression) { return $lastStmt->expr; } return $lastStmt; } /** * @param Stmt[] $stmts * @return Stmt[] */ public function filterOutExistingStmts(ClassMethod $classMethod, array $stmts) : array { $this->simpleCallableNodeTraverser->traverseNodesWithCallable((array) $classMethod->stmts, function (Node $node) use(&$stmts) { foreach ($stmts as $key => $assign) { if (!$this->nodeComparator->areNodesEqual($node, $assign)) { continue; } unset($stmts[$key]); } return null; }); return $stmts; } /** * @param StmtsAwareInterface|Stmt[] $stmtsAware */ public function isVariableUsedInNextStmt($stmtsAware, int $jumpToKey, string $variableName) : bool { if ($stmtsAware instanceof StmtsAwareInterface && $stmtsAware->stmts === null) { return \false; } $stmts = \array_slice($stmtsAware instanceof StmtsAwareInterface ? $stmtsAware->stmts : $stmtsAware, $jumpToKey, null, \true); $variable = new Variable($variableName); return (bool) $this->betterNodeFinder->findFirst($stmts, function (Node $subNode) use($variable) : bool { return $this->exprUsedInNodeAnalyzer->isUsed($subNode, $variable); }); } }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 15
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
AssignManipulator.php
2.92 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
BinaryOpManipulator.php
4.83 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
ClassConstManipulator.php
2.61 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
ClassDependencyManipulator.php
9.08 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
ClassInsertManipulator.php
2.61 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
ClassManipulator.php
1.79 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
ClassMethodAssignManipulator.php
1.85 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
ClassMethodManipulator.php
2.18 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
ClassMethodPropertyFetchManipulator.php
4.25 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
FuncCallManipulator.php
1.08 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
FunctionLikeManipulator.php
755 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
IfManipulator.php
6.19 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
PropertyFetchAssignManipulator.php
2.46 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
PropertyManipulator.php
8.65 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
StmtsManipulator.php
3.08 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).