REDROOM
PHP 8.2.31
Path:
Logout
Edit File
Size: 1.65 KB
Close
//opt/cpanel/ea-wappspector/vendor/rector/rector/src/NodeCollector/BinaryOpConditionsCollector.php
Text
Base64
<?php declare (strict_types=1); namespace Rector\NodeCollector; use PhpParser\Node\Expr; use PhpParser\Node\Expr\BinaryOp; /** * @see \Rector\Tests\NodeCollector\BinaryOpConditionsCollectorTest */ final class BinaryOpConditionsCollector { /** * Collects operands of a sequence of applications of a given left-associative binary operation. * * For example, for `a + b + c`, which is parsed as `(Plus (Plus a b) c)`, it will return `[a, b, c]`. * Note that parenthesization not matching the associativity (e.g. `a + (b + c)`) will return the parenthesized * nodes as standalone operands (`[a, b + c]`) even for associative operations. * Similarly, for right-associative operations (e.g. `a ?? b ?? c`), the result produced by * the implicit parenthesization (`[a, b ?? c]`) might not match the expectations. * * @api * @param class-string<BinaryOp> $binaryOpClass * @return array<int, Expr> */ public function findConditions(Expr $expr, string $binaryOpClass) : array { if (\get_class($expr) !== $binaryOpClass) { // Different binary operators, as well as non-BinaryOp expressions // are considered trivial case of a single operand (no operators). return [$expr]; } $conditions = []; /** @var BinaryOp|Expr $expr */ while ($expr instanceof BinaryOp) { $conditions[] = $expr->right; $expr = $expr->left; if ($binaryOpClass !== \get_class($expr)) { $conditions[] = $expr; break; } } \krsort($conditions); return $conditions; } }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 3 × Files: 2
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
NodeAnalyzer
DIR
-
drwxr-xr-x
2024-11-08 13:59:10
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ScopeResolver
DIR
-
drwxr-xr-x
2024-11-08 13:59:10
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ValueObject
DIR
-
drwxr-xr-x
2024-11-08 13:59:10
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
BinaryOpConditionsCollector.php
1.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
StaticAnalyzer.php
1.66 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).