opt
/
cpanel
/
ea-wappspector
/
vendor
/
rector
/
rector
/
rules
/
Renaming
/
NodeManipulator
➕ New
📤 Upload
✎ Editing:
SwitchManipulator.php
← Back
<?php declare (strict_types=1); namespace Rector\Renaming\NodeManipulator; use PhpParser\Node\Scalar\LNumber; use PhpParser\Node\Stmt; use PhpParser\Node\Stmt\Break_; final class SwitchManipulator { /** * @param Stmt[] $stmts * @return Stmt[] */ public function removeBreakNodes(array $stmts) : array { foreach ($stmts as $key => $node) { if (!$node instanceof Break_) { continue; } if (!$node->num instanceof LNumber || $node->num->value === 1) { unset($stmts[$key]); continue; } $node->num = $node->num->value === 2 ? null : new LNumber($node->num->value - 1); } return $stmts; } }
💾 Save Changes
Cancel
📤 Upload File
×
Select File
Upload
Cancel
➕ Create New
×
Type
📄 File
📁 Folder
Name
Create
Cancel
✎ Rename Item
×
Current Name
New Name
Rename
Cancel
🔐 Change Permissions
×
Target File
Permission (e.g., 0755, 0644)
0755
0644
0777
Apply
Cancel