/
home
/
techb158
/
ileadtechnology.com
/
SSM
/
vendor
/
psy
/
psysh
/
src
/
CodeCleaner
/
/home/techb158/ileadtechnology.com/SSM/vendor/psy/psysh/src/CodeCleaner
mkdir
upload
Name
Size
Mode
Actions
AbstractClassPass.php
2200
0644
edit
dl
rm
AssignThisVariablePass.php
1034
0644
edit
dl
rm
CalledClassPass.php
2386
0644
edit
dl
rm
CallTimePassByReferencePass.php
1391
0644
edit
dl
rm
CodeCleanerPass.php
415
0644
edit
dl
rm
EmptyArrayDimFetchPass.php
1283
0644
edit
dl
rm
ExitPass.php
773
0644
edit
dl
rm
FinalClassPass.php
1666
0644
edit
dl
rm
FunctionContextPass.php
1339
0644
edit
dl
rm
FunctionReturnInWriteContextPass.php
2498
0644
edit
dl
rm
ImplicitReturnPass.php
4240
0644
edit
dl
rm
InstanceOfPass.php
1604
0644
edit
dl
rm
LabelContextPass.php
2356
0644
edit
dl
rm
LeavePsyshAlonePass.php
913
0644
edit
dl
rm
ListPass.php
3282
0644
edit
dl
rm
LoopContextPass.php
3476
0644
edit
dl
rm
MagicConstantsPass.php
1068
0644
edit
dl
rm
NamespaceAwarePass.php
1856
0644
edit
dl
rm
NamespacePass.php
2416
0644
edit
dl
rm
NoReturnValue.php
870
0644
edit
dl
rm
PassableByReferencePass.php
4024
0644
edit
dl
rm
RequirePass.php
3035
0644
edit
dl
rm
StrictTypesPass.php
2704
0644
edit
dl
rm
UseStatementPass.php
4356
0644
edit
dl
rm
ValidClassNamePass.php
12176
0644
edit
dl
rm
ValidConstantPass.php
3202
0644
edit
dl
rm
ValidConstructorPass.php
3884
0644
edit
dl
rm
ValidFunctionNamePass.php
3239
0644
edit
dl
rm
Edit:
/home/techb158/ileadtechnology.com/SSM/vendor/psy/psysh/src/CodeCleaner/LoopContextPass.php
(3476B)
<?php /* * This file is part of Psy Shell. * * (c) 2012-2020 Justin Hileman * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Psy\CodeCleaner; use PhpParser\Node; use PhpParser\Node\Scalar\DNumber; use PhpParser\Node\Scalar\LNumber; use PhpParser\Node\Stmt\Break_; use PhpParser\Node\Stmt\Continue_; use PhpParser\Node\Stmt\Do_; use PhpParser\Node\Stmt\For_; use PhpParser\Node\Stmt\Foreach_; use PhpParser\Node\Stmt\Switch_; use PhpParser\Node\Stmt\While_; use Psy\Exception\FatalErrorException; /** * The loop context pass handles invalid `break` and `continue` statements. */ class LoopContextPass extends CodeCleanerPass { private $loopDepth; /** * {@inheritdoc} */ public function beforeTraverse(array $nodes) { $this->loopDepth = 0; } /** * @throws FatalErrorException if the node is a break or continue in a non-loop or switch context * @throws FatalErrorException if the node is trying to break out of more nested structures than exist * @throws FatalErrorException if the node is a break or continue and has a non-numeric argument * @throws FatalErrorException if the node is a break or continue and has an argument less than 1 * * @param Node $node */ public function enterNode(Node $node) { switch (true) { case $node instanceof Do_: case $node instanceof For_: case $node instanceof Foreach_: case $node instanceof Switch_: case $node instanceof While_: $this->loopDepth++; break; case $node instanceof Break_: case $node instanceof Continue_: $operator = $node instanceof Break_ ? 'break' : 'continue'; if ($this->loopDepth === 0) { $msg = \sprintf("'%s' not in the 'loop' or 'switch' context", $operator); throw new FatalErrorException($msg, 0, E_ERROR, null, $node->getLine()); } if ($node->num instanceof LNumber || $node->num instanceof DNumber) { $num = $node->num->value; if ($node->num instanceof DNumber || $num < 1) { $msg = \sprintf("'%s' operator accepts only positive numbers", $operator); throw new FatalErrorException($msg, 0, E_ERROR, null, $node->getLine()); } if ($num > $this->loopDepth) { $msg = \sprintf("Cannot '%s' %d levels", $operator, $num); throw new FatalErrorException($msg, 0, E_ERROR, null, $node->getLine()); } } elseif ($node->num) { $msg = \sprintf("'%s' operator with non-constant operand is no longer supported", $operator); throw new FatalErrorException($msg, 0, E_ERROR, null, $node->getLine()); } break; } } /** * @param Node $node */ public function leaveNode(Node $node) { switch (true) { case $node instanceof Do_: case $node instanceof For_: case $node instanceof Foreach_: case $node instanceof Switch_: case $node instanceof While_: $this->loopDepth--; break; } } }
Save
cmd:
run