@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | $this->code = $code; // keep the code around for __halt_compiler() handling |
| 64 | 64 | $this->pos = -1; |
| 65 | - $this->line = 1; |
|
| 65 | + $this->line = 1; |
|
| 66 | 66 | $this->filePos = 0; |
| 67 | 67 | } |
| 68 | 68 | |
@@ -264,10 +264,10 @@ discard block |
||
| 264 | 264 | if (T_DOUBLE_COLON === $i) { |
| 265 | 265 | // T_DOUBLE_COLON is equivalent to T_PAAMAYIM_NEKUDOTAYIM |
| 266 | 266 | $tokenMap[$i] = Tokens::T_PAAMAYIM_NEKUDOTAYIM; |
| 267 | - } elseif(T_OPEN_TAG_WITH_ECHO === $i) { |
|
| 267 | + } elseif (T_OPEN_TAG_WITH_ECHO === $i) { |
|
| 268 | 268 | // T_OPEN_TAG_WITH_ECHO with dropped T_OPEN_TAG results in T_ECHO |
| 269 | 269 | $tokenMap[$i] = Tokens::T_ECHO; |
| 270 | - } elseif(T_CLOSE_TAG === $i) { |
|
| 270 | + } elseif (T_CLOSE_TAG === $i) { |
|
| 271 | 271 | // T_CLOSE_TAG is equivalent to ';' |
| 272 | 272 | $tokenMap[$i] = ord(';'); |
| 273 | 273 | } elseif ('UNKNOWN' !== $name = token_name($i)) { |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | if ('\'' === $str[$bLength]) { |
| 56 | 56 | return str_replace( |
| 57 | 57 | array('\\\\', '\\\''), |
| 58 | - array( '\\', '\''), |
|
| 58 | + array('\\', '\''), |
|
| 59 | 59 | substr($str, $bLength + 1, -1) |
| 60 | 60 | ); |
| 61 | 61 | } else { |
@@ -110,14 +110,14 @@ discard block |
||
| 110 | 110 | return chr($num); |
| 111 | 111 | } |
| 112 | 112 | if ($num <= 0x7FF) { |
| 113 | - return chr(($num>>6) + 0xC0) . chr(($num&0x3F) + 0x80); |
|
| 113 | + return chr(($num >> 6) + 0xC0) . chr(($num & 0x3F) + 0x80); |
|
| 114 | 114 | } |
| 115 | 115 | if ($num <= 0xFFFF) { |
| 116 | - return chr(($num>>12) + 0xE0) . chr((($num>>6)&0x3F) + 0x80) . chr(($num&0x3F) + 0x80); |
|
| 116 | + return chr(($num >> 12) + 0xE0) . chr((($num >> 6) & 0x3F) + 0x80) . chr(($num & 0x3F) + 0x80); |
|
| 117 | 117 | } |
| 118 | 118 | if ($num <= 0x1FFFFF) { |
| 119 | - return chr(($num>>18) + 0xF0) . chr((($num>>12)&0x3F) + 0x80) |
|
| 120 | - . chr((($num>>6)&0x3F) + 0x80) . chr(($num&0x3F) + 0x80); |
|
| 119 | + return chr(($num >> 18) + 0xF0) . chr((($num >> 12) & 0x3F) + 0x80) |
|
| 120 | + . chr((($num >> 6) & 0x3F) + 0x80) . chr(($num & 0x3F) + 0x80); |
|
| 121 | 121 | } |
| 122 | 122 | throw new Error('Invalid UTF-8 codepoint escape sequence: Codepoint too large'); |
| 123 | 123 | } |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | public function __construct($name, array $subNodes = array(), array $attributes = array()) { |
| 37 | 37 | parent::__construct($attributes); |
| 38 | 38 | $this->type = isset($subNodes['type']) ? $subNodes['type'] : 0; |
| 39 | - $this->byRef = isset($subNodes['byRef']) ? $subNodes['byRef'] : false; |
|
| 39 | + $this->byRef = isset($subNodes['byRef']) ? $subNodes['byRef'] : false; |
|
| 40 | 40 | $this->name = $name; |
| 41 | 41 | $this->params = isset($subNodes['params']) ? $subNodes['params'] : array(); |
| 42 | 42 | $this->returnType = isset($subNodes['returnType']) ? $subNodes['returnType'] : null; |
@@ -7,10 +7,10 @@ |
||
| 7 | 7 | |
| 8 | 8 | class Class_ extends ClassLike |
| 9 | 9 | { |
| 10 | - const MODIFIER_PUBLIC = 1; |
|
| 11 | - const MODIFIER_PROTECTED = 2; |
|
| 12 | - const MODIFIER_PRIVATE = 4; |
|
| 13 | - const MODIFIER_STATIC = 8; |
|
| 10 | + const MODIFIER_PUBLIC = 1; |
|
| 11 | + const MODIFIER_PROTECTED = 2; |
|
| 12 | + const MODIFIER_PRIVATE = 4; |
|
| 13 | + const MODIFIER_STATIC = 8; |
|
| 14 | 14 | const MODIFIER_ABSTRACT = 16; |
| 15 | 15 | const MODIFIER_FINAL = 32; |
| 16 | 16 | |
@@ -78,7 +78,7 @@ |
||
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | foreach ($node->getSubNodeNames() as $name) { |
| 81 | - $subNode =& $node->$name; |
|
| 81 | + $subNode = & $node->$name; |
|
| 82 | 82 | |
| 83 | 83 | if (is_array($subNode)) { |
| 84 | 84 | $subNode = $this->traverseArray($subNode); |
@@ -7,8 +7,8 @@ |
||
| 7 | 7 | */ |
| 8 | 8 | class NodeVisitorAbstract implements NodeVisitor |
| 9 | 9 | { |
| 10 | - public function beforeTraverse(array $nodes) { } |
|
| 10 | + public function beforeTraverse(array $nodes) { } |
|
| 11 | 11 | public function enterNode(Node $node) { } |
| 12 | 12 | public function leaveNode(Node $node) { } |
| 13 | - public function afterTraverse(array $nodes) { } |
|
| 13 | + public function afterTraverse(array $nodes) { } |
|
| 14 | 14 | } |
| 15 | 15 | \ No newline at end of file |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | |
| 185 | 185 | // This is necessary to assign some meaningful attributes to /* empty */ productions. They'll get |
| 186 | 186 | // the attributes of the next token, even though they don't contain it themselves. |
| 187 | - $this->startAttributeStack[$this->stackPos+1] = $startAttributes; |
|
| 187 | + $this->startAttributeStack[$this->stackPos + 1] = $startAttributes; |
|
| 188 | 188 | |
| 189 | 189 | //$this->traceRead($symbol); |
| 190 | 190 | } |
@@ -426,11 +426,11 @@ discard block |
||
| 426 | 426 | } else { |
| 427 | 427 | // For semicolon namespaces we have to move the statements after a namespace declaration into ->stmts |
| 428 | 428 | $resultStmts = array(); |
| 429 | - $targetStmts =& $resultStmts; |
|
| 429 | + $targetStmts = & $resultStmts; |
|
| 430 | 430 | foreach ($stmts as $stmt) { |
| 431 | 431 | if ($stmt instanceof Node\Stmt\Namespace_) { |
| 432 | 432 | $stmt->stmts = array(); |
| 433 | - $targetStmts =& $stmt->stmts; |
|
| 433 | + $targetStmts = & $stmt->stmts; |
|
| 434 | 434 | $resultStmts[] = $stmt; |
| 435 | 435 | } elseif ($stmt instanceof Node\Stmt\HaltCompiler) { |
| 436 | 436 | // __halt_compiler() is not moved into the namespace |
@@ -463,7 +463,7 @@ discard block |
||
| 463 | 463 | return ($node->static ? 'static ' : '') |
| 464 | 464 | . 'function ' . ($node->byRef ? '&' : '') |
| 465 | 465 | . '(' . $this->pCommaSeparated($node->params) . ')' |
| 466 | - . (!empty($node->uses) ? ' use(' . $this->pCommaSeparated($node->uses) . ')': '') |
|
| 466 | + . (!empty($node->uses) ? ' use(' . $this->pCommaSeparated($node->uses) . ')' : '') |
|
| 467 | 467 | . (null !== $node->returnType ? ' : ' . $this->pType($node->returnType) : '') |
| 468 | 468 | . ' {' . $this->pStmts($node->stmts) . "\n" . '}'; |
| 469 | 469 | } |
@@ -570,7 +570,7 @@ discard block |
||
| 570 | 570 | return (null !== $node->trait ? $this->p($node->trait) . '::' : '') |
| 571 | 571 | . $node->method . ' as' |
| 572 | 572 | . (null !== $node->newModifier ? ' ' . rtrim($this->pModifiers($node->newModifier), ' ') : '') |
| 573 | - . (null !== $node->newName ? ' ' . $node->newName : '') |
|
| 573 | + . (null !== $node->newName ? ' ' . $node->newName : '') |
|
| 574 | 574 | . ';'; |
| 575 | 575 | } |
| 576 | 576 | |
@@ -761,12 +761,12 @@ discard block |
||
| 761 | 761 | } |
| 762 | 762 | |
| 763 | 763 | protected function pModifiers($modifiers) { |
| 764 | - return ($modifiers & Stmt\Class_::MODIFIER_PUBLIC ? 'public ' : '') |
|
| 764 | + return ($modifiers & Stmt\Class_::MODIFIER_PUBLIC ? 'public ' : '') |
|
| 765 | 765 | . ($modifiers & Stmt\Class_::MODIFIER_PROTECTED ? 'protected ' : '') |
| 766 | - . ($modifiers & Stmt\Class_::MODIFIER_PRIVATE ? 'private ' : '') |
|
| 767 | - . ($modifiers & Stmt\Class_::MODIFIER_STATIC ? 'static ' : '') |
|
| 768 | - . ($modifiers & Stmt\Class_::MODIFIER_ABSTRACT ? 'abstract ' : '') |
|
| 769 | - . ($modifiers & Stmt\Class_::MODIFIER_FINAL ? 'final ' : ''); |
|
| 766 | + . ($modifiers & Stmt\Class_::MODIFIER_PRIVATE ? 'private ' : '') |
|
| 767 | + . ($modifiers & Stmt\Class_::MODIFIER_STATIC ? 'static ' : '') |
|
| 768 | + . ($modifiers & Stmt\Class_::MODIFIER_ABSTRACT ? 'abstract ' : '') |
|
| 769 | + . ($modifiers & Stmt\Class_::MODIFIER_FINAL ? 'final ' : ''); |
|
| 770 | 770 | } |
| 771 | 771 | |
| 772 | 772 | protected function pEncapsList(array $encapsList, $quote) { |
@@ -797,7 +797,7 @@ discard block |
||
| 797 | 797 | || $node instanceof Expr\ClassConstFetch |
| 798 | 798 | ) { |
| 799 | 799 | return $this->p($node); |
| 800 | - } else { |
|
| 800 | + } else { |
|
| 801 | 801 | return '(' . $this->p($node) . ')'; |
| 802 | 802 | } |
| 803 | 803 | } |
@@ -812,7 +812,7 @@ discard block |
||
| 812 | 812 | || $node instanceof Expr\Array_ |
| 813 | 813 | ) { |
| 814 | 814 | return $this->p($node); |
| 815 | - } else { |
|
| 815 | + } else { |
|
| 816 | 816 | return '(' . $this->p($node) . ')'; |
| 817 | 817 | } |
| 818 | 818 | } |
@@ -9,65 +9,65 @@ |
||
| 9 | 9 | { |
| 10 | 10 | protected $precedenceMap = array( |
| 11 | 11 | // [precedence, associativity] where for the latter -1 is %left, 0 is %nonassoc and 1 is %right |
| 12 | - 'Expr_BinaryOp_Pow' => array( 0, 1), |
|
| 13 | - 'Expr_BitwiseNot' => array( 10, 1), |
|
| 14 | - 'Expr_PreInc' => array( 10, 1), |
|
| 15 | - 'Expr_PreDec' => array( 10, 1), |
|
| 16 | - 'Expr_PostInc' => array( 10, -1), |
|
| 17 | - 'Expr_PostDec' => array( 10, -1), |
|
| 18 | - 'Expr_UnaryPlus' => array( 10, 1), |
|
| 19 | - 'Expr_UnaryMinus' => array( 10, 1), |
|
| 20 | - 'Expr_Cast_Int' => array( 10, 1), |
|
| 21 | - 'Expr_Cast_Double' => array( 10, 1), |
|
| 22 | - 'Expr_Cast_String' => array( 10, 1), |
|
| 23 | - 'Expr_Cast_Array' => array( 10, 1), |
|
| 24 | - 'Expr_Cast_Object' => array( 10, 1), |
|
| 25 | - 'Expr_Cast_Bool' => array( 10, 1), |
|
| 26 | - 'Expr_Cast_Unset' => array( 10, 1), |
|
| 27 | - 'Expr_ErrorSuppress' => array( 10, 1), |
|
| 28 | - 'Expr_Instanceof' => array( 20, 0), |
|
| 29 | - 'Expr_BooleanNot' => array( 30, 1), |
|
| 30 | - 'Expr_BinaryOp_Mul' => array( 40, -1), |
|
| 31 | - 'Expr_BinaryOp_Div' => array( 40, -1), |
|
| 32 | - 'Expr_BinaryOp_Mod' => array( 40, -1), |
|
| 33 | - 'Expr_BinaryOp_Plus' => array( 50, -1), |
|
| 34 | - 'Expr_BinaryOp_Minus' => array( 50, -1), |
|
| 35 | - 'Expr_BinaryOp_Concat' => array( 50, -1), |
|
| 36 | - 'Expr_BinaryOp_ShiftLeft' => array( 60, -1), |
|
| 37 | - 'Expr_BinaryOp_ShiftRight' => array( 60, -1), |
|
| 38 | - 'Expr_BinaryOp_Smaller' => array( 70, 0), |
|
| 39 | - 'Expr_BinaryOp_SmallerOrEqual' => array( 70, 0), |
|
| 40 | - 'Expr_BinaryOp_Greater' => array( 70, 0), |
|
| 41 | - 'Expr_BinaryOp_GreaterOrEqual' => array( 70, 0), |
|
| 42 | - 'Expr_BinaryOp_Equal' => array( 80, 0), |
|
| 43 | - 'Expr_BinaryOp_NotEqual' => array( 80, 0), |
|
| 44 | - 'Expr_BinaryOp_Identical' => array( 80, 0), |
|
| 45 | - 'Expr_BinaryOp_NotIdentical' => array( 80, 0), |
|
| 46 | - 'Expr_BinaryOp_Spaceship' => array( 80, 0), |
|
| 47 | - 'Expr_BinaryOp_BitwiseAnd' => array( 90, -1), |
|
| 12 | + 'Expr_BinaryOp_Pow' => array(0, 1), |
|
| 13 | + 'Expr_BitwiseNot' => array(10, 1), |
|
| 14 | + 'Expr_PreInc' => array(10, 1), |
|
| 15 | + 'Expr_PreDec' => array(10, 1), |
|
| 16 | + 'Expr_PostInc' => array(10, -1), |
|
| 17 | + 'Expr_PostDec' => array(10, -1), |
|
| 18 | + 'Expr_UnaryPlus' => array(10, 1), |
|
| 19 | + 'Expr_UnaryMinus' => array(10, 1), |
|
| 20 | + 'Expr_Cast_Int' => array(10, 1), |
|
| 21 | + 'Expr_Cast_Double' => array(10, 1), |
|
| 22 | + 'Expr_Cast_String' => array(10, 1), |
|
| 23 | + 'Expr_Cast_Array' => array(10, 1), |
|
| 24 | + 'Expr_Cast_Object' => array(10, 1), |
|
| 25 | + 'Expr_Cast_Bool' => array(10, 1), |
|
| 26 | + 'Expr_Cast_Unset' => array(10, 1), |
|
| 27 | + 'Expr_ErrorSuppress' => array(10, 1), |
|
| 28 | + 'Expr_Instanceof' => array(20, 0), |
|
| 29 | + 'Expr_BooleanNot' => array(30, 1), |
|
| 30 | + 'Expr_BinaryOp_Mul' => array(40, -1), |
|
| 31 | + 'Expr_BinaryOp_Div' => array(40, -1), |
|
| 32 | + 'Expr_BinaryOp_Mod' => array(40, -1), |
|
| 33 | + 'Expr_BinaryOp_Plus' => array(50, -1), |
|
| 34 | + 'Expr_BinaryOp_Minus' => array(50, -1), |
|
| 35 | + 'Expr_BinaryOp_Concat' => array(50, -1), |
|
| 36 | + 'Expr_BinaryOp_ShiftLeft' => array(60, -1), |
|
| 37 | + 'Expr_BinaryOp_ShiftRight' => array(60, -1), |
|
| 38 | + 'Expr_BinaryOp_Smaller' => array(70, 0), |
|
| 39 | + 'Expr_BinaryOp_SmallerOrEqual' => array(70, 0), |
|
| 40 | + 'Expr_BinaryOp_Greater' => array(70, 0), |
|
| 41 | + 'Expr_BinaryOp_GreaterOrEqual' => array(70, 0), |
|
| 42 | + 'Expr_BinaryOp_Equal' => array(80, 0), |
|
| 43 | + 'Expr_BinaryOp_NotEqual' => array(80, 0), |
|
| 44 | + 'Expr_BinaryOp_Identical' => array(80, 0), |
|
| 45 | + 'Expr_BinaryOp_NotIdentical' => array(80, 0), |
|
| 46 | + 'Expr_BinaryOp_Spaceship' => array(80, 0), |
|
| 47 | + 'Expr_BinaryOp_BitwiseAnd' => array(90, -1), |
|
| 48 | 48 | 'Expr_BinaryOp_BitwiseXor' => array(100, -1), |
| 49 | 49 | 'Expr_BinaryOp_BitwiseOr' => array(110, -1), |
| 50 | 50 | 'Expr_BinaryOp_BooleanAnd' => array(120, -1), |
| 51 | 51 | 'Expr_BinaryOp_BooleanOr' => array(130, -1), |
| 52 | - 'Expr_BinaryOp_Coalesce' => array(140, 1), |
|
| 52 | + 'Expr_BinaryOp_Coalesce' => array(140, 1), |
|
| 53 | 53 | 'Expr_Ternary' => array(150, -1), |
| 54 | 54 | // parser uses %left for assignments, but they really behave as %right |
| 55 | - 'Expr_Assign' => array(160, 1), |
|
| 56 | - 'Expr_AssignRef' => array(160, 1), |
|
| 57 | - 'Expr_AssignOp_Plus' => array(160, 1), |
|
| 58 | - 'Expr_AssignOp_Minus' => array(160, 1), |
|
| 59 | - 'Expr_AssignOp_Mul' => array(160, 1), |
|
| 60 | - 'Expr_AssignOp_Div' => array(160, 1), |
|
| 61 | - 'Expr_AssignOp_Concat' => array(160, 1), |
|
| 62 | - 'Expr_AssignOp_Mod' => array(160, 1), |
|
| 63 | - 'Expr_AssignOp_BitwiseAnd' => array(160, 1), |
|
| 64 | - 'Expr_AssignOp_BitwiseOr' => array(160, 1), |
|
| 65 | - 'Expr_AssignOp_BitwiseXor' => array(160, 1), |
|
| 66 | - 'Expr_AssignOp_ShiftLeft' => array(160, 1), |
|
| 67 | - 'Expr_AssignOp_ShiftRight' => array(160, 1), |
|
| 68 | - 'Expr_AssignOp_Pow' => array(160, 1), |
|
| 69 | - 'Expr_YieldFrom' => array(165, 1), |
|
| 70 | - 'Expr_Print' => array(168, 1), |
|
| 55 | + 'Expr_Assign' => array(160, 1), |
|
| 56 | + 'Expr_AssignRef' => array(160, 1), |
|
| 57 | + 'Expr_AssignOp_Plus' => array(160, 1), |
|
| 58 | + 'Expr_AssignOp_Minus' => array(160, 1), |
|
| 59 | + 'Expr_AssignOp_Mul' => array(160, 1), |
|
| 60 | + 'Expr_AssignOp_Div' => array(160, 1), |
|
| 61 | + 'Expr_AssignOp_Concat' => array(160, 1), |
|
| 62 | + 'Expr_AssignOp_Mod' => array(160, 1), |
|
| 63 | + 'Expr_AssignOp_BitwiseAnd' => array(160, 1), |
|
| 64 | + 'Expr_AssignOp_BitwiseOr' => array(160, 1), |
|
| 65 | + 'Expr_AssignOp_BitwiseXor' => array(160, 1), |
|
| 66 | + 'Expr_AssignOp_ShiftLeft' => array(160, 1), |
|
| 67 | + 'Expr_AssignOp_ShiftRight' => array(160, 1), |
|
| 68 | + 'Expr_AssignOp_Pow' => array(160, 1), |
|
| 69 | + 'Expr_YieldFrom' => array(165, 1), |
|
| 70 | + 'Expr_Print' => array(168, 1), |
|
| 71 | 71 | 'Expr_BinaryOp_LogicalAnd' => array(170, -1), |
| 72 | 72 | 'Expr_BinaryOp_LogicalXor' => array(180, -1), |
| 73 | 73 | 'Expr_BinaryOp_LogicalOr' => array(190, -1), |