@@ -20,10 +20,16 @@ |
||
20 | 20 | 'case_separator', 'optional_comma' |
21 | 21 | )); |
22 | 22 | |
23 | +/** |
|
24 | + * @param string $regex |
|
25 | + */ |
|
23 | 26 | function regex($regex) { |
24 | 27 | return '~' . LIB . '(?:' . str_replace('~', '\~', $regex) . ')~'; |
25 | 28 | } |
26 | 29 | |
30 | +/** |
|
31 | + * @param string $regex |
|
32 | + */ |
|
27 | 33 | function magicSplit($regex, $string) { |
28 | 34 | $pieces = preg_split(regex('(?:(?&string)|(?&comment)|(?&code))(*SKIP)(*FAIL)|' . $regex), $string); |
29 | 35 |
@@ -175,6 +175,9 @@ discard block |
||
175 | 175 | ); |
176 | 176 | } |
177 | 177 | |
178 | +/** |
|
179 | + * @param integer $num |
|
180 | + */ |
|
178 | 181 | function assertArgs($num, $args, $name) { |
179 | 182 | if ($num != count($args)) { |
180 | 183 | die('Wrong argument count for ' . $name . '().'); |
@@ -203,10 +206,16 @@ discard block |
||
203 | 206 | /// Regex helper functions /// |
204 | 207 | ////////////////////////////// |
205 | 208 | |
209 | +/** |
|
210 | + * @param string $regex |
|
211 | + */ |
|
206 | 212 | function regex($regex) { |
207 | 213 | return '~' . LIB . '(?:' . str_replace('~', '\~', $regex) . ')~'; |
208 | 214 | } |
209 | 215 | |
216 | +/** |
|
217 | + * @param string $regex |
|
218 | + */ |
|
210 | 219 | function magicSplit($regex, $string) { |
211 | 220 | $pieces = preg_split(regex('(?:(?&string)|(?&comment)|(?&code))(*SKIP)(*FAIL)|' . $regex), $string); |
212 | 221 |
@@ -44,8 +44,6 @@ |
||
44 | 44 | /** |
45 | 45 | * Implements one or more interfaces. |
46 | 46 | * |
47 | - * @param Name|string $interface Name of interface to implement |
|
48 | - * @param Name|string $... More interfaces to implement |
|
49 | 47 | * |
50 | 48 | * @return $this The builder instance (for fluid interface) |
51 | 49 | */ |
@@ -25,8 +25,6 @@ |
||
25 | 25 | /** |
26 | 26 | * Extends one or more interfaces. |
27 | 27 | * |
28 | - * @param Name|string $interface Name of interface to extend |
|
29 | - * @param Name|string $... More interfaces to extend |
|
30 | 28 | * |
31 | 29 | * @return $this The builder instance (for fluid interface) |
32 | 30 | */ |
@@ -110,6 +110,9 @@ |
||
110 | 110 | ); |
111 | 111 | } |
112 | 112 | |
113 | + /** |
|
114 | + * @param Name $type |
|
115 | + */ |
|
113 | 116 | protected function addAlias(Stmt\UseUse $use, $type, Name $prefix = null) { |
114 | 117 | // Add prefix for group uses |
115 | 118 | $name = $prefix ? Name::concat($prefix, $use->name) : $use->name; |
@@ -51,6 +51,9 @@ |
||
51 | 51 | return $this->errors; |
52 | 52 | } |
53 | 53 | |
54 | + /** |
|
55 | + * @param string $code |
|
56 | + */ |
|
54 | 57 | private function tryParse(Parser $parser, $code) { |
55 | 58 | $stmts = null; |
56 | 59 | $error = null; |
@@ -534,6 +534,9 @@ discard block |
||
534 | 534 | . ($node->name->getLast() !== $node->alias ? ' as ' . $node->alias : ''); |
535 | 535 | } |
536 | 536 | |
537 | + /** |
|
538 | + * @param integer $type |
|
539 | + */ |
|
537 | 540 | private function pUseType($type) { |
538 | 541 | return $type === Stmt\Use_::TYPE_FUNCTION ? 'function ' |
539 | 542 | : ($type === Stmt\Use_::TYPE_CONSTANT ? 'const ' : ''); |
@@ -744,6 +747,9 @@ discard block |
||
744 | 747 | return is_string($node) ? $node : $this->p($node); |
745 | 748 | } |
746 | 749 | |
750 | + /** |
|
751 | + * @param string $afterClassToken |
|
752 | + */ |
|
747 | 753 | protected function pClassCommon(Stmt\Class_ $node, $afterClassToken) { |
748 | 754 | return $this->pModifiers($node->type) |
749 | 755 | . 'class' . $afterClassToken |
@@ -760,6 +766,9 @@ discard block |
||
760 | 766 | } |
761 | 767 | } |
762 | 768 | |
769 | + /** |
|
770 | + * @param integer $modifiers |
|
771 | + */ |
|
763 | 772 | protected function pModifiers($modifiers) { |
764 | 773 | return ($modifiers & Stmt\Class_::MODIFIER_PUBLIC ? 'public ' : '') |
765 | 774 | . ($modifiers & Stmt\Class_::MODIFIER_PROTECTED ? 'protected ' : '') |
@@ -769,6 +778,9 @@ discard block |
||
769 | 778 | . ($modifiers & Stmt\Class_::MODIFIER_FINAL ? 'final ' : ''); |
770 | 779 | } |
771 | 780 | |
781 | + /** |
|
782 | + * @param string $quote |
|
783 | + */ |
|
772 | 784 | protected function pEncapsList(array $encapsList, $quote) { |
773 | 785 | $return = ''; |
774 | 786 | foreach ($encapsList as $element) { |
@@ -187,6 +187,10 @@ discard block |
||
187 | 187 | return $this->{'p' . $node->getType()}($node); |
188 | 188 | } |
189 | 189 | |
190 | + /** |
|
191 | + * @param string $type |
|
192 | + * @param string $operatorString |
|
193 | + */ |
|
190 | 194 | protected function pInfixOp($type, Node $leftNode, $operatorString, Node $rightNode) { |
191 | 195 | list($precedence, $associativity) = $this->precedenceMap[$type]; |
192 | 196 | |
@@ -195,11 +199,19 @@ discard block |
||
195 | 199 | . $this->pPrec($rightNode, $precedence, $associativity, 1); |
196 | 200 | } |
197 | 201 | |
202 | + /** |
|
203 | + * @param string $type |
|
204 | + * @param string $operatorString |
|
205 | + */ |
|
198 | 206 | protected function pPrefixOp($type, $operatorString, Node $node) { |
199 | 207 | list($precedence, $associativity) = $this->precedenceMap[$type]; |
200 | 208 | return $operatorString . $this->pPrec($node, $precedence, $associativity, 1); |
201 | 209 | } |
202 | 210 | |
211 | + /** |
|
212 | + * @param string $type |
|
213 | + * @param string $operatorString |
|
214 | + */ |
|
203 | 215 | protected function pPostfixOp($type, Node $node, $operatorString) { |
204 | 216 | list($precedence, $associativity) = $this->precedenceMap[$type]; |
205 | 217 | return $this->pPrec($node, $precedence, $associativity, -1) . $operatorString; |
@@ -264,7 +276,7 @@ discard block |
||
264 | 276 | * |
265 | 277 | * @param string $string Not to be indented string |
266 | 278 | * |
267 | - * @return mixed String marked with $this->noIndentToken's. |
|
279 | + * @return string String marked with $this->noIndentToken's. |
|
268 | 280 | */ |
269 | 281 | protected function pNoIndent($string) { |
270 | 282 | return str_replace("\n", "\n" . $this->noIndentToken, $string); |
@@ -2820,7 +2820,10 @@ |
||
2820 | 2820 | } |
2821 | 2821 | |
2822 | 2822 | protected function reduceRule463() { |
2823 | - foreach ($this->semStack[$this->stackPos-(3-2)] as $s) { if ($s instanceof Node\Scalar\EncapsedStringPart) { $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, null, false); } } $s->value = preg_replace('~(\r\n|\n|\r)\z~', '', $s->value); if ('' === $s->value) array_pop($this->semStack[$this->stackPos-(3-2)]);; $this->semValue = new Scalar\Encapsed($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); |
|
2823 | + foreach ($this->semStack[$this->stackPos-(3-2)] as $s) { if ($s instanceof Node\Scalar\EncapsedStringPart) { $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, null, false); } } $s->value = preg_replace('~(\r\n|\n|\r)\z~', '', $s->value); if ('' === $s->value) { |
|
2824 | + array_pop($this->semStack[$this->stackPos-(3-2)]); |
|
2825 | + } |
|
2826 | + ; $this->semValue = new Scalar\Encapsed($this->semStack[$this->stackPos-(3-2)], $this->startAttributeStack[$this->stackPos-(3-1)] + $this->endAttributes); |
|
2824 | 2827 | } |
2825 | 2828 | |
2826 | 2829 | protected function reduceRule464() { |