Completed
Branch master (8e512a)
by
unknown
17:03 queued 09:20
created
vendor/nikic/php-parser/lib/PhpParser/PrettyPrinter/Standard.php 2 patches
Indentation   +1075 added lines, -1075 removed lines patch added patch discarded remove patch
@@ -15,1009 +15,1009 @@  discard block
 block discarded – undo
15 15
 
16 16
 class Standard extends PrettyPrinterAbstract
17 17
 {
18
-    // Special nodes
19
-
20
-    protected function pParam(Node\Param $node) {
21
-        return $this->pAttrGroups($node->attrGroups, true)
22
-             . $this->pModifiers($node->flags)
23
-             . ($node->type ? $this->p($node->type) . ' ' : '')
24
-             . ($node->byRef ? '&' : '')
25
-             . ($node->variadic ? '...' : '')
26
-             . $this->p($node->var)
27
-             . ($node->default ? ' = ' . $this->p($node->default) : '');
28
-    }
29
-
30
-    protected function pArg(Node\Arg $node) {
31
-        return ($node->name ? $node->name->toString() . ': ' : '')
32
-             . ($node->byRef ? '&' : '') . ($node->unpack ? '...' : '')
33
-             . $this->p($node->value);
34
-    }
35
-
36
-    protected function pVariadicPlaceholder(Node\VariadicPlaceholder $node) {
37
-        return '...';
38
-    }
39
-
40
-    protected function pConst(Node\Const_ $node) {
41
-        return $node->name . ' = ' . $this->p($node->value);
42
-    }
43
-
44
-    protected function pNullableType(Node\NullableType $node) {
45
-        return '?' . $this->p($node->type);
46
-    }
47
-
48
-    protected function pUnionType(Node\UnionType $node) {
49
-        $types = [];
50
-        foreach ($node->types as $typeNode) {
51
-            if ($typeNode instanceof Node\IntersectionType) {
52
-                $types[] = '('. $this->p($typeNode) . ')';
53
-                continue;
54
-            }
55
-            $types[] = $this->p($typeNode);
56
-        }
57
-        return implode('|', $types);
58
-    }
59
-
60
-    protected function pIntersectionType(Node\IntersectionType $node) {
61
-        return $this->pImplode($node->types, '&');
62
-    }
63
-
64
-    protected function pIdentifier(Node\Identifier $node) {
65
-        return $node->name;
66
-    }
67
-
68
-    protected function pVarLikeIdentifier(Node\VarLikeIdentifier $node) {
69
-        return '$' . $node->name;
70
-    }
71
-
72
-    protected function pAttribute(Node\Attribute $node) {
73
-        return $this->p($node->name)
74
-             . ($node->args ? '(' . $this->pCommaSeparated($node->args) . ')' : '');
75
-    }
76
-
77
-    protected function pAttributeGroup(Node\AttributeGroup $node) {
78
-        return '#[' . $this->pCommaSeparated($node->attrs) . ']';
79
-    }
80
-
81
-    // Names
82
-
83
-    protected function pName(Name $node) {
84
-        return implode('\\', $node->parts);
85
-    }
86
-
87
-    protected function pName_FullyQualified(Name\FullyQualified $node) {
88
-        return '\\' . implode('\\', $node->parts);
89
-    }
90
-
91
-    protected function pName_Relative(Name\Relative $node) {
92
-        return 'namespace\\' . implode('\\', $node->parts);
93
-    }
94
-
95
-    // Magic Constants
96
-
97
-    protected function pScalar_MagicConst_Class(MagicConst\Class_ $node) {
98
-        return '__CLASS__';
99
-    }
100
-
101
-    protected function pScalar_MagicConst_Dir(MagicConst\Dir $node) {
102
-        return '__DIR__';
103
-    }
104
-
105
-    protected function pScalar_MagicConst_File(MagicConst\File $node) {
106
-        return '__FILE__';
107
-    }
108
-
109
-    protected function pScalar_MagicConst_Function(MagicConst\Function_ $node) {
110
-        return '__FUNCTION__';
111
-    }
112
-
113
-    protected function pScalar_MagicConst_Line(MagicConst\Line $node) {
114
-        return '__LINE__';
115
-    }
116
-
117
-    protected function pScalar_MagicConst_Method(MagicConst\Method $node) {
118
-        return '__METHOD__';
119
-    }
120
-
121
-    protected function pScalar_MagicConst_Namespace(MagicConst\Namespace_ $node) {
122
-        return '__NAMESPACE__';
123
-    }
124
-
125
-    protected function pScalar_MagicConst_Trait(MagicConst\Trait_ $node) {
126
-        return '__TRAIT__';
127
-    }
128
-
129
-    // Scalars
130
-
131
-    protected function pScalar_String(Scalar\String_ $node) {
132
-        $kind = $node->getAttribute('kind', Scalar\String_::KIND_SINGLE_QUOTED);
133
-        switch ($kind) {
134
-            case Scalar\String_::KIND_NOWDOC:
135
-                $label = $node->getAttribute('docLabel');
136
-                if ($label && !$this->containsEndLabel($node->value, $label)) {
137
-                    if ($node->value === '') {
138
-                        return "<<<'$label'\n$label" . $this->docStringEndToken;
139
-                    }
140
-
141
-                    return "<<<'$label'\n$node->value\n$label"
142
-                         . $this->docStringEndToken;
143
-                }
144
-                /* break missing intentionally */
145
-            case Scalar\String_::KIND_SINGLE_QUOTED:
146
-                return $this->pSingleQuotedString($node->value);
147
-            case Scalar\String_::KIND_HEREDOC:
148
-                $label = $node->getAttribute('docLabel');
149
-                if ($label && !$this->containsEndLabel($node->value, $label)) {
150
-                    if ($node->value === '') {
151
-                        return "<<<$label\n$label" . $this->docStringEndToken;
152
-                    }
153
-
154
-                    $escaped = $this->escapeString($node->value, null);
155
-                    return "<<<$label\n" . $escaped . "\n$label"
156
-                         . $this->docStringEndToken;
157
-                }
158
-            /* break missing intentionally */
159
-            case Scalar\String_::KIND_DOUBLE_QUOTED:
160
-                return '"' . $this->escapeString($node->value, '"') . '"';
161
-        }
162
-        throw new \Exception('Invalid string kind');
163
-    }
164
-
165
-    protected function pScalar_Encapsed(Scalar\Encapsed $node) {
166
-        if ($node->getAttribute('kind') === Scalar\String_::KIND_HEREDOC) {
167
-            $label = $node->getAttribute('docLabel');
168
-            if ($label && !$this->encapsedContainsEndLabel($node->parts, $label)) {
169
-                if (count($node->parts) === 1
170
-                    && $node->parts[0] instanceof Scalar\EncapsedStringPart
171
-                    && $node->parts[0]->value === ''
172
-                ) {
173
-                    return "<<<$label\n$label" . $this->docStringEndToken;
174
-                }
175
-
176
-                return "<<<$label\n" . $this->pEncapsList($node->parts, null) . "\n$label"
177
-                     . $this->docStringEndToken;
178
-            }
179
-        }
180
-        return '"' . $this->pEncapsList($node->parts, '"') . '"';
181
-    }
182
-
183
-    protected function pScalar_LNumber(Scalar\LNumber $node) {
184
-        if ($node->value === -\PHP_INT_MAX-1) {
185
-            // PHP_INT_MIN cannot be represented as a literal,
186
-            // because the sign is not part of the literal
187
-            return '(-' . \PHP_INT_MAX . '-1)';
188
-        }
189
-
190
-        $kind = $node->getAttribute('kind', Scalar\LNumber::KIND_DEC);
191
-        if (Scalar\LNumber::KIND_DEC === $kind) {
192
-            return (string) $node->value;
193
-        }
194
-
195
-        if ($node->value < 0) {
196
-            $sign = '-';
197
-            $str = (string) -$node->value;
198
-        } else {
199
-            $sign = '';
200
-            $str = (string) $node->value;
201
-        }
202
-        switch ($kind) {
203
-            case Scalar\LNumber::KIND_BIN:
204
-                return $sign . '0b' . base_convert($str, 10, 2);
205
-            case Scalar\LNumber::KIND_OCT:
206
-                return $sign . '0' . base_convert($str, 10, 8);
207
-            case Scalar\LNumber::KIND_HEX:
208
-                return $sign . '0x' . base_convert($str, 10, 16);
209
-        }
210
-        throw new \Exception('Invalid number kind');
211
-    }
212
-
213
-    protected function pScalar_DNumber(Scalar\DNumber $node) {
214
-        if (!is_finite($node->value)) {
215
-            if ($node->value === \INF) {
216
-                return '\INF';
217
-            } elseif ($node->value === -\INF) {
218
-                return '-\INF';
219
-            } else {
220
-                return '\NAN';
221
-            }
222
-        }
223
-
224
-        // Try to find a short full-precision representation
225
-        $stringValue = sprintf('%.16G', $node->value);
226
-        if ($node->value !== (double) $stringValue) {
227
-            $stringValue = sprintf('%.17G', $node->value);
228
-        }
229
-
230
-        // %G is locale dependent and there exists no locale-independent alternative. We don't want
231
-        // mess with switching locales here, so let's assume that a comma is the only non-standard
232
-        // decimal separator we may encounter...
233
-        $stringValue = str_replace(',', '.', $stringValue);
234
-
235
-        // ensure that number is really printed as float
236
-        return preg_match('/^-?[0-9]+$/', $stringValue) ? $stringValue . '.0' : $stringValue;
237
-    }
238
-
239
-    protected function pScalar_EncapsedStringPart(Scalar\EncapsedStringPart $node) {
240
-        throw new \LogicException('Cannot directly print EncapsedStringPart');
241
-    }
242
-
243
-    // Assignments
244
-
245
-    protected function pExpr_Assign(Expr\Assign $node) {
246
-        return $this->pInfixOp(Expr\Assign::class, $node->var, ' = ', $node->expr);
247
-    }
248
-
249
-    protected function pExpr_AssignRef(Expr\AssignRef $node) {
250
-        return $this->pInfixOp(Expr\AssignRef::class, $node->var, ' =& ', $node->expr);
251
-    }
252
-
253
-    protected function pExpr_AssignOp_Plus(AssignOp\Plus $node) {
254
-        return $this->pInfixOp(AssignOp\Plus::class, $node->var, ' += ', $node->expr);
255
-    }
256
-
257
-    protected function pExpr_AssignOp_Minus(AssignOp\Minus $node) {
258
-        return $this->pInfixOp(AssignOp\Minus::class, $node->var, ' -= ', $node->expr);
259
-    }
260
-
261
-    protected function pExpr_AssignOp_Mul(AssignOp\Mul $node) {
262
-        return $this->pInfixOp(AssignOp\Mul::class, $node->var, ' *= ', $node->expr);
263
-    }
264
-
265
-    protected function pExpr_AssignOp_Div(AssignOp\Div $node) {
266
-        return $this->pInfixOp(AssignOp\Div::class, $node->var, ' /= ', $node->expr);
267
-    }
268
-
269
-    protected function pExpr_AssignOp_Concat(AssignOp\Concat $node) {
270
-        return $this->pInfixOp(AssignOp\Concat::class, $node->var, ' .= ', $node->expr);
271
-    }
272
-
273
-    protected function pExpr_AssignOp_Mod(AssignOp\Mod $node) {
274
-        return $this->pInfixOp(AssignOp\Mod::class, $node->var, ' %= ', $node->expr);
275
-    }
276
-
277
-    protected function pExpr_AssignOp_BitwiseAnd(AssignOp\BitwiseAnd $node) {
278
-        return $this->pInfixOp(AssignOp\BitwiseAnd::class, $node->var, ' &= ', $node->expr);
279
-    }
280
-
281
-    protected function pExpr_AssignOp_BitwiseOr(AssignOp\BitwiseOr $node) {
282
-        return $this->pInfixOp(AssignOp\BitwiseOr::class, $node->var, ' |= ', $node->expr);
283
-    }
284
-
285
-    protected function pExpr_AssignOp_BitwiseXor(AssignOp\BitwiseXor $node) {
286
-        return $this->pInfixOp(AssignOp\BitwiseXor::class, $node->var, ' ^= ', $node->expr);
287
-    }
288
-
289
-    protected function pExpr_AssignOp_ShiftLeft(AssignOp\ShiftLeft $node) {
290
-        return $this->pInfixOp(AssignOp\ShiftLeft::class, $node->var, ' <<= ', $node->expr);
291
-    }
292
-
293
-    protected function pExpr_AssignOp_ShiftRight(AssignOp\ShiftRight $node) {
294
-        return $this->pInfixOp(AssignOp\ShiftRight::class, $node->var, ' >>= ', $node->expr);
295
-    }
296
-
297
-    protected function pExpr_AssignOp_Pow(AssignOp\Pow $node) {
298
-        return $this->pInfixOp(AssignOp\Pow::class, $node->var, ' **= ', $node->expr);
299
-    }
300
-
301
-    protected function pExpr_AssignOp_Coalesce(AssignOp\Coalesce $node) {
302
-        return $this->pInfixOp(AssignOp\Coalesce::class, $node->var, ' ??= ', $node->expr);
303
-    }
304
-
305
-    // Binary expressions
306
-
307
-    protected function pExpr_BinaryOp_Plus(BinaryOp\Plus $node) {
308
-        return $this->pInfixOp(BinaryOp\Plus::class, $node->left, ' + ', $node->right);
309
-    }
310
-
311
-    protected function pExpr_BinaryOp_Minus(BinaryOp\Minus $node) {
312
-        return $this->pInfixOp(BinaryOp\Minus::class, $node->left, ' - ', $node->right);
313
-    }
314
-
315
-    protected function pExpr_BinaryOp_Mul(BinaryOp\Mul $node) {
316
-        return $this->pInfixOp(BinaryOp\Mul::class, $node->left, ' * ', $node->right);
317
-    }
318
-
319
-    protected function pExpr_BinaryOp_Div(BinaryOp\Div $node) {
320
-        return $this->pInfixOp(BinaryOp\Div::class, $node->left, ' / ', $node->right);
321
-    }
18
+	// Special nodes
19
+
20
+	protected function pParam(Node\Param $node) {
21
+		return $this->pAttrGroups($node->attrGroups, true)
22
+			 . $this->pModifiers($node->flags)
23
+			 . ($node->type ? $this->p($node->type) . ' ' : '')
24
+			 . ($node->byRef ? '&' : '')
25
+			 . ($node->variadic ? '...' : '')
26
+			 . $this->p($node->var)
27
+			 . ($node->default ? ' = ' . $this->p($node->default) : '');
28
+	}
29
+
30
+	protected function pArg(Node\Arg $node) {
31
+		return ($node->name ? $node->name->toString() . ': ' : '')
32
+			 . ($node->byRef ? '&' : '') . ($node->unpack ? '...' : '')
33
+			 . $this->p($node->value);
34
+	}
35
+
36
+	protected function pVariadicPlaceholder(Node\VariadicPlaceholder $node) {
37
+		return '...';
38
+	}
39
+
40
+	protected function pConst(Node\Const_ $node) {
41
+		return $node->name . ' = ' . $this->p($node->value);
42
+	}
43
+
44
+	protected function pNullableType(Node\NullableType $node) {
45
+		return '?' . $this->p($node->type);
46
+	}
47
+
48
+	protected function pUnionType(Node\UnionType $node) {
49
+		$types = [];
50
+		foreach ($node->types as $typeNode) {
51
+			if ($typeNode instanceof Node\IntersectionType) {
52
+				$types[] = '('. $this->p($typeNode) . ')';
53
+				continue;
54
+			}
55
+			$types[] = $this->p($typeNode);
56
+		}
57
+		return implode('|', $types);
58
+	}
59
+
60
+	protected function pIntersectionType(Node\IntersectionType $node) {
61
+		return $this->pImplode($node->types, '&');
62
+	}
63
+
64
+	protected function pIdentifier(Node\Identifier $node) {
65
+		return $node->name;
66
+	}
67
+
68
+	protected function pVarLikeIdentifier(Node\VarLikeIdentifier $node) {
69
+		return '$' . $node->name;
70
+	}
71
+
72
+	protected function pAttribute(Node\Attribute $node) {
73
+		return $this->p($node->name)
74
+			 . ($node->args ? '(' . $this->pCommaSeparated($node->args) . ')' : '');
75
+	}
76
+
77
+	protected function pAttributeGroup(Node\AttributeGroup $node) {
78
+		return '#[' . $this->pCommaSeparated($node->attrs) . ']';
79
+	}
80
+
81
+	// Names
82
+
83
+	protected function pName(Name $node) {
84
+		return implode('\\', $node->parts);
85
+	}
86
+
87
+	protected function pName_FullyQualified(Name\FullyQualified $node) {
88
+		return '\\' . implode('\\', $node->parts);
89
+	}
90
+
91
+	protected function pName_Relative(Name\Relative $node) {
92
+		return 'namespace\\' . implode('\\', $node->parts);
93
+	}
94
+
95
+	// Magic Constants
96
+
97
+	protected function pScalar_MagicConst_Class(MagicConst\Class_ $node) {
98
+		return '__CLASS__';
99
+	}
100
+
101
+	protected function pScalar_MagicConst_Dir(MagicConst\Dir $node) {
102
+		return '__DIR__';
103
+	}
104
+
105
+	protected function pScalar_MagicConst_File(MagicConst\File $node) {
106
+		return '__FILE__';
107
+	}
108
+
109
+	protected function pScalar_MagicConst_Function(MagicConst\Function_ $node) {
110
+		return '__FUNCTION__';
111
+	}
112
+
113
+	protected function pScalar_MagicConst_Line(MagicConst\Line $node) {
114
+		return '__LINE__';
115
+	}
116
+
117
+	protected function pScalar_MagicConst_Method(MagicConst\Method $node) {
118
+		return '__METHOD__';
119
+	}
120
+
121
+	protected function pScalar_MagicConst_Namespace(MagicConst\Namespace_ $node) {
122
+		return '__NAMESPACE__';
123
+	}
124
+
125
+	protected function pScalar_MagicConst_Trait(MagicConst\Trait_ $node) {
126
+		return '__TRAIT__';
127
+	}
128
+
129
+	// Scalars
130
+
131
+	protected function pScalar_String(Scalar\String_ $node) {
132
+		$kind = $node->getAttribute('kind', Scalar\String_::KIND_SINGLE_QUOTED);
133
+		switch ($kind) {
134
+			case Scalar\String_::KIND_NOWDOC:
135
+				$label = $node->getAttribute('docLabel');
136
+				if ($label && !$this->containsEndLabel($node->value, $label)) {
137
+					if ($node->value === '') {
138
+						return "<<<'$label'\n$label" . $this->docStringEndToken;
139
+					}
140
+
141
+					return "<<<'$label'\n$node->value\n$label"
142
+						 . $this->docStringEndToken;
143
+				}
144
+				/* break missing intentionally */
145
+			case Scalar\String_::KIND_SINGLE_QUOTED:
146
+				return $this->pSingleQuotedString($node->value);
147
+			case Scalar\String_::KIND_HEREDOC:
148
+				$label = $node->getAttribute('docLabel');
149
+				if ($label && !$this->containsEndLabel($node->value, $label)) {
150
+					if ($node->value === '') {
151
+						return "<<<$label\n$label" . $this->docStringEndToken;
152
+					}
153
+
154
+					$escaped = $this->escapeString($node->value, null);
155
+					return "<<<$label\n" . $escaped . "\n$label"
156
+						 . $this->docStringEndToken;
157
+				}
158
+			/* break missing intentionally */
159
+			case Scalar\String_::KIND_DOUBLE_QUOTED:
160
+				return '"' . $this->escapeString($node->value, '"') . '"';
161
+		}
162
+		throw new \Exception('Invalid string kind');
163
+	}
164
+
165
+	protected function pScalar_Encapsed(Scalar\Encapsed $node) {
166
+		if ($node->getAttribute('kind') === Scalar\String_::KIND_HEREDOC) {
167
+			$label = $node->getAttribute('docLabel');
168
+			if ($label && !$this->encapsedContainsEndLabel($node->parts, $label)) {
169
+				if (count($node->parts) === 1
170
+					&& $node->parts[0] instanceof Scalar\EncapsedStringPart
171
+					&& $node->parts[0]->value === ''
172
+				) {
173
+					return "<<<$label\n$label" . $this->docStringEndToken;
174
+				}
175
+
176
+				return "<<<$label\n" . $this->pEncapsList($node->parts, null) . "\n$label"
177
+					 . $this->docStringEndToken;
178
+			}
179
+		}
180
+		return '"' . $this->pEncapsList($node->parts, '"') . '"';
181
+	}
182
+
183
+	protected function pScalar_LNumber(Scalar\LNumber $node) {
184
+		if ($node->value === -\PHP_INT_MAX-1) {
185
+			// PHP_INT_MIN cannot be represented as a literal,
186
+			// because the sign is not part of the literal
187
+			return '(-' . \PHP_INT_MAX . '-1)';
188
+		}
189
+
190
+		$kind = $node->getAttribute('kind', Scalar\LNumber::KIND_DEC);
191
+		if (Scalar\LNumber::KIND_DEC === $kind) {
192
+			return (string) $node->value;
193
+		}
194
+
195
+		if ($node->value < 0) {
196
+			$sign = '-';
197
+			$str = (string) -$node->value;
198
+		} else {
199
+			$sign = '';
200
+			$str = (string) $node->value;
201
+		}
202
+		switch ($kind) {
203
+			case Scalar\LNumber::KIND_BIN:
204
+				return $sign . '0b' . base_convert($str, 10, 2);
205
+			case Scalar\LNumber::KIND_OCT:
206
+				return $sign . '0' . base_convert($str, 10, 8);
207
+			case Scalar\LNumber::KIND_HEX:
208
+				return $sign . '0x' . base_convert($str, 10, 16);
209
+		}
210
+		throw new \Exception('Invalid number kind');
211
+	}
212
+
213
+	protected function pScalar_DNumber(Scalar\DNumber $node) {
214
+		if (!is_finite($node->value)) {
215
+			if ($node->value === \INF) {
216
+				return '\INF';
217
+			} elseif ($node->value === -\INF) {
218
+				return '-\INF';
219
+			} else {
220
+				return '\NAN';
221
+			}
222
+		}
223
+
224
+		// Try to find a short full-precision representation
225
+		$stringValue = sprintf('%.16G', $node->value);
226
+		if ($node->value !== (double) $stringValue) {
227
+			$stringValue = sprintf('%.17G', $node->value);
228
+		}
229
+
230
+		// %G is locale dependent and there exists no locale-independent alternative. We don't want
231
+		// mess with switching locales here, so let's assume that a comma is the only non-standard
232
+		// decimal separator we may encounter...
233
+		$stringValue = str_replace(',', '.', $stringValue);
234
+
235
+		// ensure that number is really printed as float
236
+		return preg_match('/^-?[0-9]+$/', $stringValue) ? $stringValue . '.0' : $stringValue;
237
+	}
238
+
239
+	protected function pScalar_EncapsedStringPart(Scalar\EncapsedStringPart $node) {
240
+		throw new \LogicException('Cannot directly print EncapsedStringPart');
241
+	}
242
+
243
+	// Assignments
244
+
245
+	protected function pExpr_Assign(Expr\Assign $node) {
246
+		return $this->pInfixOp(Expr\Assign::class, $node->var, ' = ', $node->expr);
247
+	}
248
+
249
+	protected function pExpr_AssignRef(Expr\AssignRef $node) {
250
+		return $this->pInfixOp(Expr\AssignRef::class, $node->var, ' =& ', $node->expr);
251
+	}
252
+
253
+	protected function pExpr_AssignOp_Plus(AssignOp\Plus $node) {
254
+		return $this->pInfixOp(AssignOp\Plus::class, $node->var, ' += ', $node->expr);
255
+	}
256
+
257
+	protected function pExpr_AssignOp_Minus(AssignOp\Minus $node) {
258
+		return $this->pInfixOp(AssignOp\Minus::class, $node->var, ' -= ', $node->expr);
259
+	}
260
+
261
+	protected function pExpr_AssignOp_Mul(AssignOp\Mul $node) {
262
+		return $this->pInfixOp(AssignOp\Mul::class, $node->var, ' *= ', $node->expr);
263
+	}
264
+
265
+	protected function pExpr_AssignOp_Div(AssignOp\Div $node) {
266
+		return $this->pInfixOp(AssignOp\Div::class, $node->var, ' /= ', $node->expr);
267
+	}
268
+
269
+	protected function pExpr_AssignOp_Concat(AssignOp\Concat $node) {
270
+		return $this->pInfixOp(AssignOp\Concat::class, $node->var, ' .= ', $node->expr);
271
+	}
272
+
273
+	protected function pExpr_AssignOp_Mod(AssignOp\Mod $node) {
274
+		return $this->pInfixOp(AssignOp\Mod::class, $node->var, ' %= ', $node->expr);
275
+	}
276
+
277
+	protected function pExpr_AssignOp_BitwiseAnd(AssignOp\BitwiseAnd $node) {
278
+		return $this->pInfixOp(AssignOp\BitwiseAnd::class, $node->var, ' &= ', $node->expr);
279
+	}
280
+
281
+	protected function pExpr_AssignOp_BitwiseOr(AssignOp\BitwiseOr $node) {
282
+		return $this->pInfixOp(AssignOp\BitwiseOr::class, $node->var, ' |= ', $node->expr);
283
+	}
284
+
285
+	protected function pExpr_AssignOp_BitwiseXor(AssignOp\BitwiseXor $node) {
286
+		return $this->pInfixOp(AssignOp\BitwiseXor::class, $node->var, ' ^= ', $node->expr);
287
+	}
288
+
289
+	protected function pExpr_AssignOp_ShiftLeft(AssignOp\ShiftLeft $node) {
290
+		return $this->pInfixOp(AssignOp\ShiftLeft::class, $node->var, ' <<= ', $node->expr);
291
+	}
292
+
293
+	protected function pExpr_AssignOp_ShiftRight(AssignOp\ShiftRight $node) {
294
+		return $this->pInfixOp(AssignOp\ShiftRight::class, $node->var, ' >>= ', $node->expr);
295
+	}
296
+
297
+	protected function pExpr_AssignOp_Pow(AssignOp\Pow $node) {
298
+		return $this->pInfixOp(AssignOp\Pow::class, $node->var, ' **= ', $node->expr);
299
+	}
300
+
301
+	protected function pExpr_AssignOp_Coalesce(AssignOp\Coalesce $node) {
302
+		return $this->pInfixOp(AssignOp\Coalesce::class, $node->var, ' ??= ', $node->expr);
303
+	}
304
+
305
+	// Binary expressions
306
+
307
+	protected function pExpr_BinaryOp_Plus(BinaryOp\Plus $node) {
308
+		return $this->pInfixOp(BinaryOp\Plus::class, $node->left, ' + ', $node->right);
309
+	}
310
+
311
+	protected function pExpr_BinaryOp_Minus(BinaryOp\Minus $node) {
312
+		return $this->pInfixOp(BinaryOp\Minus::class, $node->left, ' - ', $node->right);
313
+	}
314
+
315
+	protected function pExpr_BinaryOp_Mul(BinaryOp\Mul $node) {
316
+		return $this->pInfixOp(BinaryOp\Mul::class, $node->left, ' * ', $node->right);
317
+	}
318
+
319
+	protected function pExpr_BinaryOp_Div(BinaryOp\Div $node) {
320
+		return $this->pInfixOp(BinaryOp\Div::class, $node->left, ' / ', $node->right);
321
+	}
322 322
 
323
-    protected function pExpr_BinaryOp_Concat(BinaryOp\Concat $node) {
324
-        return $this->pInfixOp(BinaryOp\Concat::class, $node->left, ' . ', $node->right);
325
-    }
323
+	protected function pExpr_BinaryOp_Concat(BinaryOp\Concat $node) {
324
+		return $this->pInfixOp(BinaryOp\Concat::class, $node->left, ' . ', $node->right);
325
+	}
326 326
 
327
-    protected function pExpr_BinaryOp_Mod(BinaryOp\Mod $node) {
328
-        return $this->pInfixOp(BinaryOp\Mod::class, $node->left, ' % ', $node->right);
329
-    }
327
+	protected function pExpr_BinaryOp_Mod(BinaryOp\Mod $node) {
328
+		return $this->pInfixOp(BinaryOp\Mod::class, $node->left, ' % ', $node->right);
329
+	}
330 330
 
331
-    protected function pExpr_BinaryOp_BooleanAnd(BinaryOp\BooleanAnd $node) {
332
-        return $this->pInfixOp(BinaryOp\BooleanAnd::class, $node->left, ' && ', $node->right);
333
-    }
331
+	protected function pExpr_BinaryOp_BooleanAnd(BinaryOp\BooleanAnd $node) {
332
+		return $this->pInfixOp(BinaryOp\BooleanAnd::class, $node->left, ' && ', $node->right);
333
+	}
334 334
 
335
-    protected function pExpr_BinaryOp_BooleanOr(BinaryOp\BooleanOr $node) {
336
-        return $this->pInfixOp(BinaryOp\BooleanOr::class, $node->left, ' || ', $node->right);
337
-    }
335
+	protected function pExpr_BinaryOp_BooleanOr(BinaryOp\BooleanOr $node) {
336
+		return $this->pInfixOp(BinaryOp\BooleanOr::class, $node->left, ' || ', $node->right);
337
+	}
338 338
 
339
-    protected function pExpr_BinaryOp_BitwiseAnd(BinaryOp\BitwiseAnd $node) {
340
-        return $this->pInfixOp(BinaryOp\BitwiseAnd::class, $node->left, ' & ', $node->right);
341
-    }
339
+	protected function pExpr_BinaryOp_BitwiseAnd(BinaryOp\BitwiseAnd $node) {
340
+		return $this->pInfixOp(BinaryOp\BitwiseAnd::class, $node->left, ' & ', $node->right);
341
+	}
342 342
 
343
-    protected function pExpr_BinaryOp_BitwiseOr(BinaryOp\BitwiseOr $node) {
344
-        return $this->pInfixOp(BinaryOp\BitwiseOr::class, $node->left, ' | ', $node->right);
345
-    }
346
-
347
-    protected function pExpr_BinaryOp_BitwiseXor(BinaryOp\BitwiseXor $node) {
348
-        return $this->pInfixOp(BinaryOp\BitwiseXor::class, $node->left, ' ^ ', $node->right);
349
-    }
350
-
351
-    protected function pExpr_BinaryOp_ShiftLeft(BinaryOp\ShiftLeft $node) {
352
-        return $this->pInfixOp(BinaryOp\ShiftLeft::class, $node->left, ' << ', $node->right);
353
-    }
354
-
355
-    protected function pExpr_BinaryOp_ShiftRight(BinaryOp\ShiftRight $node) {
356
-        return $this->pInfixOp(BinaryOp\ShiftRight::class, $node->left, ' >> ', $node->right);
357
-    }
358
-
359
-    protected function pExpr_BinaryOp_Pow(BinaryOp\Pow $node) {
360
-        return $this->pInfixOp(BinaryOp\Pow::class, $node->left, ' ** ', $node->right);
361
-    }
362
-
363
-    protected function pExpr_BinaryOp_LogicalAnd(BinaryOp\LogicalAnd $node) {
364
-        return $this->pInfixOp(BinaryOp\LogicalAnd::class, $node->left, ' and ', $node->right);
365
-    }
366
-
367
-    protected function pExpr_BinaryOp_LogicalOr(BinaryOp\LogicalOr $node) {
368
-        return $this->pInfixOp(BinaryOp\LogicalOr::class, $node->left, ' or ', $node->right);
369
-    }
370
-
371
-    protected function pExpr_BinaryOp_LogicalXor(BinaryOp\LogicalXor $node) {
372
-        return $this->pInfixOp(BinaryOp\LogicalXor::class, $node->left, ' xor ', $node->right);
373
-    }
374
-
375
-    protected function pExpr_BinaryOp_Equal(BinaryOp\Equal $node) {
376
-        return $this->pInfixOp(BinaryOp\Equal::class, $node->left, ' == ', $node->right);
377
-    }
378
-
379
-    protected function pExpr_BinaryOp_NotEqual(BinaryOp\NotEqual $node) {
380
-        return $this->pInfixOp(BinaryOp\NotEqual::class, $node->left, ' != ', $node->right);
381
-    }
382
-
383
-    protected function pExpr_BinaryOp_Identical(BinaryOp\Identical $node) {
384
-        return $this->pInfixOp(BinaryOp\Identical::class, $node->left, ' === ', $node->right);
385
-    }
386
-
387
-    protected function pExpr_BinaryOp_NotIdentical(BinaryOp\NotIdentical $node) {
388
-        return $this->pInfixOp(BinaryOp\NotIdentical::class, $node->left, ' !== ', $node->right);
389
-    }
390
-
391
-    protected function pExpr_BinaryOp_Spaceship(BinaryOp\Spaceship $node) {
392
-        return $this->pInfixOp(BinaryOp\Spaceship::class, $node->left, ' <=> ', $node->right);
393
-    }
394
-
395
-    protected function pExpr_BinaryOp_Greater(BinaryOp\Greater $node) {
396
-        return $this->pInfixOp(BinaryOp\Greater::class, $node->left, ' > ', $node->right);
397
-    }
398
-
399
-    protected function pExpr_BinaryOp_GreaterOrEqual(BinaryOp\GreaterOrEqual $node) {
400
-        return $this->pInfixOp(BinaryOp\GreaterOrEqual::class, $node->left, ' >= ', $node->right);
401
-    }
402
-
403
-    protected function pExpr_BinaryOp_Smaller(BinaryOp\Smaller $node) {
404
-        return $this->pInfixOp(BinaryOp\Smaller::class, $node->left, ' < ', $node->right);
405
-    }
406
-
407
-    protected function pExpr_BinaryOp_SmallerOrEqual(BinaryOp\SmallerOrEqual $node) {
408
-        return $this->pInfixOp(BinaryOp\SmallerOrEqual::class, $node->left, ' <= ', $node->right);
409
-    }
410
-
411
-    protected function pExpr_BinaryOp_Coalesce(BinaryOp\Coalesce $node) {
412
-        return $this->pInfixOp(BinaryOp\Coalesce::class, $node->left, ' ?? ', $node->right);
413
-    }
414
-
415
-    protected function pExpr_Instanceof(Expr\Instanceof_ $node) {
416
-        list($precedence, $associativity) = $this->precedenceMap[Expr\Instanceof_::class];
417
-        return $this->pPrec($node->expr, $precedence, $associativity, -1)
418
-             . ' instanceof '
419
-             . $this->pNewVariable($node->class);
420
-    }
421
-
422
-    // Unary expressions
423
-
424
-    protected function pExpr_BooleanNot(Expr\BooleanNot $node) {
425
-        return $this->pPrefixOp(Expr\BooleanNot::class, '!', $node->expr);
426
-    }
427
-
428
-    protected function pExpr_BitwiseNot(Expr\BitwiseNot $node) {
429
-        return $this->pPrefixOp(Expr\BitwiseNot::class, '~', $node->expr);
430
-    }
431
-
432
-    protected function pExpr_UnaryMinus(Expr\UnaryMinus $node) {
433
-        if ($node->expr instanceof Expr\UnaryMinus || $node->expr instanceof Expr\PreDec) {
434
-            // Enforce -(-$expr) instead of --$expr
435
-            return '-(' . $this->p($node->expr) . ')';
436
-        }
437
-        return $this->pPrefixOp(Expr\UnaryMinus::class, '-', $node->expr);
438
-    }
439
-
440
-    protected function pExpr_UnaryPlus(Expr\UnaryPlus $node) {
441
-        if ($node->expr instanceof Expr\UnaryPlus || $node->expr instanceof Expr\PreInc) {
442
-            // Enforce +(+$expr) instead of ++$expr
443
-            return '+(' . $this->p($node->expr) . ')';
444
-        }
445
-        return $this->pPrefixOp(Expr\UnaryPlus::class, '+', $node->expr);
446
-    }
447
-
448
-    protected function pExpr_PreInc(Expr\PreInc $node) {
449
-        return $this->pPrefixOp(Expr\PreInc::class, '++', $node->var);
450
-    }
451
-
452
-    protected function pExpr_PreDec(Expr\PreDec $node) {
453
-        return $this->pPrefixOp(Expr\PreDec::class, '--', $node->var);
454
-    }
455
-
456
-    protected function pExpr_PostInc(Expr\PostInc $node) {
457
-        return $this->pPostfixOp(Expr\PostInc::class, $node->var, '++');
458
-    }
459
-
460
-    protected function pExpr_PostDec(Expr\PostDec $node) {
461
-        return $this->pPostfixOp(Expr\PostDec::class, $node->var, '--');
462
-    }
463
-
464
-    protected function pExpr_ErrorSuppress(Expr\ErrorSuppress $node) {
465
-        return $this->pPrefixOp(Expr\ErrorSuppress::class, '@', $node->expr);
466
-    }
467
-
468
-    protected function pExpr_YieldFrom(Expr\YieldFrom $node) {
469
-        return $this->pPrefixOp(Expr\YieldFrom::class, 'yield from ', $node->expr);
470
-    }
471
-
472
-    protected function pExpr_Print(Expr\Print_ $node) {
473
-        return $this->pPrefixOp(Expr\Print_::class, 'print ', $node->expr);
474
-    }
475
-
476
-    // Casts
477
-
478
-    protected function pExpr_Cast_Int(Cast\Int_ $node) {
479
-        return $this->pPrefixOp(Cast\Int_::class, '(int) ', $node->expr);
480
-    }
481
-
482
-    protected function pExpr_Cast_Double(Cast\Double $node) {
483
-        $kind = $node->getAttribute('kind', Cast\Double::KIND_DOUBLE);
484
-        if ($kind === Cast\Double::KIND_DOUBLE) {
485
-            $cast = '(double)';
486
-        } elseif ($kind === Cast\Double::KIND_FLOAT) {
487
-            $cast = '(float)';
488
-        } elseif ($kind === Cast\Double::KIND_REAL) {
489
-            $cast = '(real)';
490
-        }
491
-        return $this->pPrefixOp(Cast\Double::class, $cast . ' ', $node->expr);
492
-    }
493
-
494
-    protected function pExpr_Cast_String(Cast\String_ $node) {
495
-        return $this->pPrefixOp(Cast\String_::class, '(string) ', $node->expr);
496
-    }
497
-
498
-    protected function pExpr_Cast_Array(Cast\Array_ $node) {
499
-        return $this->pPrefixOp(Cast\Array_::class, '(array) ', $node->expr);
500
-    }
501
-
502
-    protected function pExpr_Cast_Object(Cast\Object_ $node) {
503
-        return $this->pPrefixOp(Cast\Object_::class, '(object) ', $node->expr);
504
-    }
505
-
506
-    protected function pExpr_Cast_Bool(Cast\Bool_ $node) {
507
-        return $this->pPrefixOp(Cast\Bool_::class, '(bool) ', $node->expr);
508
-    }
509
-
510
-    protected function pExpr_Cast_Unset(Cast\Unset_ $node) {
511
-        return $this->pPrefixOp(Cast\Unset_::class, '(unset) ', $node->expr);
512
-    }
513
-
514
-    // Function calls and similar constructs
515
-
516
-    protected function pExpr_FuncCall(Expr\FuncCall $node) {
517
-        return $this->pCallLhs($node->name)
518
-             . '(' . $this->pMaybeMultiline($node->args) . ')';
519
-    }
520
-
521
-    protected function pExpr_MethodCall(Expr\MethodCall $node) {
522
-        return $this->pDereferenceLhs($node->var) . '->' . $this->pObjectProperty($node->name)
523
-             . '(' . $this->pMaybeMultiline($node->args) . ')';
524
-    }
525
-
526
-    protected function pExpr_NullsafeMethodCall(Expr\NullsafeMethodCall $node) {
527
-        return $this->pDereferenceLhs($node->var) . '?->' . $this->pObjectProperty($node->name)
528
-            . '(' . $this->pMaybeMultiline($node->args) . ')';
529
-    }
530
-
531
-    protected function pExpr_StaticCall(Expr\StaticCall $node) {
532
-        return $this->pDereferenceLhs($node->class) . '::'
533
-             . ($node->name instanceof Expr
534
-                ? ($node->name instanceof Expr\Variable
535
-                   ? $this->p($node->name)
536
-                   : '{' . $this->p($node->name) . '}')
537
-                : $node->name)
538
-             . '(' . $this->pMaybeMultiline($node->args) . ')';
539
-    }
540
-
541
-    protected function pExpr_Empty(Expr\Empty_ $node) {
542
-        return 'empty(' . $this->p($node->expr) . ')';
543
-    }
544
-
545
-    protected function pExpr_Isset(Expr\Isset_ $node) {
546
-        return 'isset(' . $this->pCommaSeparated($node->vars) . ')';
547
-    }
548
-
549
-    protected function pExpr_Eval(Expr\Eval_ $node) {
550
-        return 'eval(' . $this->p($node->expr) . ')';
551
-    }
552
-
553
-    protected function pExpr_Include(Expr\Include_ $node) {
554
-        static $map = [
555
-            Expr\Include_::TYPE_INCLUDE      => 'include',
556
-            Expr\Include_::TYPE_INCLUDE_ONCE => 'include_once',
557
-            Expr\Include_::TYPE_REQUIRE      => 'require',
558
-            Expr\Include_::TYPE_REQUIRE_ONCE => 'require_once',
559
-        ];
560
-
561
-        return $map[$node->type] . ' ' . $this->p($node->expr);
562
-    }
563
-
564
-    protected function pExpr_List(Expr\List_ $node) {
565
-        return 'list(' . $this->pCommaSeparated($node->items) . ')';
566
-    }
567
-
568
-    // Other
569
-
570
-    protected function pExpr_Error(Expr\Error $node) {
571
-        throw new \LogicException('Cannot pretty-print AST with Error nodes');
572
-    }
573
-
574
-    protected function pExpr_Variable(Expr\Variable $node) {
575
-        if ($node->name instanceof Expr) {
576
-            return '${' . $this->p($node->name) . '}';
577
-        } else {
578
-            return '$' . $node->name;
579
-        }
580
-    }
581
-
582
-    protected function pExpr_Array(Expr\Array_ $node) {
583
-        $syntax = $node->getAttribute('kind',
584
-            $this->options['shortArraySyntax'] ? Expr\Array_::KIND_SHORT : Expr\Array_::KIND_LONG);
585
-        if ($syntax === Expr\Array_::KIND_SHORT) {
586
-            return '[' . $this->pMaybeMultiline($node->items, true) . ']';
587
-        } else {
588
-            return 'array(' . $this->pMaybeMultiline($node->items, true) . ')';
589
-        }
590
-    }
591
-
592
-    protected function pExpr_ArrayItem(Expr\ArrayItem $node) {
593
-        return (null !== $node->key ? $this->p($node->key) . ' => ' : '')
594
-             . ($node->byRef ? '&' : '')
595
-             . ($node->unpack ? '...' : '')
596
-             . $this->p($node->value);
597
-    }
598
-
599
-    protected function pExpr_ArrayDimFetch(Expr\ArrayDimFetch $node) {
600
-        return $this->pDereferenceLhs($node->var)
601
-             . '[' . (null !== $node->dim ? $this->p($node->dim) : '') . ']';
602
-    }
603
-
604
-    protected function pExpr_ConstFetch(Expr\ConstFetch $node) {
605
-        return $this->p($node->name);
606
-    }
607
-
608
-    protected function pExpr_ClassConstFetch(Expr\ClassConstFetch $node) {
609
-        return $this->pDereferenceLhs($node->class) . '::' . $this->p($node->name);
610
-    }
611
-
612
-    protected function pExpr_PropertyFetch(Expr\PropertyFetch $node) {
613
-        return $this->pDereferenceLhs($node->var) . '->' . $this->pObjectProperty($node->name);
614
-    }
615
-
616
-    protected function pExpr_NullsafePropertyFetch(Expr\NullsafePropertyFetch $node) {
617
-        return $this->pDereferenceLhs($node->var) . '?->' . $this->pObjectProperty($node->name);
618
-    }
619
-
620
-    protected function pExpr_StaticPropertyFetch(Expr\StaticPropertyFetch $node) {
621
-        return $this->pDereferenceLhs($node->class) . '::$' . $this->pObjectProperty($node->name);
622
-    }
623
-
624
-    protected function pExpr_ShellExec(Expr\ShellExec $node) {
625
-        return '`' . $this->pEncapsList($node->parts, '`') . '`';
626
-    }
627
-
628
-    protected function pExpr_Closure(Expr\Closure $node) {
629
-        return $this->pAttrGroups($node->attrGroups, true)
630
-             . ($node->static ? 'static ' : '')
631
-             . 'function ' . ($node->byRef ? '&' : '')
632
-             . '(' . $this->pCommaSeparated($node->params) . ')'
633
-             . (!empty($node->uses) ? ' use(' . $this->pCommaSeparated($node->uses) . ')' : '')
634
-             . (null !== $node->returnType ? ' : ' . $this->p($node->returnType) : '')
635
-             . ' {' . $this->pStmts($node->stmts) . $this->nl . '}';
636
-    }
637
-
638
-    protected function pExpr_Match(Expr\Match_ $node) {
639
-        return 'match (' . $this->p($node->cond) . ') {'
640
-            . $this->pCommaSeparatedMultiline($node->arms, true)
641
-            . $this->nl
642
-            . '}';
643
-    }
644
-
645
-    protected function pMatchArm(Node\MatchArm $node) {
646
-        return ($node->conds ? $this->pCommaSeparated($node->conds) : 'default')
647
-            . ' => ' . $this->p($node->body);
648
-    }
649
-
650
-    protected function pExpr_ArrowFunction(Expr\ArrowFunction $node) {
651
-        return $this->pAttrGroups($node->attrGroups, true)
652
-            . ($node->static ? 'static ' : '')
653
-            . 'fn' . ($node->byRef ? '&' : '')
654
-            . '(' . $this->pCommaSeparated($node->params) . ')'
655
-            . (null !== $node->returnType ? ': ' . $this->p($node->returnType) : '')
656
-            . ' => '
657
-            . $this->p($node->expr);
658
-    }
659
-
660
-    protected function pExpr_ClosureUse(Expr\ClosureUse $node) {
661
-        return ($node->byRef ? '&' : '') . $this->p($node->var);
662
-    }
663
-
664
-    protected function pExpr_New(Expr\New_ $node) {
665
-        if ($node->class instanceof Stmt\Class_) {
666
-            $args = $node->args ? '(' . $this->pMaybeMultiline($node->args) . ')' : '';
667
-            return 'new ' . $this->pClassCommon($node->class, $args);
668
-        }
669
-        return 'new ' . $this->pNewVariable($node->class)
670
-            . '(' . $this->pMaybeMultiline($node->args) . ')';
671
-    }
672
-
673
-    protected function pExpr_Clone(Expr\Clone_ $node) {
674
-        return 'clone ' . $this->p($node->expr);
675
-    }
676
-
677
-    protected function pExpr_Ternary(Expr\Ternary $node) {
678
-        // a bit of cheating: we treat the ternary as a binary op where the ?...: part is the operator.
679
-        // this is okay because the part between ? and : never needs parentheses.
680
-        return $this->pInfixOp(Expr\Ternary::class,
681
-            $node->cond, ' ?' . (null !== $node->if ? ' ' . $this->p($node->if) . ' ' : '') . ': ', $node->else
682
-        );
683
-    }
684
-
685
-    protected function pExpr_Exit(Expr\Exit_ $node) {
686
-        $kind = $node->getAttribute('kind', Expr\Exit_::KIND_DIE);
687
-        return ($kind === Expr\Exit_::KIND_EXIT ? 'exit' : 'die')
688
-             . (null !== $node->expr ? '(' . $this->p($node->expr) . ')' : '');
689
-    }
690
-
691
-    protected function pExpr_Throw(Expr\Throw_ $node) {
692
-        return 'throw ' . $this->p($node->expr);
693
-    }
694
-
695
-    protected function pExpr_Yield(Expr\Yield_ $node) {
696
-        if ($node->value === null) {
697
-            return 'yield';
698
-        } else {
699
-            // this is a bit ugly, but currently there is no way to detect whether the parentheses are necessary
700
-            return '(yield '
701
-                 . ($node->key !== null ? $this->p($node->key) . ' => ' : '')
702
-                 . $this->p($node->value)
703
-                 . ')';
704
-        }
705
-    }
706
-
707
-    // Declarations
708
-
709
-    protected function pStmt_Namespace(Stmt\Namespace_ $node) {
710
-        if ($this->canUseSemicolonNamespaces) {
711
-            return 'namespace ' . $this->p($node->name) . ';'
712
-                 . $this->nl . $this->pStmts($node->stmts, false);
713
-        } else {
714
-            return 'namespace' . (null !== $node->name ? ' ' . $this->p($node->name) : '')
715
-                 . ' {' . $this->pStmts($node->stmts) . $this->nl . '}';
716
-        }
717
-    }
718
-
719
-    protected function pStmt_Use(Stmt\Use_ $node) {
720
-        return 'use ' . $this->pUseType($node->type)
721
-             . $this->pCommaSeparated($node->uses) . ';';
722
-    }
723
-
724
-    protected function pStmt_GroupUse(Stmt\GroupUse $node) {
725
-        return 'use ' . $this->pUseType($node->type) . $this->pName($node->prefix)
726
-             . '\{' . $this->pCommaSeparated($node->uses) . '};';
727
-    }
728
-
729
-    protected function pStmt_UseUse(Stmt\UseUse $node) {
730
-        return $this->pUseType($node->type) . $this->p($node->name)
731
-             . (null !== $node->alias ? ' as ' . $node->alias : '');
732
-    }
733
-
734
-    protected function pUseType($type) {
735
-        return $type === Stmt\Use_::TYPE_FUNCTION ? 'function '
736
-            : ($type === Stmt\Use_::TYPE_CONSTANT ? 'const ' : '');
737
-    }
738
-
739
-    protected function pStmt_Interface(Stmt\Interface_ $node) {
740
-        return $this->pAttrGroups($node->attrGroups)
741
-             . 'interface ' . $node->name
742
-             . (!empty($node->extends) ? ' extends ' . $this->pCommaSeparated($node->extends) : '')
743
-             . $this->nl . '{' . $this->pStmts($node->stmts) . $this->nl . '}';
744
-    }
745
-
746
-    protected function pStmt_Enum(Stmt\Enum_ $node) {
747
-        return $this->pAttrGroups($node->attrGroups)
748
-             . 'enum ' . $node->name
749
-             . ($node->scalarType ? " : $node->scalarType" : '')
750
-             . (!empty($node->implements) ? ' implements ' . $this->pCommaSeparated($node->implements) : '')
751
-             . $this->nl . '{' . $this->pStmts($node->stmts) . $this->nl . '}';
752
-    }
753
-
754
-    protected function pStmt_Class(Stmt\Class_ $node) {
755
-        return $this->pClassCommon($node, ' ' . $node->name);
756
-    }
757
-
758
-    protected function pStmt_Trait(Stmt\Trait_ $node) {
759
-        return $this->pAttrGroups($node->attrGroups)
760
-             . 'trait ' . $node->name
761
-             . $this->nl . '{' . $this->pStmts($node->stmts) . $this->nl . '}';
762
-    }
763
-
764
-    protected function pStmt_EnumCase(Stmt\EnumCase $node) {
765
-        return $this->pAttrGroups($node->attrGroups)
766
-             . 'case ' . $node->name
767
-             . ($node->expr ? ' = ' . $this->p($node->expr) : '')
768
-             . ';';
769
-    }
770
-
771
-    protected function pStmt_TraitUse(Stmt\TraitUse $node) {
772
-        return 'use ' . $this->pCommaSeparated($node->traits)
773
-             . (empty($node->adaptations)
774
-                ? ';'
775
-                : ' {' . $this->pStmts($node->adaptations) . $this->nl . '}');
776
-    }
777
-
778
-    protected function pStmt_TraitUseAdaptation_Precedence(Stmt\TraitUseAdaptation\Precedence $node) {
779
-        return $this->p($node->trait) . '::' . $node->method
780
-             . ' insteadof ' . $this->pCommaSeparated($node->insteadof) . ';';
781
-    }
782
-
783
-    protected function pStmt_TraitUseAdaptation_Alias(Stmt\TraitUseAdaptation\Alias $node) {
784
-        return (null !== $node->trait ? $this->p($node->trait) . '::' : '')
785
-             . $node->method . ' as'
786
-             . (null !== $node->newModifier ? ' ' . rtrim($this->pModifiers($node->newModifier), ' ') : '')
787
-             . (null !== $node->newName     ? ' ' . $node->newName                        : '')
788
-             . ';';
789
-    }
790
-
791
-    protected function pStmt_Property(Stmt\Property $node) {
792
-        return $this->pAttrGroups($node->attrGroups)
793
-            . (0 === $node->flags ? 'var ' : $this->pModifiers($node->flags))
794
-            . ($node->type ? $this->p($node->type) . ' ' : '')
795
-            . $this->pCommaSeparated($node->props) . ';';
796
-    }
797
-
798
-    protected function pStmt_PropertyProperty(Stmt\PropertyProperty $node) {
799
-        return '$' . $node->name
800
-             . (null !== $node->default ? ' = ' . $this->p($node->default) : '');
801
-    }
802
-
803
-    protected function pStmt_ClassMethod(Stmt\ClassMethod $node) {
804
-        return $this->pAttrGroups($node->attrGroups)
805
-             . $this->pModifiers($node->flags)
806
-             . 'function ' . ($node->byRef ? '&' : '') . $node->name
807
-             . '(' . $this->pMaybeMultiline($node->params) . ')'
808
-             . (null !== $node->returnType ? ' : ' . $this->p($node->returnType) : '')
809
-             . (null !== $node->stmts
810
-                ? $this->nl . '{' . $this->pStmts($node->stmts) . $this->nl . '}'
811
-                : ';');
812
-    }
813
-
814
-    protected function pStmt_ClassConst(Stmt\ClassConst $node) {
815
-        return $this->pAttrGroups($node->attrGroups)
816
-             . $this->pModifiers($node->flags)
817
-             . 'const ' . $this->pCommaSeparated($node->consts) . ';';
818
-    }
819
-
820
-    protected function pStmt_Function(Stmt\Function_ $node) {
821
-        return $this->pAttrGroups($node->attrGroups)
822
-             . 'function ' . ($node->byRef ? '&' : '') . $node->name
823
-             . '(' . $this->pCommaSeparated($node->params) . ')'
824
-             . (null !== $node->returnType ? ' : ' . $this->p($node->returnType) : '')
825
-             . $this->nl . '{' . $this->pStmts($node->stmts) . $this->nl . '}';
826
-    }
827
-
828
-    protected function pStmt_Const(Stmt\Const_ $node) {
829
-        return 'const ' . $this->pCommaSeparated($node->consts) . ';';
830
-    }
831
-
832
-    protected function pStmt_Declare(Stmt\Declare_ $node) {
833
-        return 'declare (' . $this->pCommaSeparated($node->declares) . ')'
834
-             . (null !== $node->stmts ? ' {' . $this->pStmts($node->stmts) . $this->nl . '}' : ';');
835
-    }
836
-
837
-    protected function pStmt_DeclareDeclare(Stmt\DeclareDeclare $node) {
838
-        return $node->key . '=' . $this->p($node->value);
839
-    }
840
-
841
-    // Control flow
842
-
843
-    protected function pStmt_If(Stmt\If_ $node) {
844
-        return 'if (' . $this->p($node->cond) . ') {'
845
-             . $this->pStmts($node->stmts) . $this->nl . '}'
846
-             . ($node->elseifs ? ' ' . $this->pImplode($node->elseifs, ' ') : '')
847
-             . (null !== $node->else ? ' ' . $this->p($node->else) : '');
848
-    }
849
-
850
-    protected function pStmt_ElseIf(Stmt\ElseIf_ $node) {
851
-        return 'elseif (' . $this->p($node->cond) . ') {'
852
-             . $this->pStmts($node->stmts) . $this->nl . '}';
853
-    }
854
-
855
-    protected function pStmt_Else(Stmt\Else_ $node) {
856
-        return 'else {' . $this->pStmts($node->stmts) . $this->nl . '}';
857
-    }
858
-
859
-    protected function pStmt_For(Stmt\For_ $node) {
860
-        return 'for ('
861
-             . $this->pCommaSeparated($node->init) . ';' . (!empty($node->cond) ? ' ' : '')
862
-             . $this->pCommaSeparated($node->cond) . ';' . (!empty($node->loop) ? ' ' : '')
863
-             . $this->pCommaSeparated($node->loop)
864
-             . ') {' . $this->pStmts($node->stmts) . $this->nl . '}';
865
-    }
866
-
867
-    protected function pStmt_Foreach(Stmt\Foreach_ $node) {
868
-        return 'foreach (' . $this->p($node->expr) . ' as '
869
-             . (null !== $node->keyVar ? $this->p($node->keyVar) . ' => ' : '')
870
-             . ($node->byRef ? '&' : '') . $this->p($node->valueVar) . ') {'
871
-             . $this->pStmts($node->stmts) . $this->nl . '}';
872
-    }
873
-
874
-    protected function pStmt_While(Stmt\While_ $node) {
875
-        return 'while (' . $this->p($node->cond) . ') {'
876
-             . $this->pStmts($node->stmts) . $this->nl . '}';
877
-    }
878
-
879
-    protected function pStmt_Do(Stmt\Do_ $node) {
880
-        return 'do {' . $this->pStmts($node->stmts) . $this->nl
881
-             . '} while (' . $this->p($node->cond) . ');';
882
-    }
883
-
884
-    protected function pStmt_Switch(Stmt\Switch_ $node) {
885
-        return 'switch (' . $this->p($node->cond) . ') {'
886
-             . $this->pStmts($node->cases) . $this->nl . '}';
887
-    }
888
-
889
-    protected function pStmt_Case(Stmt\Case_ $node) {
890
-        return (null !== $node->cond ? 'case ' . $this->p($node->cond) : 'default') . ':'
891
-             . $this->pStmts($node->stmts);
892
-    }
893
-
894
-    protected function pStmt_TryCatch(Stmt\TryCatch $node) {
895
-        return 'try {' . $this->pStmts($node->stmts) . $this->nl . '}'
896
-             . ($node->catches ? ' ' . $this->pImplode($node->catches, ' ') : '')
897
-             . ($node->finally !== null ? ' ' . $this->p($node->finally) : '');
898
-    }
899
-
900
-    protected function pStmt_Catch(Stmt\Catch_ $node) {
901
-        return 'catch (' . $this->pImplode($node->types, '|')
902
-             . ($node->var !== null ? ' ' . $this->p($node->var) : '')
903
-             . ') {' . $this->pStmts($node->stmts) . $this->nl . '}';
904
-    }
905
-
906
-    protected function pStmt_Finally(Stmt\Finally_ $node) {
907
-        return 'finally {' . $this->pStmts($node->stmts) . $this->nl . '}';
908
-    }
909
-
910
-    protected function pStmt_Break(Stmt\Break_ $node) {
911
-        return 'break' . ($node->num !== null ? ' ' . $this->p($node->num) : '') . ';';
912
-    }
913
-
914
-    protected function pStmt_Continue(Stmt\Continue_ $node) {
915
-        return 'continue' . ($node->num !== null ? ' ' . $this->p($node->num) : '') . ';';
916
-    }
917
-
918
-    protected function pStmt_Return(Stmt\Return_ $node) {
919
-        return 'return' . (null !== $node->expr ? ' ' . $this->p($node->expr) : '') . ';';
920
-    }
921
-
922
-    protected function pStmt_Throw(Stmt\Throw_ $node) {
923
-        return 'throw ' . $this->p($node->expr) . ';';
924
-    }
925
-
926
-    protected function pStmt_Label(Stmt\Label $node) {
927
-        return $node->name . ':';
928
-    }
929
-
930
-    protected function pStmt_Goto(Stmt\Goto_ $node) {
931
-        return 'goto ' . $node->name . ';';
932
-    }
933
-
934
-    // Other
935
-
936
-    protected function pStmt_Expression(Stmt\Expression $node) {
937
-        return $this->p($node->expr) . ';';
938
-    }
939
-
940
-    protected function pStmt_Echo(Stmt\Echo_ $node) {
941
-        return 'echo ' . $this->pCommaSeparated($node->exprs) . ';';
942
-    }
943
-
944
-    protected function pStmt_Static(Stmt\Static_ $node) {
945
-        return 'static ' . $this->pCommaSeparated($node->vars) . ';';
946
-    }
947
-
948
-    protected function pStmt_Global(Stmt\Global_ $node) {
949
-        return 'global ' . $this->pCommaSeparated($node->vars) . ';';
950
-    }
951
-
952
-    protected function pStmt_StaticVar(Stmt\StaticVar $node) {
953
-        return $this->p($node->var)
954
-             . (null !== $node->default ? ' = ' . $this->p($node->default) : '');
955
-    }
956
-
957
-    protected function pStmt_Unset(Stmt\Unset_ $node) {
958
-        return 'unset(' . $this->pCommaSeparated($node->vars) . ');';
959
-    }
960
-
961
-    protected function pStmt_InlineHTML(Stmt\InlineHTML $node) {
962
-        $newline = $node->getAttribute('hasLeadingNewline', true) ? "\n" : '';
963
-        return '?>' . $newline . $node->value . '<?php ';
964
-    }
965
-
966
-    protected function pStmt_HaltCompiler(Stmt\HaltCompiler $node) {
967
-        return '__halt_compiler();' . $node->remaining;
968
-    }
969
-
970
-    protected function pStmt_Nop(Stmt\Nop $node) {
971
-        return '';
972
-    }
973
-
974
-    // Helpers
975
-
976
-    protected function pClassCommon(Stmt\Class_ $node, $afterClassToken) {
977
-        return $this->pAttrGroups($node->attrGroups, $node->name === null)
978
-            . $this->pModifiers($node->flags)
979
-            . 'class' . $afterClassToken
980
-            . (null !== $node->extends ? ' extends ' . $this->p($node->extends) : '')
981
-            . (!empty($node->implements) ? ' implements ' . $this->pCommaSeparated($node->implements) : '')
982
-            . $this->nl . '{' . $this->pStmts($node->stmts) . $this->nl . '}';
983
-    }
984
-
985
-    protected function pObjectProperty($node) {
986
-        if ($node instanceof Expr) {
987
-            return '{' . $this->p($node) . '}';
988
-        } else {
989
-            return $node;
990
-        }
991
-    }
992
-
993
-    protected function pEncapsList(array $encapsList, $quote) {
994
-        $return = '';
995
-        foreach ($encapsList as $element) {
996
-            if ($element instanceof Scalar\EncapsedStringPart) {
997
-                $return .= $this->escapeString($element->value, $quote);
998
-            } else {
999
-                $return .= '{' . $this->p($element) . '}';
1000
-            }
1001
-        }
1002
-
1003
-        return $return;
1004
-    }
1005
-
1006
-    protected function pSingleQuotedString(string $string) {
1007
-        return '\'' . addcslashes($string, '\'\\') . '\'';
1008
-    }
1009
-
1010
-    protected function escapeString($string, $quote) {
1011
-        if (null === $quote) {
1012
-            // For doc strings, don't escape newlines
1013
-            $escaped = addcslashes($string, "\t\f\v$\\");
1014
-        } else {
1015
-            $escaped = addcslashes($string, "\n\r\t\f\v$" . $quote . "\\");
1016
-        }
1017
-
1018
-        // Escape control characters and non-UTF-8 characters.
1019
-        // Regex based on https://stackoverflow.com/a/11709412/385378.
1020
-        $regex = '/(
343
+	protected function pExpr_BinaryOp_BitwiseOr(BinaryOp\BitwiseOr $node) {
344
+		return $this->pInfixOp(BinaryOp\BitwiseOr::class, $node->left, ' | ', $node->right);
345
+	}
346
+
347
+	protected function pExpr_BinaryOp_BitwiseXor(BinaryOp\BitwiseXor $node) {
348
+		return $this->pInfixOp(BinaryOp\BitwiseXor::class, $node->left, ' ^ ', $node->right);
349
+	}
350
+
351
+	protected function pExpr_BinaryOp_ShiftLeft(BinaryOp\ShiftLeft $node) {
352
+		return $this->pInfixOp(BinaryOp\ShiftLeft::class, $node->left, ' << ', $node->right);
353
+	}
354
+
355
+	protected function pExpr_BinaryOp_ShiftRight(BinaryOp\ShiftRight $node) {
356
+		return $this->pInfixOp(BinaryOp\ShiftRight::class, $node->left, ' >> ', $node->right);
357
+	}
358
+
359
+	protected function pExpr_BinaryOp_Pow(BinaryOp\Pow $node) {
360
+		return $this->pInfixOp(BinaryOp\Pow::class, $node->left, ' ** ', $node->right);
361
+	}
362
+
363
+	protected function pExpr_BinaryOp_LogicalAnd(BinaryOp\LogicalAnd $node) {
364
+		return $this->pInfixOp(BinaryOp\LogicalAnd::class, $node->left, ' and ', $node->right);
365
+	}
366
+
367
+	protected function pExpr_BinaryOp_LogicalOr(BinaryOp\LogicalOr $node) {
368
+		return $this->pInfixOp(BinaryOp\LogicalOr::class, $node->left, ' or ', $node->right);
369
+	}
370
+
371
+	protected function pExpr_BinaryOp_LogicalXor(BinaryOp\LogicalXor $node) {
372
+		return $this->pInfixOp(BinaryOp\LogicalXor::class, $node->left, ' xor ', $node->right);
373
+	}
374
+
375
+	protected function pExpr_BinaryOp_Equal(BinaryOp\Equal $node) {
376
+		return $this->pInfixOp(BinaryOp\Equal::class, $node->left, ' == ', $node->right);
377
+	}
378
+
379
+	protected function pExpr_BinaryOp_NotEqual(BinaryOp\NotEqual $node) {
380
+		return $this->pInfixOp(BinaryOp\NotEqual::class, $node->left, ' != ', $node->right);
381
+	}
382
+
383
+	protected function pExpr_BinaryOp_Identical(BinaryOp\Identical $node) {
384
+		return $this->pInfixOp(BinaryOp\Identical::class, $node->left, ' === ', $node->right);
385
+	}
386
+
387
+	protected function pExpr_BinaryOp_NotIdentical(BinaryOp\NotIdentical $node) {
388
+		return $this->pInfixOp(BinaryOp\NotIdentical::class, $node->left, ' !== ', $node->right);
389
+	}
390
+
391
+	protected function pExpr_BinaryOp_Spaceship(BinaryOp\Spaceship $node) {
392
+		return $this->pInfixOp(BinaryOp\Spaceship::class, $node->left, ' <=> ', $node->right);
393
+	}
394
+
395
+	protected function pExpr_BinaryOp_Greater(BinaryOp\Greater $node) {
396
+		return $this->pInfixOp(BinaryOp\Greater::class, $node->left, ' > ', $node->right);
397
+	}
398
+
399
+	protected function pExpr_BinaryOp_GreaterOrEqual(BinaryOp\GreaterOrEqual $node) {
400
+		return $this->pInfixOp(BinaryOp\GreaterOrEqual::class, $node->left, ' >= ', $node->right);
401
+	}
402
+
403
+	protected function pExpr_BinaryOp_Smaller(BinaryOp\Smaller $node) {
404
+		return $this->pInfixOp(BinaryOp\Smaller::class, $node->left, ' < ', $node->right);
405
+	}
406
+
407
+	protected function pExpr_BinaryOp_SmallerOrEqual(BinaryOp\SmallerOrEqual $node) {
408
+		return $this->pInfixOp(BinaryOp\SmallerOrEqual::class, $node->left, ' <= ', $node->right);
409
+	}
410
+
411
+	protected function pExpr_BinaryOp_Coalesce(BinaryOp\Coalesce $node) {
412
+		return $this->pInfixOp(BinaryOp\Coalesce::class, $node->left, ' ?? ', $node->right);
413
+	}
414
+
415
+	protected function pExpr_Instanceof(Expr\Instanceof_ $node) {
416
+		list($precedence, $associativity) = $this->precedenceMap[Expr\Instanceof_::class];
417
+		return $this->pPrec($node->expr, $precedence, $associativity, -1)
418
+			 . ' instanceof '
419
+			 . $this->pNewVariable($node->class);
420
+	}
421
+
422
+	// Unary expressions
423
+
424
+	protected function pExpr_BooleanNot(Expr\BooleanNot $node) {
425
+		return $this->pPrefixOp(Expr\BooleanNot::class, '!', $node->expr);
426
+	}
427
+
428
+	protected function pExpr_BitwiseNot(Expr\BitwiseNot $node) {
429
+		return $this->pPrefixOp(Expr\BitwiseNot::class, '~', $node->expr);
430
+	}
431
+
432
+	protected function pExpr_UnaryMinus(Expr\UnaryMinus $node) {
433
+		if ($node->expr instanceof Expr\UnaryMinus || $node->expr instanceof Expr\PreDec) {
434
+			// Enforce -(-$expr) instead of --$expr
435
+			return '-(' . $this->p($node->expr) . ')';
436
+		}
437
+		return $this->pPrefixOp(Expr\UnaryMinus::class, '-', $node->expr);
438
+	}
439
+
440
+	protected function pExpr_UnaryPlus(Expr\UnaryPlus $node) {
441
+		if ($node->expr instanceof Expr\UnaryPlus || $node->expr instanceof Expr\PreInc) {
442
+			// Enforce +(+$expr) instead of ++$expr
443
+			return '+(' . $this->p($node->expr) . ')';
444
+		}
445
+		return $this->pPrefixOp(Expr\UnaryPlus::class, '+', $node->expr);
446
+	}
447
+
448
+	protected function pExpr_PreInc(Expr\PreInc $node) {
449
+		return $this->pPrefixOp(Expr\PreInc::class, '++', $node->var);
450
+	}
451
+
452
+	protected function pExpr_PreDec(Expr\PreDec $node) {
453
+		return $this->pPrefixOp(Expr\PreDec::class, '--', $node->var);
454
+	}
455
+
456
+	protected function pExpr_PostInc(Expr\PostInc $node) {
457
+		return $this->pPostfixOp(Expr\PostInc::class, $node->var, '++');
458
+	}
459
+
460
+	protected function pExpr_PostDec(Expr\PostDec $node) {
461
+		return $this->pPostfixOp(Expr\PostDec::class, $node->var, '--');
462
+	}
463
+
464
+	protected function pExpr_ErrorSuppress(Expr\ErrorSuppress $node) {
465
+		return $this->pPrefixOp(Expr\ErrorSuppress::class, '@', $node->expr);
466
+	}
467
+
468
+	protected function pExpr_YieldFrom(Expr\YieldFrom $node) {
469
+		return $this->pPrefixOp(Expr\YieldFrom::class, 'yield from ', $node->expr);
470
+	}
471
+
472
+	protected function pExpr_Print(Expr\Print_ $node) {
473
+		return $this->pPrefixOp(Expr\Print_::class, 'print ', $node->expr);
474
+	}
475
+
476
+	// Casts
477
+
478
+	protected function pExpr_Cast_Int(Cast\Int_ $node) {
479
+		return $this->pPrefixOp(Cast\Int_::class, '(int) ', $node->expr);
480
+	}
481
+
482
+	protected function pExpr_Cast_Double(Cast\Double $node) {
483
+		$kind = $node->getAttribute('kind', Cast\Double::KIND_DOUBLE);
484
+		if ($kind === Cast\Double::KIND_DOUBLE) {
485
+			$cast = '(double)';
486
+		} elseif ($kind === Cast\Double::KIND_FLOAT) {
487
+			$cast = '(float)';
488
+		} elseif ($kind === Cast\Double::KIND_REAL) {
489
+			$cast = '(real)';
490
+		}
491
+		return $this->pPrefixOp(Cast\Double::class, $cast . ' ', $node->expr);
492
+	}
493
+
494
+	protected function pExpr_Cast_String(Cast\String_ $node) {
495
+		return $this->pPrefixOp(Cast\String_::class, '(string) ', $node->expr);
496
+	}
497
+
498
+	protected function pExpr_Cast_Array(Cast\Array_ $node) {
499
+		return $this->pPrefixOp(Cast\Array_::class, '(array) ', $node->expr);
500
+	}
501
+
502
+	protected function pExpr_Cast_Object(Cast\Object_ $node) {
503
+		return $this->pPrefixOp(Cast\Object_::class, '(object) ', $node->expr);
504
+	}
505
+
506
+	protected function pExpr_Cast_Bool(Cast\Bool_ $node) {
507
+		return $this->pPrefixOp(Cast\Bool_::class, '(bool) ', $node->expr);
508
+	}
509
+
510
+	protected function pExpr_Cast_Unset(Cast\Unset_ $node) {
511
+		return $this->pPrefixOp(Cast\Unset_::class, '(unset) ', $node->expr);
512
+	}
513
+
514
+	// Function calls and similar constructs
515
+
516
+	protected function pExpr_FuncCall(Expr\FuncCall $node) {
517
+		return $this->pCallLhs($node->name)
518
+			 . '(' . $this->pMaybeMultiline($node->args) . ')';
519
+	}
520
+
521
+	protected function pExpr_MethodCall(Expr\MethodCall $node) {
522
+		return $this->pDereferenceLhs($node->var) . '->' . $this->pObjectProperty($node->name)
523
+			 . '(' . $this->pMaybeMultiline($node->args) . ')';
524
+	}
525
+
526
+	protected function pExpr_NullsafeMethodCall(Expr\NullsafeMethodCall $node) {
527
+		return $this->pDereferenceLhs($node->var) . '?->' . $this->pObjectProperty($node->name)
528
+			. '(' . $this->pMaybeMultiline($node->args) . ')';
529
+	}
530
+
531
+	protected function pExpr_StaticCall(Expr\StaticCall $node) {
532
+		return $this->pDereferenceLhs($node->class) . '::'
533
+			 . ($node->name instanceof Expr
534
+				? ($node->name instanceof Expr\Variable
535
+				   ? $this->p($node->name)
536
+				   : '{' . $this->p($node->name) . '}')
537
+				: $node->name)
538
+			 . '(' . $this->pMaybeMultiline($node->args) . ')';
539
+	}
540
+
541
+	protected function pExpr_Empty(Expr\Empty_ $node) {
542
+		return 'empty(' . $this->p($node->expr) . ')';
543
+	}
544
+
545
+	protected function pExpr_Isset(Expr\Isset_ $node) {
546
+		return 'isset(' . $this->pCommaSeparated($node->vars) . ')';
547
+	}
548
+
549
+	protected function pExpr_Eval(Expr\Eval_ $node) {
550
+		return 'eval(' . $this->p($node->expr) . ')';
551
+	}
552
+
553
+	protected function pExpr_Include(Expr\Include_ $node) {
554
+		static $map = [
555
+			Expr\Include_::TYPE_INCLUDE      => 'include',
556
+			Expr\Include_::TYPE_INCLUDE_ONCE => 'include_once',
557
+			Expr\Include_::TYPE_REQUIRE      => 'require',
558
+			Expr\Include_::TYPE_REQUIRE_ONCE => 'require_once',
559
+		];
560
+
561
+		return $map[$node->type] . ' ' . $this->p($node->expr);
562
+	}
563
+
564
+	protected function pExpr_List(Expr\List_ $node) {
565
+		return 'list(' . $this->pCommaSeparated($node->items) . ')';
566
+	}
567
+
568
+	// Other
569
+
570
+	protected function pExpr_Error(Expr\Error $node) {
571
+		throw new \LogicException('Cannot pretty-print AST with Error nodes');
572
+	}
573
+
574
+	protected function pExpr_Variable(Expr\Variable $node) {
575
+		if ($node->name instanceof Expr) {
576
+			return '${' . $this->p($node->name) . '}';
577
+		} else {
578
+			return '$' . $node->name;
579
+		}
580
+	}
581
+
582
+	protected function pExpr_Array(Expr\Array_ $node) {
583
+		$syntax = $node->getAttribute('kind',
584
+			$this->options['shortArraySyntax'] ? Expr\Array_::KIND_SHORT : Expr\Array_::KIND_LONG);
585
+		if ($syntax === Expr\Array_::KIND_SHORT) {
586
+			return '[' . $this->pMaybeMultiline($node->items, true) . ']';
587
+		} else {
588
+			return 'array(' . $this->pMaybeMultiline($node->items, true) . ')';
589
+		}
590
+	}
591
+
592
+	protected function pExpr_ArrayItem(Expr\ArrayItem $node) {
593
+		return (null !== $node->key ? $this->p($node->key) . ' => ' : '')
594
+			 . ($node->byRef ? '&' : '')
595
+			 . ($node->unpack ? '...' : '')
596
+			 . $this->p($node->value);
597
+	}
598
+
599
+	protected function pExpr_ArrayDimFetch(Expr\ArrayDimFetch $node) {
600
+		return $this->pDereferenceLhs($node->var)
601
+			 . '[' . (null !== $node->dim ? $this->p($node->dim) : '') . ']';
602
+	}
603
+
604
+	protected function pExpr_ConstFetch(Expr\ConstFetch $node) {
605
+		return $this->p($node->name);
606
+	}
607
+
608
+	protected function pExpr_ClassConstFetch(Expr\ClassConstFetch $node) {
609
+		return $this->pDereferenceLhs($node->class) . '::' . $this->p($node->name);
610
+	}
611
+
612
+	protected function pExpr_PropertyFetch(Expr\PropertyFetch $node) {
613
+		return $this->pDereferenceLhs($node->var) . '->' . $this->pObjectProperty($node->name);
614
+	}
615
+
616
+	protected function pExpr_NullsafePropertyFetch(Expr\NullsafePropertyFetch $node) {
617
+		return $this->pDereferenceLhs($node->var) . '?->' . $this->pObjectProperty($node->name);
618
+	}
619
+
620
+	protected function pExpr_StaticPropertyFetch(Expr\StaticPropertyFetch $node) {
621
+		return $this->pDereferenceLhs($node->class) . '::$' . $this->pObjectProperty($node->name);
622
+	}
623
+
624
+	protected function pExpr_ShellExec(Expr\ShellExec $node) {
625
+		return '`' . $this->pEncapsList($node->parts, '`') . '`';
626
+	}
627
+
628
+	protected function pExpr_Closure(Expr\Closure $node) {
629
+		return $this->pAttrGroups($node->attrGroups, true)
630
+			 . ($node->static ? 'static ' : '')
631
+			 . 'function ' . ($node->byRef ? '&' : '')
632
+			 . '(' . $this->pCommaSeparated($node->params) . ')'
633
+			 . (!empty($node->uses) ? ' use(' . $this->pCommaSeparated($node->uses) . ')' : '')
634
+			 . (null !== $node->returnType ? ' : ' . $this->p($node->returnType) : '')
635
+			 . ' {' . $this->pStmts($node->stmts) . $this->nl . '}';
636
+	}
637
+
638
+	protected function pExpr_Match(Expr\Match_ $node) {
639
+		return 'match (' . $this->p($node->cond) . ') {'
640
+			. $this->pCommaSeparatedMultiline($node->arms, true)
641
+			. $this->nl
642
+			. '}';
643
+	}
644
+
645
+	protected function pMatchArm(Node\MatchArm $node) {
646
+		return ($node->conds ? $this->pCommaSeparated($node->conds) : 'default')
647
+			. ' => ' . $this->p($node->body);
648
+	}
649
+
650
+	protected function pExpr_ArrowFunction(Expr\ArrowFunction $node) {
651
+		return $this->pAttrGroups($node->attrGroups, true)
652
+			. ($node->static ? 'static ' : '')
653
+			. 'fn' . ($node->byRef ? '&' : '')
654
+			. '(' . $this->pCommaSeparated($node->params) . ')'
655
+			. (null !== $node->returnType ? ': ' . $this->p($node->returnType) : '')
656
+			. ' => '
657
+			. $this->p($node->expr);
658
+	}
659
+
660
+	protected function pExpr_ClosureUse(Expr\ClosureUse $node) {
661
+		return ($node->byRef ? '&' : '') . $this->p($node->var);
662
+	}
663
+
664
+	protected function pExpr_New(Expr\New_ $node) {
665
+		if ($node->class instanceof Stmt\Class_) {
666
+			$args = $node->args ? '(' . $this->pMaybeMultiline($node->args) . ')' : '';
667
+			return 'new ' . $this->pClassCommon($node->class, $args);
668
+		}
669
+		return 'new ' . $this->pNewVariable($node->class)
670
+			. '(' . $this->pMaybeMultiline($node->args) . ')';
671
+	}
672
+
673
+	protected function pExpr_Clone(Expr\Clone_ $node) {
674
+		return 'clone ' . $this->p($node->expr);
675
+	}
676
+
677
+	protected function pExpr_Ternary(Expr\Ternary $node) {
678
+		// a bit of cheating: we treat the ternary as a binary op where the ?...: part is the operator.
679
+		// this is okay because the part between ? and : never needs parentheses.
680
+		return $this->pInfixOp(Expr\Ternary::class,
681
+			$node->cond, ' ?' . (null !== $node->if ? ' ' . $this->p($node->if) . ' ' : '') . ': ', $node->else
682
+		);
683
+	}
684
+
685
+	protected function pExpr_Exit(Expr\Exit_ $node) {
686
+		$kind = $node->getAttribute('kind', Expr\Exit_::KIND_DIE);
687
+		return ($kind === Expr\Exit_::KIND_EXIT ? 'exit' : 'die')
688
+			 . (null !== $node->expr ? '(' . $this->p($node->expr) . ')' : '');
689
+	}
690
+
691
+	protected function pExpr_Throw(Expr\Throw_ $node) {
692
+		return 'throw ' . $this->p($node->expr);
693
+	}
694
+
695
+	protected function pExpr_Yield(Expr\Yield_ $node) {
696
+		if ($node->value === null) {
697
+			return 'yield';
698
+		} else {
699
+			// this is a bit ugly, but currently there is no way to detect whether the parentheses are necessary
700
+			return '(yield '
701
+				 . ($node->key !== null ? $this->p($node->key) . ' => ' : '')
702
+				 . $this->p($node->value)
703
+				 . ')';
704
+		}
705
+	}
706
+
707
+	// Declarations
708
+
709
+	protected function pStmt_Namespace(Stmt\Namespace_ $node) {
710
+		if ($this->canUseSemicolonNamespaces) {
711
+			return 'namespace ' . $this->p($node->name) . ';'
712
+				 . $this->nl . $this->pStmts($node->stmts, false);
713
+		} else {
714
+			return 'namespace' . (null !== $node->name ? ' ' . $this->p($node->name) : '')
715
+				 . ' {' . $this->pStmts($node->stmts) . $this->nl . '}';
716
+		}
717
+	}
718
+
719
+	protected function pStmt_Use(Stmt\Use_ $node) {
720
+		return 'use ' . $this->pUseType($node->type)
721
+			 . $this->pCommaSeparated($node->uses) . ';';
722
+	}
723
+
724
+	protected function pStmt_GroupUse(Stmt\GroupUse $node) {
725
+		return 'use ' . $this->pUseType($node->type) . $this->pName($node->prefix)
726
+			 . '\{' . $this->pCommaSeparated($node->uses) . '};';
727
+	}
728
+
729
+	protected function pStmt_UseUse(Stmt\UseUse $node) {
730
+		return $this->pUseType($node->type) . $this->p($node->name)
731
+			 . (null !== $node->alias ? ' as ' . $node->alias : '');
732
+	}
733
+
734
+	protected function pUseType($type) {
735
+		return $type === Stmt\Use_::TYPE_FUNCTION ? 'function '
736
+			: ($type === Stmt\Use_::TYPE_CONSTANT ? 'const ' : '');
737
+	}
738
+
739
+	protected function pStmt_Interface(Stmt\Interface_ $node) {
740
+		return $this->pAttrGroups($node->attrGroups)
741
+			 . 'interface ' . $node->name
742
+			 . (!empty($node->extends) ? ' extends ' . $this->pCommaSeparated($node->extends) : '')
743
+			 . $this->nl . '{' . $this->pStmts($node->stmts) . $this->nl . '}';
744
+	}
745
+
746
+	protected function pStmt_Enum(Stmt\Enum_ $node) {
747
+		return $this->pAttrGroups($node->attrGroups)
748
+			 . 'enum ' . $node->name
749
+			 . ($node->scalarType ? " : $node->scalarType" : '')
750
+			 . (!empty($node->implements) ? ' implements ' . $this->pCommaSeparated($node->implements) : '')
751
+			 . $this->nl . '{' . $this->pStmts($node->stmts) . $this->nl . '}';
752
+	}
753
+
754
+	protected function pStmt_Class(Stmt\Class_ $node) {
755
+		return $this->pClassCommon($node, ' ' . $node->name);
756
+	}
757
+
758
+	protected function pStmt_Trait(Stmt\Trait_ $node) {
759
+		return $this->pAttrGroups($node->attrGroups)
760
+			 . 'trait ' . $node->name
761
+			 . $this->nl . '{' . $this->pStmts($node->stmts) . $this->nl . '}';
762
+	}
763
+
764
+	protected function pStmt_EnumCase(Stmt\EnumCase $node) {
765
+		return $this->pAttrGroups($node->attrGroups)
766
+			 . 'case ' . $node->name
767
+			 . ($node->expr ? ' = ' . $this->p($node->expr) : '')
768
+			 . ';';
769
+	}
770
+
771
+	protected function pStmt_TraitUse(Stmt\TraitUse $node) {
772
+		return 'use ' . $this->pCommaSeparated($node->traits)
773
+			 . (empty($node->adaptations)
774
+				? ';'
775
+				: ' {' . $this->pStmts($node->adaptations) . $this->nl . '}');
776
+	}
777
+
778
+	protected function pStmt_TraitUseAdaptation_Precedence(Stmt\TraitUseAdaptation\Precedence $node) {
779
+		return $this->p($node->trait) . '::' . $node->method
780
+			 . ' insteadof ' . $this->pCommaSeparated($node->insteadof) . ';';
781
+	}
782
+
783
+	protected function pStmt_TraitUseAdaptation_Alias(Stmt\TraitUseAdaptation\Alias $node) {
784
+		return (null !== $node->trait ? $this->p($node->trait) . '::' : '')
785
+			 . $node->method . ' as'
786
+			 . (null !== $node->newModifier ? ' ' . rtrim($this->pModifiers($node->newModifier), ' ') : '')
787
+			 . (null !== $node->newName     ? ' ' . $node->newName                        : '')
788
+			 . ';';
789
+	}
790
+
791
+	protected function pStmt_Property(Stmt\Property $node) {
792
+		return $this->pAttrGroups($node->attrGroups)
793
+			. (0 === $node->flags ? 'var ' : $this->pModifiers($node->flags))
794
+			. ($node->type ? $this->p($node->type) . ' ' : '')
795
+			. $this->pCommaSeparated($node->props) . ';';
796
+	}
797
+
798
+	protected function pStmt_PropertyProperty(Stmt\PropertyProperty $node) {
799
+		return '$' . $node->name
800
+			 . (null !== $node->default ? ' = ' . $this->p($node->default) : '');
801
+	}
802
+
803
+	protected function pStmt_ClassMethod(Stmt\ClassMethod $node) {
804
+		return $this->pAttrGroups($node->attrGroups)
805
+			 . $this->pModifiers($node->flags)
806
+			 . 'function ' . ($node->byRef ? '&' : '') . $node->name
807
+			 . '(' . $this->pMaybeMultiline($node->params) . ')'
808
+			 . (null !== $node->returnType ? ' : ' . $this->p($node->returnType) : '')
809
+			 . (null !== $node->stmts
810
+				? $this->nl . '{' . $this->pStmts($node->stmts) . $this->nl . '}'
811
+				: ';');
812
+	}
813
+
814
+	protected function pStmt_ClassConst(Stmt\ClassConst $node) {
815
+		return $this->pAttrGroups($node->attrGroups)
816
+			 . $this->pModifiers($node->flags)
817
+			 . 'const ' . $this->pCommaSeparated($node->consts) . ';';
818
+	}
819
+
820
+	protected function pStmt_Function(Stmt\Function_ $node) {
821
+		return $this->pAttrGroups($node->attrGroups)
822
+			 . 'function ' . ($node->byRef ? '&' : '') . $node->name
823
+			 . '(' . $this->pCommaSeparated($node->params) . ')'
824
+			 . (null !== $node->returnType ? ' : ' . $this->p($node->returnType) : '')
825
+			 . $this->nl . '{' . $this->pStmts($node->stmts) . $this->nl . '}';
826
+	}
827
+
828
+	protected function pStmt_Const(Stmt\Const_ $node) {
829
+		return 'const ' . $this->pCommaSeparated($node->consts) . ';';
830
+	}
831
+
832
+	protected function pStmt_Declare(Stmt\Declare_ $node) {
833
+		return 'declare (' . $this->pCommaSeparated($node->declares) . ')'
834
+			 . (null !== $node->stmts ? ' {' . $this->pStmts($node->stmts) . $this->nl . '}' : ';');
835
+	}
836
+
837
+	protected function pStmt_DeclareDeclare(Stmt\DeclareDeclare $node) {
838
+		return $node->key . '=' . $this->p($node->value);
839
+	}
840
+
841
+	// Control flow
842
+
843
+	protected function pStmt_If(Stmt\If_ $node) {
844
+		return 'if (' . $this->p($node->cond) . ') {'
845
+			 . $this->pStmts($node->stmts) . $this->nl . '}'
846
+			 . ($node->elseifs ? ' ' . $this->pImplode($node->elseifs, ' ') : '')
847
+			 . (null !== $node->else ? ' ' . $this->p($node->else) : '');
848
+	}
849
+
850
+	protected function pStmt_ElseIf(Stmt\ElseIf_ $node) {
851
+		return 'elseif (' . $this->p($node->cond) . ') {'
852
+			 . $this->pStmts($node->stmts) . $this->nl . '}';
853
+	}
854
+
855
+	protected function pStmt_Else(Stmt\Else_ $node) {
856
+		return 'else {' . $this->pStmts($node->stmts) . $this->nl . '}';
857
+	}
858
+
859
+	protected function pStmt_For(Stmt\For_ $node) {
860
+		return 'for ('
861
+			 . $this->pCommaSeparated($node->init) . ';' . (!empty($node->cond) ? ' ' : '')
862
+			 . $this->pCommaSeparated($node->cond) . ';' . (!empty($node->loop) ? ' ' : '')
863
+			 . $this->pCommaSeparated($node->loop)
864
+			 . ') {' . $this->pStmts($node->stmts) . $this->nl . '}';
865
+	}
866
+
867
+	protected function pStmt_Foreach(Stmt\Foreach_ $node) {
868
+		return 'foreach (' . $this->p($node->expr) . ' as '
869
+			 . (null !== $node->keyVar ? $this->p($node->keyVar) . ' => ' : '')
870
+			 . ($node->byRef ? '&' : '') . $this->p($node->valueVar) . ') {'
871
+			 . $this->pStmts($node->stmts) . $this->nl . '}';
872
+	}
873
+
874
+	protected function pStmt_While(Stmt\While_ $node) {
875
+		return 'while (' . $this->p($node->cond) . ') {'
876
+			 . $this->pStmts($node->stmts) . $this->nl . '}';
877
+	}
878
+
879
+	protected function pStmt_Do(Stmt\Do_ $node) {
880
+		return 'do {' . $this->pStmts($node->stmts) . $this->nl
881
+			 . '} while (' . $this->p($node->cond) . ');';
882
+	}
883
+
884
+	protected function pStmt_Switch(Stmt\Switch_ $node) {
885
+		return 'switch (' . $this->p($node->cond) . ') {'
886
+			 . $this->pStmts($node->cases) . $this->nl . '}';
887
+	}
888
+
889
+	protected function pStmt_Case(Stmt\Case_ $node) {
890
+		return (null !== $node->cond ? 'case ' . $this->p($node->cond) : 'default') . ':'
891
+			 . $this->pStmts($node->stmts);
892
+	}
893
+
894
+	protected function pStmt_TryCatch(Stmt\TryCatch $node) {
895
+		return 'try {' . $this->pStmts($node->stmts) . $this->nl . '}'
896
+			 . ($node->catches ? ' ' . $this->pImplode($node->catches, ' ') : '')
897
+			 . ($node->finally !== null ? ' ' . $this->p($node->finally) : '');
898
+	}
899
+
900
+	protected function pStmt_Catch(Stmt\Catch_ $node) {
901
+		return 'catch (' . $this->pImplode($node->types, '|')
902
+			 . ($node->var !== null ? ' ' . $this->p($node->var) : '')
903
+			 . ') {' . $this->pStmts($node->stmts) . $this->nl . '}';
904
+	}
905
+
906
+	protected function pStmt_Finally(Stmt\Finally_ $node) {
907
+		return 'finally {' . $this->pStmts($node->stmts) . $this->nl . '}';
908
+	}
909
+
910
+	protected function pStmt_Break(Stmt\Break_ $node) {
911
+		return 'break' . ($node->num !== null ? ' ' . $this->p($node->num) : '') . ';';
912
+	}
913
+
914
+	protected function pStmt_Continue(Stmt\Continue_ $node) {
915
+		return 'continue' . ($node->num !== null ? ' ' . $this->p($node->num) : '') . ';';
916
+	}
917
+
918
+	protected function pStmt_Return(Stmt\Return_ $node) {
919
+		return 'return' . (null !== $node->expr ? ' ' . $this->p($node->expr) : '') . ';';
920
+	}
921
+
922
+	protected function pStmt_Throw(Stmt\Throw_ $node) {
923
+		return 'throw ' . $this->p($node->expr) . ';';
924
+	}
925
+
926
+	protected function pStmt_Label(Stmt\Label $node) {
927
+		return $node->name . ':';
928
+	}
929
+
930
+	protected function pStmt_Goto(Stmt\Goto_ $node) {
931
+		return 'goto ' . $node->name . ';';
932
+	}
933
+
934
+	// Other
935
+
936
+	protected function pStmt_Expression(Stmt\Expression $node) {
937
+		return $this->p($node->expr) . ';';
938
+	}
939
+
940
+	protected function pStmt_Echo(Stmt\Echo_ $node) {
941
+		return 'echo ' . $this->pCommaSeparated($node->exprs) . ';';
942
+	}
943
+
944
+	protected function pStmt_Static(Stmt\Static_ $node) {
945
+		return 'static ' . $this->pCommaSeparated($node->vars) . ';';
946
+	}
947
+
948
+	protected function pStmt_Global(Stmt\Global_ $node) {
949
+		return 'global ' . $this->pCommaSeparated($node->vars) . ';';
950
+	}
951
+
952
+	protected function pStmt_StaticVar(Stmt\StaticVar $node) {
953
+		return $this->p($node->var)
954
+			 . (null !== $node->default ? ' = ' . $this->p($node->default) : '');
955
+	}
956
+
957
+	protected function pStmt_Unset(Stmt\Unset_ $node) {
958
+		return 'unset(' . $this->pCommaSeparated($node->vars) . ');';
959
+	}
960
+
961
+	protected function pStmt_InlineHTML(Stmt\InlineHTML $node) {
962
+		$newline = $node->getAttribute('hasLeadingNewline', true) ? "\n" : '';
963
+		return '?>' . $newline . $node->value . '<?php ';
964
+	}
965
+
966
+	protected function pStmt_HaltCompiler(Stmt\HaltCompiler $node) {
967
+		return '__halt_compiler();' . $node->remaining;
968
+	}
969
+
970
+	protected function pStmt_Nop(Stmt\Nop $node) {
971
+		return '';
972
+	}
973
+
974
+	// Helpers
975
+
976
+	protected function pClassCommon(Stmt\Class_ $node, $afterClassToken) {
977
+		return $this->pAttrGroups($node->attrGroups, $node->name === null)
978
+			. $this->pModifiers($node->flags)
979
+			. 'class' . $afterClassToken
980
+			. (null !== $node->extends ? ' extends ' . $this->p($node->extends) : '')
981
+			. (!empty($node->implements) ? ' implements ' . $this->pCommaSeparated($node->implements) : '')
982
+			. $this->nl . '{' . $this->pStmts($node->stmts) . $this->nl . '}';
983
+	}
984
+
985
+	protected function pObjectProperty($node) {
986
+		if ($node instanceof Expr) {
987
+			return '{' . $this->p($node) . '}';
988
+		} else {
989
+			return $node;
990
+		}
991
+	}
992
+
993
+	protected function pEncapsList(array $encapsList, $quote) {
994
+		$return = '';
995
+		foreach ($encapsList as $element) {
996
+			if ($element instanceof Scalar\EncapsedStringPart) {
997
+				$return .= $this->escapeString($element->value, $quote);
998
+			} else {
999
+				$return .= '{' . $this->p($element) . '}';
1000
+			}
1001
+		}
1002
+
1003
+		return $return;
1004
+	}
1005
+
1006
+	protected function pSingleQuotedString(string $string) {
1007
+		return '\'' . addcslashes($string, '\'\\') . '\'';
1008
+	}
1009
+
1010
+	protected function escapeString($string, $quote) {
1011
+		if (null === $quote) {
1012
+			// For doc strings, don't escape newlines
1013
+			$escaped = addcslashes($string, "\t\f\v$\\");
1014
+		} else {
1015
+			$escaped = addcslashes($string, "\n\r\t\f\v$" . $quote . "\\");
1016
+		}
1017
+
1018
+		// Escape control characters and non-UTF-8 characters.
1019
+		// Regex based on https://stackoverflow.com/a/11709412/385378.
1020
+		$regex = '/(
1021 1021
               [\x00-\x08\x0E-\x1F] # Control characters
1022 1022
             | [\xC0-\xC1] # Invalid UTF-8 Bytes
1023 1023
             | [\xF5-\xFF] # Invalid UTF-8 Bytes
@@ -1032,82 +1032,82 @@  discard block
 block discarded – undo
1032 1032
             | (?<=[\xF0-\xF4])[\x80-\xBF](?![\x80-\xBF]{2}) # Short 4 byte sequence
1033 1033
             | (?<=[\xF0-\xF4][\x80-\xBF])[\x80-\xBF](?![\x80-\xBF]) # Short 4 byte sequence (2)
1034 1034
         )/x';
1035
-        return preg_replace_callback($regex, function ($matches) {
1036
-            assert(strlen($matches[0]) === 1);
1037
-            $hex = dechex(ord($matches[0]));;
1038
-            return '\\x' . str_pad($hex, 2, '0', \STR_PAD_LEFT);
1039
-        }, $escaped);
1040
-    }
1041
-
1042
-    protected function containsEndLabel($string, $label, $atStart = true, $atEnd = true) {
1043
-        $start = $atStart ? '(?:^|[\r\n])' : '[\r\n]';
1044
-        $end = $atEnd ? '(?:$|[;\r\n])' : '[;\r\n]';
1045
-        return false !== strpos($string, $label)
1046
-            && preg_match('/' . $start . $label . $end . '/', $string);
1047
-    }
1048
-
1049
-    protected function encapsedContainsEndLabel(array $parts, $label) {
1050
-        foreach ($parts as $i => $part) {
1051
-            $atStart = $i === 0;
1052
-            $atEnd = $i === count($parts) - 1;
1053
-            if ($part instanceof Scalar\EncapsedStringPart
1054
-                && $this->containsEndLabel($part->value, $label, $atStart, $atEnd)
1055
-            ) {
1056
-                return true;
1057
-            }
1058
-        }
1059
-        return false;
1060
-    }
1061
-
1062
-    protected function pDereferenceLhs(Node $node) {
1063
-        if (!$this->dereferenceLhsRequiresParens($node)) {
1064
-            return $this->p($node);
1065
-        } else  {
1066
-            return '(' . $this->p($node) . ')';
1067
-        }
1068
-    }
1069
-
1070
-    protected function pCallLhs(Node $node) {
1071
-        if (!$this->callLhsRequiresParens($node)) {
1072
-            return $this->p($node);
1073
-        } else  {
1074
-            return '(' . $this->p($node) . ')';
1075
-        }
1076
-    }
1077
-
1078
-    protected function pNewVariable(Node $node) {
1079
-        // TODO: This is not fully accurate.
1080
-        return $this->pDereferenceLhs($node);
1081
-    }
1082
-
1083
-    /**
1084
-     * @param Node[] $nodes
1085
-     * @return bool
1086
-     */
1087
-    protected function hasNodeWithComments(array $nodes) {
1088
-        foreach ($nodes as $node) {
1089
-            if ($node && $node->getComments()) {
1090
-                return true;
1091
-            }
1092
-        }
1093
-        return false;
1094
-    }
1095
-
1096
-    protected function pMaybeMultiline(array $nodes, bool $trailingComma = false) {
1097
-        if (!$this->hasNodeWithComments($nodes)) {
1098
-            return $this->pCommaSeparated($nodes);
1099
-        } else {
1100
-            return $this->pCommaSeparatedMultiline($nodes, $trailingComma) . $this->nl;
1101
-        }
1102
-    }
1103
-
1104
-    protected function pAttrGroups(array $nodes, bool $inline = false): string {
1105
-        $result = '';
1106
-        $sep = $inline ? ' ' : $this->nl;
1107
-        foreach ($nodes as $node) {
1108
-            $result .= $this->p($node) . $sep;
1109
-        }
1110
-
1111
-        return $result;
1112
-    }
1035
+		return preg_replace_callback($regex, function ($matches) {
1036
+			assert(strlen($matches[0]) === 1);
1037
+			$hex = dechex(ord($matches[0]));;
1038
+			return '\\x' . str_pad($hex, 2, '0', \STR_PAD_LEFT);
1039
+		}, $escaped);
1040
+	}
1041
+
1042
+	protected function containsEndLabel($string, $label, $atStart = true, $atEnd = true) {
1043
+		$start = $atStart ? '(?:^|[\r\n])' : '[\r\n]';
1044
+		$end = $atEnd ? '(?:$|[;\r\n])' : '[;\r\n]';
1045
+		return false !== strpos($string, $label)
1046
+			&& preg_match('/' . $start . $label . $end . '/', $string);
1047
+	}
1048
+
1049
+	protected function encapsedContainsEndLabel(array $parts, $label) {
1050
+		foreach ($parts as $i => $part) {
1051
+			$atStart = $i === 0;
1052
+			$atEnd = $i === count($parts) - 1;
1053
+			if ($part instanceof Scalar\EncapsedStringPart
1054
+				&& $this->containsEndLabel($part->value, $label, $atStart, $atEnd)
1055
+			) {
1056
+				return true;
1057
+			}
1058
+		}
1059
+		return false;
1060
+	}
1061
+
1062
+	protected function pDereferenceLhs(Node $node) {
1063
+		if (!$this->dereferenceLhsRequiresParens($node)) {
1064
+			return $this->p($node);
1065
+		} else  {
1066
+			return '(' . $this->p($node) . ')';
1067
+		}
1068
+	}
1069
+
1070
+	protected function pCallLhs(Node $node) {
1071
+		if (!$this->callLhsRequiresParens($node)) {
1072
+			return $this->p($node);
1073
+		} else  {
1074
+			return '(' . $this->p($node) . ')';
1075
+		}
1076
+	}
1077
+
1078
+	protected function pNewVariable(Node $node) {
1079
+		// TODO: This is not fully accurate.
1080
+		return $this->pDereferenceLhs($node);
1081
+	}
1082
+
1083
+	/**
1084
+	 * @param Node[] $nodes
1085
+	 * @return bool
1086
+	 */
1087
+	protected function hasNodeWithComments(array $nodes) {
1088
+		foreach ($nodes as $node) {
1089
+			if ($node && $node->getComments()) {
1090
+				return true;
1091
+			}
1092
+		}
1093
+		return false;
1094
+	}
1095
+
1096
+	protected function pMaybeMultiline(array $nodes, bool $trailingComma = false) {
1097
+		if (!$this->hasNodeWithComments($nodes)) {
1098
+			return $this->pCommaSeparated($nodes);
1099
+		} else {
1100
+			return $this->pCommaSeparatedMultiline($nodes, $trailingComma) . $this->nl;
1101
+		}
1102
+	}
1103
+
1104
+	protected function pAttrGroups(array $nodes, bool $inline = false): string {
1105
+		$result = '';
1106
+		$sep = $inline ? ' ' : $this->nl;
1107
+		foreach ($nodes as $node) {
1108
+			$result .= $this->p($node) . $sep;
1109
+		}
1110
+
1111
+		return $result;
1112
+	}
1113 1113
 }
Please login to merge, or discard this patch.
Spacing   +184 added lines, -184 removed lines patch added patch discarded remove patch
@@ -20,16 +20,16 @@  discard block
 block discarded – undo
20 20
     protected function pParam(Node\Param $node) {
21 21
         return $this->pAttrGroups($node->attrGroups, true)
22 22
              . $this->pModifiers($node->flags)
23
-             . ($node->type ? $this->p($node->type) . ' ' : '')
23
+             . ($node->type ? $this->p($node->type).' ' : '')
24 24
              . ($node->byRef ? '&' : '')
25 25
              . ($node->variadic ? '...' : '')
26 26
              . $this->p($node->var)
27
-             . ($node->default ? ' = ' . $this->p($node->default) : '');
27
+             . ($node->default ? ' = '.$this->p($node->default) : '');
28 28
     }
29 29
 
30 30
     protected function pArg(Node\Arg $node) {
31
-        return ($node->name ? $node->name->toString() . ': ' : '')
32
-             . ($node->byRef ? '&' : '') . ($node->unpack ? '...' : '')
31
+        return ($node->name ? $node->name->toString().': ' : '')
32
+             . ($node->byRef ? '&' : '').($node->unpack ? '...' : '')
33 33
              . $this->p($node->value);
34 34
     }
35 35
 
@@ -38,18 +38,18 @@  discard block
 block discarded – undo
38 38
     }
39 39
 
40 40
     protected function pConst(Node\Const_ $node) {
41
-        return $node->name . ' = ' . $this->p($node->value);
41
+        return $node->name.' = '.$this->p($node->value);
42 42
     }
43 43
 
44 44
     protected function pNullableType(Node\NullableType $node) {
45
-        return '?' . $this->p($node->type);
45
+        return '?'.$this->p($node->type);
46 46
     }
47 47
 
48 48
     protected function pUnionType(Node\UnionType $node) {
49 49
         $types = [];
50 50
         foreach ($node->types as $typeNode) {
51 51
             if ($typeNode instanceof Node\IntersectionType) {
52
-                $types[] = '('. $this->p($typeNode) . ')';
52
+                $types[] = '('.$this->p($typeNode).')';
53 53
                 continue;
54 54
             }
55 55
             $types[] = $this->p($typeNode);
@@ -66,16 +66,16 @@  discard block
 block discarded – undo
66 66
     }
67 67
 
68 68
     protected function pVarLikeIdentifier(Node\VarLikeIdentifier $node) {
69
-        return '$' . $node->name;
69
+        return '$'.$node->name;
70 70
     }
71 71
 
72 72
     protected function pAttribute(Node\Attribute $node) {
73 73
         return $this->p($node->name)
74
-             . ($node->args ? '(' . $this->pCommaSeparated($node->args) . ')' : '');
74
+             . ($node->args ? '('.$this->pCommaSeparated($node->args).')' : '');
75 75
     }
76 76
 
77 77
     protected function pAttributeGroup(Node\AttributeGroup $node) {
78
-        return '#[' . $this->pCommaSeparated($node->attrs) . ']';
78
+        return '#['.$this->pCommaSeparated($node->attrs).']';
79 79
     }
80 80
 
81 81
     // Names
@@ -85,11 +85,11 @@  discard block
 block discarded – undo
85 85
     }
86 86
 
87 87
     protected function pName_FullyQualified(Name\FullyQualified $node) {
88
-        return '\\' . implode('\\', $node->parts);
88
+        return '\\'.implode('\\', $node->parts);
89 89
     }
90 90
 
91 91
     protected function pName_Relative(Name\Relative $node) {
92
-        return 'namespace\\' . implode('\\', $node->parts);
92
+        return 'namespace\\'.implode('\\', $node->parts);
93 93
     }
94 94
 
95 95
     // Magic Constants
@@ -133,9 +133,9 @@  discard block
 block discarded – undo
133 133
         switch ($kind) {
134 134
             case Scalar\String_::KIND_NOWDOC:
135 135
                 $label = $node->getAttribute('docLabel');
136
-                if ($label && !$this->containsEndLabel($node->value, $label)) {
136
+                if ($label && ! $this->containsEndLabel($node->value, $label)) {
137 137
                     if ($node->value === '') {
138
-                        return "<<<'$label'\n$label" . $this->docStringEndToken;
138
+                        return "<<<'$label'\n$label".$this->docStringEndToken;
139 139
                     }
140 140
 
141 141
                     return "<<<'$label'\n$node->value\n$label"
@@ -146,18 +146,18 @@  discard block
 block discarded – undo
146 146
                 return $this->pSingleQuotedString($node->value);
147 147
             case Scalar\String_::KIND_HEREDOC:
148 148
                 $label = $node->getAttribute('docLabel');
149
-                if ($label && !$this->containsEndLabel($node->value, $label)) {
149
+                if ($label && ! $this->containsEndLabel($node->value, $label)) {
150 150
                     if ($node->value === '') {
151
-                        return "<<<$label\n$label" . $this->docStringEndToken;
151
+                        return "<<<$label\n$label".$this->docStringEndToken;
152 152
                     }
153 153
 
154 154
                     $escaped = $this->escapeString($node->value, null);
155
-                    return "<<<$label\n" . $escaped . "\n$label"
155
+                    return "<<<$label\n".$escaped."\n$label"
156 156
                          . $this->docStringEndToken;
157 157
                 }
158 158
             /* break missing intentionally */
159 159
             case Scalar\String_::KIND_DOUBLE_QUOTED:
160
-                return '"' . $this->escapeString($node->value, '"') . '"';
160
+                return '"'.$this->escapeString($node->value, '"').'"';
161 161
         }
162 162
         throw new \Exception('Invalid string kind');
163 163
     }
@@ -165,26 +165,26 @@  discard block
 block discarded – undo
165 165
     protected function pScalar_Encapsed(Scalar\Encapsed $node) {
166 166
         if ($node->getAttribute('kind') === Scalar\String_::KIND_HEREDOC) {
167 167
             $label = $node->getAttribute('docLabel');
168
-            if ($label && !$this->encapsedContainsEndLabel($node->parts, $label)) {
168
+            if ($label && ! $this->encapsedContainsEndLabel($node->parts, $label)) {
169 169
                 if (count($node->parts) === 1
170 170
                     && $node->parts[0] instanceof Scalar\EncapsedStringPart
171 171
                     && $node->parts[0]->value === ''
172 172
                 ) {
173
-                    return "<<<$label\n$label" . $this->docStringEndToken;
173
+                    return "<<<$label\n$label".$this->docStringEndToken;
174 174
                 }
175 175
 
176
-                return "<<<$label\n" . $this->pEncapsList($node->parts, null) . "\n$label"
176
+                return "<<<$label\n".$this->pEncapsList($node->parts, null)."\n$label"
177 177
                      . $this->docStringEndToken;
178 178
             }
179 179
         }
180
-        return '"' . $this->pEncapsList($node->parts, '"') . '"';
180
+        return '"'.$this->pEncapsList($node->parts, '"').'"';
181 181
     }
182 182
 
183 183
     protected function pScalar_LNumber(Scalar\LNumber $node) {
184 184
         if ($node->value === -\PHP_INT_MAX-1) {
185 185
             // PHP_INT_MIN cannot be represented as a literal,
186 186
             // because the sign is not part of the literal
187
-            return '(-' . \PHP_INT_MAX . '-1)';
187
+            return '(-'.\PHP_INT_MAX.'-1)';
188 188
         }
189 189
 
190 190
         $kind = $node->getAttribute('kind', Scalar\LNumber::KIND_DEC);
@@ -201,17 +201,17 @@  discard block
 block discarded – undo
201 201
         }
202 202
         switch ($kind) {
203 203
             case Scalar\LNumber::KIND_BIN:
204
-                return $sign . '0b' . base_convert($str, 10, 2);
204
+                return $sign.'0b'.base_convert($str, 10, 2);
205 205
             case Scalar\LNumber::KIND_OCT:
206
-                return $sign . '0' . base_convert($str, 10, 8);
206
+                return $sign.'0'.base_convert($str, 10, 8);
207 207
             case Scalar\LNumber::KIND_HEX:
208
-                return $sign . '0x' . base_convert($str, 10, 16);
208
+                return $sign.'0x'.base_convert($str, 10, 16);
209 209
         }
210 210
         throw new \Exception('Invalid number kind');
211 211
     }
212 212
 
213 213
     protected function pScalar_DNumber(Scalar\DNumber $node) {
214
-        if (!is_finite($node->value)) {
214
+        if ( ! is_finite($node->value)) {
215 215
             if ($node->value === \INF) {
216 216
                 return '\INF';
217 217
             } elseif ($node->value === -\INF) {
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
         $stringValue = str_replace(',', '.', $stringValue);
234 234
 
235 235
         // ensure that number is really printed as float
236
-        return preg_match('/^-?[0-9]+$/', $stringValue) ? $stringValue . '.0' : $stringValue;
236
+        return preg_match('/^-?[0-9]+$/', $stringValue) ? $stringValue.'.0' : $stringValue;
237 237
     }
238 238
 
239 239
     protected function pScalar_EncapsedStringPart(Scalar\EncapsedStringPart $node) {
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
     protected function pExpr_UnaryMinus(Expr\UnaryMinus $node) {
433 433
         if ($node->expr instanceof Expr\UnaryMinus || $node->expr instanceof Expr\PreDec) {
434 434
             // Enforce -(-$expr) instead of --$expr
435
-            return '-(' . $this->p($node->expr) . ')';
435
+            return '-('.$this->p($node->expr).')';
436 436
         }
437 437
         return $this->pPrefixOp(Expr\UnaryMinus::class, '-', $node->expr);
438 438
     }
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
     protected function pExpr_UnaryPlus(Expr\UnaryPlus $node) {
441 441
         if ($node->expr instanceof Expr\UnaryPlus || $node->expr instanceof Expr\PreInc) {
442 442
             // Enforce +(+$expr) instead of ++$expr
443
-            return '+(' . $this->p($node->expr) . ')';
443
+            return '+('.$this->p($node->expr).')';
444 444
         }
445 445
         return $this->pPrefixOp(Expr\UnaryPlus::class, '+', $node->expr);
446 446
     }
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
         } elseif ($kind === Cast\Double::KIND_REAL) {
489 489
             $cast = '(real)';
490 490
         }
491
-        return $this->pPrefixOp(Cast\Double::class, $cast . ' ', $node->expr);
491
+        return $this->pPrefixOp(Cast\Double::class, $cast.' ', $node->expr);
492 492
     }
493 493
 
494 494
     protected function pExpr_Cast_String(Cast\String_ $node) {
@@ -515,39 +515,39 @@  discard block
 block discarded – undo
515 515
 
516 516
     protected function pExpr_FuncCall(Expr\FuncCall $node) {
517 517
         return $this->pCallLhs($node->name)
518
-             . '(' . $this->pMaybeMultiline($node->args) . ')';
518
+             . '('.$this->pMaybeMultiline($node->args).')';
519 519
     }
520 520
 
521 521
     protected function pExpr_MethodCall(Expr\MethodCall $node) {
522
-        return $this->pDereferenceLhs($node->var) . '->' . $this->pObjectProperty($node->name)
523
-             . '(' . $this->pMaybeMultiline($node->args) . ')';
522
+        return $this->pDereferenceLhs($node->var).'->'.$this->pObjectProperty($node->name)
523
+             . '('.$this->pMaybeMultiline($node->args).')';
524 524
     }
525 525
 
526 526
     protected function pExpr_NullsafeMethodCall(Expr\NullsafeMethodCall $node) {
527
-        return $this->pDereferenceLhs($node->var) . '?->' . $this->pObjectProperty($node->name)
528
-            . '(' . $this->pMaybeMultiline($node->args) . ')';
527
+        return $this->pDereferenceLhs($node->var).'?->'.$this->pObjectProperty($node->name)
528
+            . '('.$this->pMaybeMultiline($node->args).')';
529 529
     }
530 530
 
531 531
     protected function pExpr_StaticCall(Expr\StaticCall $node) {
532
-        return $this->pDereferenceLhs($node->class) . '::'
532
+        return $this->pDereferenceLhs($node->class).'::'
533 533
              . ($node->name instanceof Expr
534 534
                 ? ($node->name instanceof Expr\Variable
535 535
                    ? $this->p($node->name)
536
-                   : '{' . $this->p($node->name) . '}')
536
+                   : '{'.$this->p($node->name).'}')
537 537
                 : $node->name)
538
-             . '(' . $this->pMaybeMultiline($node->args) . ')';
538
+             . '('.$this->pMaybeMultiline($node->args).')';
539 539
     }
540 540
 
541 541
     protected function pExpr_Empty(Expr\Empty_ $node) {
542
-        return 'empty(' . $this->p($node->expr) . ')';
542
+        return 'empty('.$this->p($node->expr).')';
543 543
     }
544 544
 
545 545
     protected function pExpr_Isset(Expr\Isset_ $node) {
546
-        return 'isset(' . $this->pCommaSeparated($node->vars) . ')';
546
+        return 'isset('.$this->pCommaSeparated($node->vars).')';
547 547
     }
548 548
 
549 549
     protected function pExpr_Eval(Expr\Eval_ $node) {
550
-        return 'eval(' . $this->p($node->expr) . ')';
550
+        return 'eval('.$this->p($node->expr).')';
551 551
     }
552 552
 
553 553
     protected function pExpr_Include(Expr\Include_ $node) {
@@ -558,11 +558,11 @@  discard block
 block discarded – undo
558 558
             Expr\Include_::TYPE_REQUIRE_ONCE => 'require_once',
559 559
         ];
560 560
 
561
-        return $map[$node->type] . ' ' . $this->p($node->expr);
561
+        return $map[$node->type].' '.$this->p($node->expr);
562 562
     }
563 563
 
564 564
     protected function pExpr_List(Expr\List_ $node) {
565
-        return 'list(' . $this->pCommaSeparated($node->items) . ')';
565
+        return 'list('.$this->pCommaSeparated($node->items).')';
566 566
     }
567 567
 
568 568
     // Other
@@ -573,9 +573,9 @@  discard block
 block discarded – undo
573 573
 
574 574
     protected function pExpr_Variable(Expr\Variable $node) {
575 575
         if ($node->name instanceof Expr) {
576
-            return '${' . $this->p($node->name) . '}';
576
+            return '${'.$this->p($node->name).'}';
577 577
         } else {
578
-            return '$' . $node->name;
578
+            return '$'.$node->name;
579 579
         }
580 580
     }
581 581
 
@@ -583,14 +583,14 @@  discard block
 block discarded – undo
583 583
         $syntax = $node->getAttribute('kind',
584 584
             $this->options['shortArraySyntax'] ? Expr\Array_::KIND_SHORT : Expr\Array_::KIND_LONG);
585 585
         if ($syntax === Expr\Array_::KIND_SHORT) {
586
-            return '[' . $this->pMaybeMultiline($node->items, true) . ']';
586
+            return '['.$this->pMaybeMultiline($node->items, true).']';
587 587
         } else {
588
-            return 'array(' . $this->pMaybeMultiline($node->items, true) . ')';
588
+            return 'array('.$this->pMaybeMultiline($node->items, true).')';
589 589
         }
590 590
     }
591 591
 
592 592
     protected function pExpr_ArrayItem(Expr\ArrayItem $node) {
593
-        return (null !== $node->key ? $this->p($node->key) . ' => ' : '')
593
+        return (null !== $node->key ? $this->p($node->key).' => ' : '')
594 594
              . ($node->byRef ? '&' : '')
595 595
              . ($node->unpack ? '...' : '')
596 596
              . $this->p($node->value);
@@ -598,7 +598,7 @@  discard block
 block discarded – undo
598 598
 
599 599
     protected function pExpr_ArrayDimFetch(Expr\ArrayDimFetch $node) {
600 600
         return $this->pDereferenceLhs($node->var)
601
-             . '[' . (null !== $node->dim ? $this->p($node->dim) : '') . ']';
601
+             . '['.(null !== $node->dim ? $this->p($node->dim) : '').']';
602 602
     }
603 603
 
604 604
     protected function pExpr_ConstFetch(Expr\ConstFetch $node) {
@@ -606,37 +606,37 @@  discard block
 block discarded – undo
606 606
     }
607 607
 
608 608
     protected function pExpr_ClassConstFetch(Expr\ClassConstFetch $node) {
609
-        return $this->pDereferenceLhs($node->class) . '::' . $this->p($node->name);
609
+        return $this->pDereferenceLhs($node->class).'::'.$this->p($node->name);
610 610
     }
611 611
 
612 612
     protected function pExpr_PropertyFetch(Expr\PropertyFetch $node) {
613
-        return $this->pDereferenceLhs($node->var) . '->' . $this->pObjectProperty($node->name);
613
+        return $this->pDereferenceLhs($node->var).'->'.$this->pObjectProperty($node->name);
614 614
     }
615 615
 
616 616
     protected function pExpr_NullsafePropertyFetch(Expr\NullsafePropertyFetch $node) {
617
-        return $this->pDereferenceLhs($node->var) . '?->' . $this->pObjectProperty($node->name);
617
+        return $this->pDereferenceLhs($node->var).'?->'.$this->pObjectProperty($node->name);
618 618
     }
619 619
 
620 620
     protected function pExpr_StaticPropertyFetch(Expr\StaticPropertyFetch $node) {
621
-        return $this->pDereferenceLhs($node->class) . '::$' . $this->pObjectProperty($node->name);
621
+        return $this->pDereferenceLhs($node->class).'::$'.$this->pObjectProperty($node->name);
622 622
     }
623 623
 
624 624
     protected function pExpr_ShellExec(Expr\ShellExec $node) {
625
-        return '`' . $this->pEncapsList($node->parts, '`') . '`';
625
+        return '`'.$this->pEncapsList($node->parts, '`').'`';
626 626
     }
627 627
 
628 628
     protected function pExpr_Closure(Expr\Closure $node) {
629 629
         return $this->pAttrGroups($node->attrGroups, true)
630 630
              . ($node->static ? 'static ' : '')
631
-             . 'function ' . ($node->byRef ? '&' : '')
632
-             . '(' . $this->pCommaSeparated($node->params) . ')'
633
-             . (!empty($node->uses) ? ' use(' . $this->pCommaSeparated($node->uses) . ')' : '')
634
-             . (null !== $node->returnType ? ' : ' . $this->p($node->returnType) : '')
635
-             . ' {' . $this->pStmts($node->stmts) . $this->nl . '}';
631
+             . 'function '.($node->byRef ? '&' : '')
632
+             . '('.$this->pCommaSeparated($node->params).')'
633
+             . ( ! empty($node->uses) ? ' use('.$this->pCommaSeparated($node->uses).')' : '')
634
+             . (null !== $node->returnType ? ' : '.$this->p($node->returnType) : '')
635
+             . ' {'.$this->pStmts($node->stmts).$this->nl.'}';
636 636
     }
637 637
 
638 638
     protected function pExpr_Match(Expr\Match_ $node) {
639
-        return 'match (' . $this->p($node->cond) . ') {'
639
+        return 'match ('.$this->p($node->cond).') {'
640 640
             . $this->pCommaSeparatedMultiline($node->arms, true)
641 641
             . $this->nl
642 642
             . '}';
@@ -644,52 +644,52 @@  discard block
 block discarded – undo
644 644
 
645 645
     protected function pMatchArm(Node\MatchArm $node) {
646 646
         return ($node->conds ? $this->pCommaSeparated($node->conds) : 'default')
647
-            . ' => ' . $this->p($node->body);
647
+            . ' => '.$this->p($node->body);
648 648
     }
649 649
 
650 650
     protected function pExpr_ArrowFunction(Expr\ArrowFunction $node) {
651 651
         return $this->pAttrGroups($node->attrGroups, true)
652 652
             . ($node->static ? 'static ' : '')
653
-            . 'fn' . ($node->byRef ? '&' : '')
654
-            . '(' . $this->pCommaSeparated($node->params) . ')'
655
-            . (null !== $node->returnType ? ': ' . $this->p($node->returnType) : '')
653
+            . 'fn'.($node->byRef ? '&' : '')
654
+            . '('.$this->pCommaSeparated($node->params).')'
655
+            . (null !== $node->returnType ? ': '.$this->p($node->returnType) : '')
656 656
             . ' => '
657 657
             . $this->p($node->expr);
658 658
     }
659 659
 
660 660
     protected function pExpr_ClosureUse(Expr\ClosureUse $node) {
661
-        return ($node->byRef ? '&' : '') . $this->p($node->var);
661
+        return ($node->byRef ? '&' : '').$this->p($node->var);
662 662
     }
663 663
 
664 664
     protected function pExpr_New(Expr\New_ $node) {
665 665
         if ($node->class instanceof Stmt\Class_) {
666
-            $args = $node->args ? '(' . $this->pMaybeMultiline($node->args) . ')' : '';
667
-            return 'new ' . $this->pClassCommon($node->class, $args);
666
+            $args = $node->args ? '('.$this->pMaybeMultiline($node->args).')' : '';
667
+            return 'new '.$this->pClassCommon($node->class, $args);
668 668
         }
669
-        return 'new ' . $this->pNewVariable($node->class)
670
-            . '(' . $this->pMaybeMultiline($node->args) . ')';
669
+        return 'new '.$this->pNewVariable($node->class)
670
+            . '('.$this->pMaybeMultiline($node->args).')';
671 671
     }
672 672
 
673 673
     protected function pExpr_Clone(Expr\Clone_ $node) {
674
-        return 'clone ' . $this->p($node->expr);
674
+        return 'clone '.$this->p($node->expr);
675 675
     }
676 676
 
677 677
     protected function pExpr_Ternary(Expr\Ternary $node) {
678 678
         // a bit of cheating: we treat the ternary as a binary op where the ?...: part is the operator.
679 679
         // this is okay because the part between ? and : never needs parentheses.
680 680
         return $this->pInfixOp(Expr\Ternary::class,
681
-            $node->cond, ' ?' . (null !== $node->if ? ' ' . $this->p($node->if) . ' ' : '') . ': ', $node->else
681
+            $node->cond, ' ?'.(null !== $node->if ? ' '.$this->p($node->if).' ' : '').': ', $node->else
682 682
         );
683 683
     }
684 684
 
685 685
     protected function pExpr_Exit(Expr\Exit_ $node) {
686 686
         $kind = $node->getAttribute('kind', Expr\Exit_::KIND_DIE);
687 687
         return ($kind === Expr\Exit_::KIND_EXIT ? 'exit' : 'die')
688
-             . (null !== $node->expr ? '(' . $this->p($node->expr) . ')' : '');
688
+             . (null !== $node->expr ? '('.$this->p($node->expr).')' : '');
689 689
     }
690 690
 
691 691
     protected function pExpr_Throw(Expr\Throw_ $node) {
692
-        return 'throw ' . $this->p($node->expr);
692
+        return 'throw '.$this->p($node->expr);
693 693
     }
694 694
 
695 695
     protected function pExpr_Yield(Expr\Yield_ $node) {
@@ -698,7 +698,7 @@  discard block
 block discarded – undo
698 698
         } else {
699 699
             // this is a bit ugly, but currently there is no way to detect whether the parentheses are necessary
700 700
             return '(yield '
701
-                 . ($node->key !== null ? $this->p($node->key) . ' => ' : '')
701
+                 . ($node->key !== null ? $this->p($node->key).' => ' : '')
702 702
                  . $this->p($node->value)
703 703
                  . ')';
704 704
         }
@@ -708,27 +708,27 @@  discard block
 block discarded – undo
708 708
 
709 709
     protected function pStmt_Namespace(Stmt\Namespace_ $node) {
710 710
         if ($this->canUseSemicolonNamespaces) {
711
-            return 'namespace ' . $this->p($node->name) . ';'
712
-                 . $this->nl . $this->pStmts($node->stmts, false);
711
+            return 'namespace '.$this->p($node->name).';'
712
+                 . $this->nl.$this->pStmts($node->stmts, false);
713 713
         } else {
714
-            return 'namespace' . (null !== $node->name ? ' ' . $this->p($node->name) : '')
715
-                 . ' {' . $this->pStmts($node->stmts) . $this->nl . '}';
714
+            return 'namespace'.(null !== $node->name ? ' '.$this->p($node->name) : '')
715
+                 . ' {'.$this->pStmts($node->stmts).$this->nl.'}';
716 716
         }
717 717
     }
718 718
 
719 719
     protected function pStmt_Use(Stmt\Use_ $node) {
720
-        return 'use ' . $this->pUseType($node->type)
721
-             . $this->pCommaSeparated($node->uses) . ';';
720
+        return 'use '.$this->pUseType($node->type)
721
+             . $this->pCommaSeparated($node->uses).';';
722 722
     }
723 723
 
724 724
     protected function pStmt_GroupUse(Stmt\GroupUse $node) {
725
-        return 'use ' . $this->pUseType($node->type) . $this->pName($node->prefix)
726
-             . '\{' . $this->pCommaSeparated($node->uses) . '};';
725
+        return 'use '.$this->pUseType($node->type).$this->pName($node->prefix)
726
+             . '\{'.$this->pCommaSeparated($node->uses).'};';
727 727
     }
728 728
 
729 729
     protected function pStmt_UseUse(Stmt\UseUse $node) {
730
-        return $this->pUseType($node->type) . $this->p($node->name)
731
-             . (null !== $node->alias ? ' as ' . $node->alias : '');
730
+        return $this->pUseType($node->type).$this->p($node->name)
731
+             . (null !== $node->alias ? ' as '.$node->alias : '');
732 732
     }
733 733
 
734 734
     protected function pUseType($type) {
@@ -738,233 +738,233 @@  discard block
 block discarded – undo
738 738
 
739 739
     protected function pStmt_Interface(Stmt\Interface_ $node) {
740 740
         return $this->pAttrGroups($node->attrGroups)
741
-             . 'interface ' . $node->name
742
-             . (!empty($node->extends) ? ' extends ' . $this->pCommaSeparated($node->extends) : '')
743
-             . $this->nl . '{' . $this->pStmts($node->stmts) . $this->nl . '}';
741
+             . 'interface '.$node->name
742
+             . ( ! empty($node->extends) ? ' extends '.$this->pCommaSeparated($node->extends) : '')
743
+             . $this->nl.'{'.$this->pStmts($node->stmts).$this->nl.'}';
744 744
     }
745 745
 
746 746
     protected function pStmt_Enum(Stmt\Enum_ $node) {
747 747
         return $this->pAttrGroups($node->attrGroups)
748
-             . 'enum ' . $node->name
748
+             . 'enum '.$node->name
749 749
              . ($node->scalarType ? " : $node->scalarType" : '')
750
-             . (!empty($node->implements) ? ' implements ' . $this->pCommaSeparated($node->implements) : '')
751
-             . $this->nl . '{' . $this->pStmts($node->stmts) . $this->nl . '}';
750
+             . ( ! empty($node->implements) ? ' implements '.$this->pCommaSeparated($node->implements) : '')
751
+             . $this->nl.'{'.$this->pStmts($node->stmts).$this->nl.'}';
752 752
     }
753 753
 
754 754
     protected function pStmt_Class(Stmt\Class_ $node) {
755
-        return $this->pClassCommon($node, ' ' . $node->name);
755
+        return $this->pClassCommon($node, ' '.$node->name);
756 756
     }
757 757
 
758 758
     protected function pStmt_Trait(Stmt\Trait_ $node) {
759 759
         return $this->pAttrGroups($node->attrGroups)
760
-             . 'trait ' . $node->name
761
-             . $this->nl . '{' . $this->pStmts($node->stmts) . $this->nl . '}';
760
+             . 'trait '.$node->name
761
+             . $this->nl.'{'.$this->pStmts($node->stmts).$this->nl.'}';
762 762
     }
763 763
 
764 764
     protected function pStmt_EnumCase(Stmt\EnumCase $node) {
765 765
         return $this->pAttrGroups($node->attrGroups)
766
-             . 'case ' . $node->name
767
-             . ($node->expr ? ' = ' . $this->p($node->expr) : '')
766
+             . 'case '.$node->name
767
+             . ($node->expr ? ' = '.$this->p($node->expr) : '')
768 768
              . ';';
769 769
     }
770 770
 
771 771
     protected function pStmt_TraitUse(Stmt\TraitUse $node) {
772
-        return 'use ' . $this->pCommaSeparated($node->traits)
772
+        return 'use '.$this->pCommaSeparated($node->traits)
773 773
              . (empty($node->adaptations)
774 774
                 ? ';'
775
-                : ' {' . $this->pStmts($node->adaptations) . $this->nl . '}');
775
+                : ' {'.$this->pStmts($node->adaptations).$this->nl.'}');
776 776
     }
777 777
 
778 778
     protected function pStmt_TraitUseAdaptation_Precedence(Stmt\TraitUseAdaptation\Precedence $node) {
779
-        return $this->p($node->trait) . '::' . $node->method
780
-             . ' insteadof ' . $this->pCommaSeparated($node->insteadof) . ';';
779
+        return $this->p($node->trait).'::'.$node->method
780
+             . ' insteadof '.$this->pCommaSeparated($node->insteadof).';';
781 781
     }
782 782
 
783 783
     protected function pStmt_TraitUseAdaptation_Alias(Stmt\TraitUseAdaptation\Alias $node) {
784
-        return (null !== $node->trait ? $this->p($node->trait) . '::' : '')
785
-             . $node->method . ' as'
786
-             . (null !== $node->newModifier ? ' ' . rtrim($this->pModifiers($node->newModifier), ' ') : '')
787
-             . (null !== $node->newName     ? ' ' . $node->newName                        : '')
784
+        return (null !== $node->trait ? $this->p($node->trait).'::' : '')
785
+             . $node->method.' as'
786
+             . (null !== $node->newModifier ? ' '.rtrim($this->pModifiers($node->newModifier), ' ') : '')
787
+             . (null !== $node->newName ? ' '.$node->newName : '')
788 788
              . ';';
789 789
     }
790 790
 
791 791
     protected function pStmt_Property(Stmt\Property $node) {
792 792
         return $this->pAttrGroups($node->attrGroups)
793 793
             . (0 === $node->flags ? 'var ' : $this->pModifiers($node->flags))
794
-            . ($node->type ? $this->p($node->type) . ' ' : '')
795
-            . $this->pCommaSeparated($node->props) . ';';
794
+            . ($node->type ? $this->p($node->type).' ' : '')
795
+            . $this->pCommaSeparated($node->props).';';
796 796
     }
797 797
 
798 798
     protected function pStmt_PropertyProperty(Stmt\PropertyProperty $node) {
799
-        return '$' . $node->name
800
-             . (null !== $node->default ? ' = ' . $this->p($node->default) : '');
799
+        return '$'.$node->name
800
+             . (null !== $node->default ? ' = '.$this->p($node->default) : '');
801 801
     }
802 802
 
803 803
     protected function pStmt_ClassMethod(Stmt\ClassMethod $node) {
804 804
         return $this->pAttrGroups($node->attrGroups)
805 805
              . $this->pModifiers($node->flags)
806
-             . 'function ' . ($node->byRef ? '&' : '') . $node->name
807
-             . '(' . $this->pMaybeMultiline($node->params) . ')'
808
-             . (null !== $node->returnType ? ' : ' . $this->p($node->returnType) : '')
806
+             . 'function '.($node->byRef ? '&' : '').$node->name
807
+             . '('.$this->pMaybeMultiline($node->params).')'
808
+             . (null !== $node->returnType ? ' : '.$this->p($node->returnType) : '')
809 809
              . (null !== $node->stmts
810
-                ? $this->nl . '{' . $this->pStmts($node->stmts) . $this->nl . '}'
810
+                ? $this->nl.'{'.$this->pStmts($node->stmts).$this->nl.'}'
811 811
                 : ';');
812 812
     }
813 813
 
814 814
     protected function pStmt_ClassConst(Stmt\ClassConst $node) {
815 815
         return $this->pAttrGroups($node->attrGroups)
816 816
              . $this->pModifiers($node->flags)
817
-             . 'const ' . $this->pCommaSeparated($node->consts) . ';';
817
+             . 'const '.$this->pCommaSeparated($node->consts).';';
818 818
     }
819 819
 
820 820
     protected function pStmt_Function(Stmt\Function_ $node) {
821 821
         return $this->pAttrGroups($node->attrGroups)
822
-             . 'function ' . ($node->byRef ? '&' : '') . $node->name
823
-             . '(' . $this->pCommaSeparated($node->params) . ')'
824
-             . (null !== $node->returnType ? ' : ' . $this->p($node->returnType) : '')
825
-             . $this->nl . '{' . $this->pStmts($node->stmts) . $this->nl . '}';
822
+             . 'function '.($node->byRef ? '&' : '').$node->name
823
+             . '('.$this->pCommaSeparated($node->params).')'
824
+             . (null !== $node->returnType ? ' : '.$this->p($node->returnType) : '')
825
+             . $this->nl.'{'.$this->pStmts($node->stmts).$this->nl.'}';
826 826
     }
827 827
 
828 828
     protected function pStmt_Const(Stmt\Const_ $node) {
829
-        return 'const ' . $this->pCommaSeparated($node->consts) . ';';
829
+        return 'const '.$this->pCommaSeparated($node->consts).';';
830 830
     }
831 831
 
832 832
     protected function pStmt_Declare(Stmt\Declare_ $node) {
833
-        return 'declare (' . $this->pCommaSeparated($node->declares) . ')'
834
-             . (null !== $node->stmts ? ' {' . $this->pStmts($node->stmts) . $this->nl . '}' : ';');
833
+        return 'declare ('.$this->pCommaSeparated($node->declares).')'
834
+             . (null !== $node->stmts ? ' {'.$this->pStmts($node->stmts).$this->nl.'}' : ';');
835 835
     }
836 836
 
837 837
     protected function pStmt_DeclareDeclare(Stmt\DeclareDeclare $node) {
838
-        return $node->key . '=' . $this->p($node->value);
838
+        return $node->key.'='.$this->p($node->value);
839 839
     }
840 840
 
841 841
     // Control flow
842 842
 
843 843
     protected function pStmt_If(Stmt\If_ $node) {
844
-        return 'if (' . $this->p($node->cond) . ') {'
845
-             . $this->pStmts($node->stmts) . $this->nl . '}'
846
-             . ($node->elseifs ? ' ' . $this->pImplode($node->elseifs, ' ') : '')
847
-             . (null !== $node->else ? ' ' . $this->p($node->else) : '');
844
+        return 'if ('.$this->p($node->cond).') {'
845
+             . $this->pStmts($node->stmts).$this->nl.'}'
846
+             . ($node->elseifs ? ' '.$this->pImplode($node->elseifs, ' ') : '')
847
+             . (null !== $node->else ? ' '.$this->p($node->else) : '');
848 848
     }
849 849
 
850 850
     protected function pStmt_ElseIf(Stmt\ElseIf_ $node) {
851
-        return 'elseif (' . $this->p($node->cond) . ') {'
852
-             . $this->pStmts($node->stmts) . $this->nl . '}';
851
+        return 'elseif ('.$this->p($node->cond).') {'
852
+             . $this->pStmts($node->stmts).$this->nl.'}';
853 853
     }
854 854
 
855 855
     protected function pStmt_Else(Stmt\Else_ $node) {
856
-        return 'else {' . $this->pStmts($node->stmts) . $this->nl . '}';
856
+        return 'else {'.$this->pStmts($node->stmts).$this->nl.'}';
857 857
     }
858 858
 
859 859
     protected function pStmt_For(Stmt\For_ $node) {
860 860
         return 'for ('
861
-             . $this->pCommaSeparated($node->init) . ';' . (!empty($node->cond) ? ' ' : '')
862
-             . $this->pCommaSeparated($node->cond) . ';' . (!empty($node->loop) ? ' ' : '')
861
+             . $this->pCommaSeparated($node->init).';'.( ! empty($node->cond) ? ' ' : '')
862
+             . $this->pCommaSeparated($node->cond).';'.( ! empty($node->loop) ? ' ' : '')
863 863
              . $this->pCommaSeparated($node->loop)
864
-             . ') {' . $this->pStmts($node->stmts) . $this->nl . '}';
864
+             . ') {'.$this->pStmts($node->stmts).$this->nl.'}';
865 865
     }
866 866
 
867 867
     protected function pStmt_Foreach(Stmt\Foreach_ $node) {
868
-        return 'foreach (' . $this->p($node->expr) . ' as '
869
-             . (null !== $node->keyVar ? $this->p($node->keyVar) . ' => ' : '')
870
-             . ($node->byRef ? '&' : '') . $this->p($node->valueVar) . ') {'
871
-             . $this->pStmts($node->stmts) . $this->nl . '}';
868
+        return 'foreach ('.$this->p($node->expr).' as '
869
+             . (null !== $node->keyVar ? $this->p($node->keyVar).' => ' : '')
870
+             . ($node->byRef ? '&' : '').$this->p($node->valueVar).') {'
871
+             . $this->pStmts($node->stmts).$this->nl.'}';
872 872
     }
873 873
 
874 874
     protected function pStmt_While(Stmt\While_ $node) {
875
-        return 'while (' . $this->p($node->cond) . ') {'
876
-             . $this->pStmts($node->stmts) . $this->nl . '}';
875
+        return 'while ('.$this->p($node->cond).') {'
876
+             . $this->pStmts($node->stmts).$this->nl.'}';
877 877
     }
878 878
 
879 879
     protected function pStmt_Do(Stmt\Do_ $node) {
880
-        return 'do {' . $this->pStmts($node->stmts) . $this->nl
881
-             . '} while (' . $this->p($node->cond) . ');';
880
+        return 'do {'.$this->pStmts($node->stmts).$this->nl
881
+             . '} while ('.$this->p($node->cond).');';
882 882
     }
883 883
 
884 884
     protected function pStmt_Switch(Stmt\Switch_ $node) {
885
-        return 'switch (' . $this->p($node->cond) . ') {'
886
-             . $this->pStmts($node->cases) . $this->nl . '}';
885
+        return 'switch ('.$this->p($node->cond).') {'
886
+             . $this->pStmts($node->cases).$this->nl.'}';
887 887
     }
888 888
 
889 889
     protected function pStmt_Case(Stmt\Case_ $node) {
890
-        return (null !== $node->cond ? 'case ' . $this->p($node->cond) : 'default') . ':'
890
+        return (null !== $node->cond ? 'case '.$this->p($node->cond) : 'default').':'
891 891
              . $this->pStmts($node->stmts);
892 892
     }
893 893
 
894 894
     protected function pStmt_TryCatch(Stmt\TryCatch $node) {
895
-        return 'try {' . $this->pStmts($node->stmts) . $this->nl . '}'
896
-             . ($node->catches ? ' ' . $this->pImplode($node->catches, ' ') : '')
897
-             . ($node->finally !== null ? ' ' . $this->p($node->finally) : '');
895
+        return 'try {'.$this->pStmts($node->stmts).$this->nl.'}'
896
+             . ($node->catches ? ' '.$this->pImplode($node->catches, ' ') : '')
897
+             . ($node->finally !== null ? ' '.$this->p($node->finally) : '');
898 898
     }
899 899
 
900 900
     protected function pStmt_Catch(Stmt\Catch_ $node) {
901
-        return 'catch (' . $this->pImplode($node->types, '|')
902
-             . ($node->var !== null ? ' ' . $this->p($node->var) : '')
903
-             . ') {' . $this->pStmts($node->stmts) . $this->nl . '}';
901
+        return 'catch ('.$this->pImplode($node->types, '|')
902
+             . ($node->var !== null ? ' '.$this->p($node->var) : '')
903
+             . ') {'.$this->pStmts($node->stmts).$this->nl.'}';
904 904
     }
905 905
 
906 906
     protected function pStmt_Finally(Stmt\Finally_ $node) {
907
-        return 'finally {' . $this->pStmts($node->stmts) . $this->nl . '}';
907
+        return 'finally {'.$this->pStmts($node->stmts).$this->nl.'}';
908 908
     }
909 909
 
910 910
     protected function pStmt_Break(Stmt\Break_ $node) {
911
-        return 'break' . ($node->num !== null ? ' ' . $this->p($node->num) : '') . ';';
911
+        return 'break'.($node->num !== null ? ' '.$this->p($node->num) : '').';';
912 912
     }
913 913
 
914 914
     protected function pStmt_Continue(Stmt\Continue_ $node) {
915
-        return 'continue' . ($node->num !== null ? ' ' . $this->p($node->num) : '') . ';';
915
+        return 'continue'.($node->num !== null ? ' '.$this->p($node->num) : '').';';
916 916
     }
917 917
 
918 918
     protected function pStmt_Return(Stmt\Return_ $node) {
919
-        return 'return' . (null !== $node->expr ? ' ' . $this->p($node->expr) : '') . ';';
919
+        return 'return'.(null !== $node->expr ? ' '.$this->p($node->expr) : '').';';
920 920
     }
921 921
 
922 922
     protected function pStmt_Throw(Stmt\Throw_ $node) {
923
-        return 'throw ' . $this->p($node->expr) . ';';
923
+        return 'throw '.$this->p($node->expr).';';
924 924
     }
925 925
 
926 926
     protected function pStmt_Label(Stmt\Label $node) {
927
-        return $node->name . ':';
927
+        return $node->name.':';
928 928
     }
929 929
 
930 930
     protected function pStmt_Goto(Stmt\Goto_ $node) {
931
-        return 'goto ' . $node->name . ';';
931
+        return 'goto '.$node->name.';';
932 932
     }
933 933
 
934 934
     // Other
935 935
 
936 936
     protected function pStmt_Expression(Stmt\Expression $node) {
937
-        return $this->p($node->expr) . ';';
937
+        return $this->p($node->expr).';';
938 938
     }
939 939
 
940 940
     protected function pStmt_Echo(Stmt\Echo_ $node) {
941
-        return 'echo ' . $this->pCommaSeparated($node->exprs) . ';';
941
+        return 'echo '.$this->pCommaSeparated($node->exprs).';';
942 942
     }
943 943
 
944 944
     protected function pStmt_Static(Stmt\Static_ $node) {
945
-        return 'static ' . $this->pCommaSeparated($node->vars) . ';';
945
+        return 'static '.$this->pCommaSeparated($node->vars).';';
946 946
     }
947 947
 
948 948
     protected function pStmt_Global(Stmt\Global_ $node) {
949
-        return 'global ' . $this->pCommaSeparated($node->vars) . ';';
949
+        return 'global '.$this->pCommaSeparated($node->vars).';';
950 950
     }
951 951
 
952 952
     protected function pStmt_StaticVar(Stmt\StaticVar $node) {
953 953
         return $this->p($node->var)
954
-             . (null !== $node->default ? ' = ' . $this->p($node->default) : '');
954
+             . (null !== $node->default ? ' = '.$this->p($node->default) : '');
955 955
     }
956 956
 
957 957
     protected function pStmt_Unset(Stmt\Unset_ $node) {
958
-        return 'unset(' . $this->pCommaSeparated($node->vars) . ');';
958
+        return 'unset('.$this->pCommaSeparated($node->vars).');';
959 959
     }
960 960
 
961 961
     protected function pStmt_InlineHTML(Stmt\InlineHTML $node) {
962 962
         $newline = $node->getAttribute('hasLeadingNewline', true) ? "\n" : '';
963
-        return '?>' . $newline . $node->value . '<?php ';
963
+        return '?>'.$newline.$node->value.'<?php ';
964 964
     }
965 965
 
966 966
     protected function pStmt_HaltCompiler(Stmt\HaltCompiler $node) {
967
-        return '__halt_compiler();' . $node->remaining;
967
+        return '__halt_compiler();'.$node->remaining;
968 968
     }
969 969
 
970 970
     protected function pStmt_Nop(Stmt\Nop $node) {
@@ -976,15 +976,15 @@  discard block
 block discarded – undo
976 976
     protected function pClassCommon(Stmt\Class_ $node, $afterClassToken) {
977 977
         return $this->pAttrGroups($node->attrGroups, $node->name === null)
978 978
             . $this->pModifiers($node->flags)
979
-            . 'class' . $afterClassToken
980
-            . (null !== $node->extends ? ' extends ' . $this->p($node->extends) : '')
981
-            . (!empty($node->implements) ? ' implements ' . $this->pCommaSeparated($node->implements) : '')
982
-            . $this->nl . '{' . $this->pStmts($node->stmts) . $this->nl . '}';
979
+            . 'class'.$afterClassToken
980
+            . (null !== $node->extends ? ' extends '.$this->p($node->extends) : '')
981
+            . ( ! empty($node->implements) ? ' implements '.$this->pCommaSeparated($node->implements) : '')
982
+            . $this->nl.'{'.$this->pStmts($node->stmts).$this->nl.'}';
983 983
     }
984 984
 
985 985
     protected function pObjectProperty($node) {
986 986
         if ($node instanceof Expr) {
987
-            return '{' . $this->p($node) . '}';
987
+            return '{'.$this->p($node).'}';
988 988
         } else {
989 989
             return $node;
990 990
         }
@@ -996,7 +996,7 @@  discard block
 block discarded – undo
996 996
             if ($element instanceof Scalar\EncapsedStringPart) {
997 997
                 $return .= $this->escapeString($element->value, $quote);
998 998
             } else {
999
-                $return .= '{' . $this->p($element) . '}';
999
+                $return .= '{'.$this->p($element).'}';
1000 1000
             }
1001 1001
         }
1002 1002
 
@@ -1004,7 +1004,7 @@  discard block
 block discarded – undo
1004 1004
     }
1005 1005
 
1006 1006
     protected function pSingleQuotedString(string $string) {
1007
-        return '\'' . addcslashes($string, '\'\\') . '\'';
1007
+        return '\''.addcslashes($string, '\'\\').'\'';
1008 1008
     }
1009 1009
 
1010 1010
     protected function escapeString($string, $quote) {
@@ -1012,7 +1012,7 @@  discard block
 block discarded – undo
1012 1012
             // For doc strings, don't escape newlines
1013 1013
             $escaped = addcslashes($string, "\t\f\v$\\");
1014 1014
         } else {
1015
-            $escaped = addcslashes($string, "\n\r\t\f\v$" . $quote . "\\");
1015
+            $escaped = addcslashes($string, "\n\r\t\f\v$".$quote."\\");
1016 1016
         }
1017 1017
 
1018 1018
         // Escape control characters and non-UTF-8 characters.
@@ -1032,10 +1032,10 @@  discard block
 block discarded – undo
1032 1032
             | (?<=[\xF0-\xF4])[\x80-\xBF](?![\x80-\xBF]{2}) # Short 4 byte sequence
1033 1033
             | (?<=[\xF0-\xF4][\x80-\xBF])[\x80-\xBF](?![\x80-\xBF]) # Short 4 byte sequence (2)
1034 1034
         )/x';
1035
-        return preg_replace_callback($regex, function ($matches) {
1035
+        return preg_replace_callback($regex, function($matches) {
1036 1036
             assert(strlen($matches[0]) === 1);
1037
-            $hex = dechex(ord($matches[0]));;
1038
-            return '\\x' . str_pad($hex, 2, '0', \STR_PAD_LEFT);
1037
+            $hex = dechex(ord($matches[0])); ;
1038
+            return '\\x'.str_pad($hex, 2, '0', \STR_PAD_LEFT);
1039 1039
         }, $escaped);
1040 1040
     }
1041 1041
 
@@ -1043,7 +1043,7 @@  discard block
 block discarded – undo
1043 1043
         $start = $atStart ? '(?:^|[\r\n])' : '[\r\n]';
1044 1044
         $end = $atEnd ? '(?:$|[;\r\n])' : '[;\r\n]';
1045 1045
         return false !== strpos($string, $label)
1046
-            && preg_match('/' . $start . $label . $end . '/', $string);
1046
+            && preg_match('/'.$start.$label.$end.'/', $string);
1047 1047
     }
1048 1048
 
1049 1049
     protected function encapsedContainsEndLabel(array $parts, $label) {
@@ -1060,18 +1060,18 @@  discard block
 block discarded – undo
1060 1060
     }
1061 1061
 
1062 1062
     protected function pDereferenceLhs(Node $node) {
1063
-        if (!$this->dereferenceLhsRequiresParens($node)) {
1063
+        if ( ! $this->dereferenceLhsRequiresParens($node)) {
1064 1064
             return $this->p($node);
1065
-        } else  {
1066
-            return '(' . $this->p($node) . ')';
1065
+        } else {
1066
+            return '('.$this->p($node).')';
1067 1067
         }
1068 1068
     }
1069 1069
 
1070 1070
     protected function pCallLhs(Node $node) {
1071
-        if (!$this->callLhsRequiresParens($node)) {
1071
+        if ( ! $this->callLhsRequiresParens($node)) {
1072 1072
             return $this->p($node);
1073
-        } else  {
1074
-            return '(' . $this->p($node) . ')';
1073
+        } else {
1074
+            return '('.$this->p($node).')';
1075 1075
         }
1076 1076
     }
1077 1077
 
@@ -1094,10 +1094,10 @@  discard block
 block discarded – undo
1094 1094
     }
1095 1095
 
1096 1096
     protected function pMaybeMultiline(array $nodes, bool $trailingComma = false) {
1097
-        if (!$this->hasNodeWithComments($nodes)) {
1097
+        if ( ! $this->hasNodeWithComments($nodes)) {
1098 1098
             return $this->pCommaSeparated($nodes);
1099 1099
         } else {
1100
-            return $this->pCommaSeparatedMultiline($nodes, $trailingComma) . $this->nl;
1100
+            return $this->pCommaSeparatedMultiline($nodes, $trailingComma).$this->nl;
1101 1101
         }
1102 1102
     }
1103 1103
 
@@ -1105,7 +1105,7 @@  discard block
 block discarded – undo
1105 1105
         $result = '';
1106 1106
         $sep = $inline ? ' ' : $this->nl;
1107 1107
         foreach ($nodes as $node) {
1108
-            $result .= $this->p($node) . $sep;
1108
+            $result .= $this->p($node).$sep;
1109 1109
         }
1110 1110
 
1111 1111
         return $result;
Please login to merge, or discard this patch.
php-parser/lib/PhpParser/Lexer/TokenEmulator/ReadonlyTokenEmulator.php 2 patches
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -6,31 +6,31 @@
 block discarded – undo
6 6
 
7 7
 final class ReadonlyTokenEmulator extends KeywordEmulator
8 8
 {
9
-    public function getPhpVersion(): string
10
-    {
11
-        return Emulative::PHP_8_1;
12
-    }
9
+	public function getPhpVersion(): string
10
+	{
11
+		return Emulative::PHP_8_1;
12
+	}
13 13
 
14
-    public function getKeywordString(): string
15
-    {
16
-        return 'readonly';
17
-    }
14
+	public function getKeywordString(): string
15
+	{
16
+		return 'readonly';
17
+	}
18 18
 
19
-    public function getKeywordToken(): int
20
-    {
21
-        return \T_READONLY;
22
-    }
19
+	public function getKeywordToken(): int
20
+	{
21
+		return \T_READONLY;
22
+	}
23 23
 
24
-    protected function isKeywordContext(array $tokens, int $pos): bool
25
-    {
26
-        if (!parent::isKeywordContext($tokens, $pos)) {
27
-            return false;
28
-        }
29
-        // Support "function readonly("
30
-        return !(isset($tokens[$pos + 1]) &&
31
-                 ($tokens[$pos + 1][0] === '(' ||
32
-                  ($tokens[$pos + 1][0] === \T_WHITESPACE &&
33
-                   isset($tokens[$pos + 2]) &&
34
-                   $tokens[$pos + 2][0] === '(')));
35
-    }
24
+	protected function isKeywordContext(array $tokens, int $pos): bool
25
+	{
26
+		if (!parent::isKeywordContext($tokens, $pos)) {
27
+			return false;
28
+		}
29
+		// Support "function readonly("
30
+		return !(isset($tokens[$pos + 1]) &&
31
+				 ($tokens[$pos + 1][0] === '(' ||
32
+				  ($tokens[$pos + 1][0] === \T_WHITESPACE &&
33
+				   isset($tokens[$pos + 2]) &&
34
+				   $tokens[$pos + 2][0] === '(')));
35
+	}
36 36
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,11 +23,11 @@
 block discarded – undo
23 23
 
24 24
     protected function isKeywordContext(array $tokens, int $pos): bool
25 25
     {
26
-        if (!parent::isKeywordContext($tokens, $pos)) {
26
+        if ( ! parent::isKeywordContext($tokens, $pos)) {
27 27
             return false;
28 28
         }
29 29
         // Support "function readonly("
30
-        return !(isset($tokens[$pos + 1]) &&
30
+        return ! (isset($tokens[$pos + 1]) &&
31 31
                  ($tokens[$pos + 1][0] === '(' ||
32 32
                   ($tokens[$pos + 1][0] === \T_WHITESPACE &&
33 33
                    isset($tokens[$pos + 2]) &&
Please login to merge, or discard this patch.
nikic/php-parser/lib/PhpParser/Lexer/TokenEmulator/KeywordEmulator.php 1 patch
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -4,59 +4,59 @@
 block discarded – undo
4 4
 
5 5
 abstract class KeywordEmulator extends TokenEmulator
6 6
 {
7
-    abstract function getKeywordString(): string;
8
-    abstract function getKeywordToken(): int;
9
-
10
-    public function isEmulationNeeded(string $code): bool
11
-    {
12
-        return strpos(strtolower($code), $this->getKeywordString()) !== false;
13
-    }
14
-
15
-    protected function isKeywordContext(array $tokens, int $pos): bool
16
-    {
17
-        $previousNonSpaceToken = $this->getPreviousNonSpaceToken($tokens, $pos);
18
-        return $previousNonSpaceToken === null || $previousNonSpaceToken[0] !== \T_OBJECT_OPERATOR;
19
-    }
20
-
21
-    public function emulate(string $code, array $tokens): array
22
-    {
23
-        $keywordString = $this->getKeywordString();
24
-        foreach ($tokens as $i => $token) {
25
-            if ($token[0] === T_STRING && strtolower($token[1]) === $keywordString
26
-                    && $this->isKeywordContext($tokens, $i)) {
27
-                $tokens[$i][0] = $this->getKeywordToken();
28
-            }
29
-        }
30
-
31
-        return $tokens;
32
-    }
33
-
34
-    /**
35
-     * @param mixed[] $tokens
36
-     * @return array|string|null
37
-     */
38
-    private function getPreviousNonSpaceToken(array $tokens, int $start)
39
-    {
40
-        for ($i = $start - 1; $i >= 0; --$i) {
41
-            if ($tokens[$i][0] === T_WHITESPACE) {
42
-                continue;
43
-            }
44
-
45
-            return $tokens[$i];
46
-        }
47
-
48
-        return null;
49
-    }
50
-
51
-    public function reverseEmulate(string $code, array $tokens): array
52
-    {
53
-        $keywordToken = $this->getKeywordToken();
54
-        foreach ($tokens as $i => $token) {
55
-            if ($token[0] === $keywordToken) {
56
-                $tokens[$i][0] = \T_STRING;
57
-            }
58
-        }
59
-
60
-        return $tokens;
61
-    }
7
+	abstract function getKeywordString(): string;
8
+	abstract function getKeywordToken(): int;
9
+
10
+	public function isEmulationNeeded(string $code): bool
11
+	{
12
+		return strpos(strtolower($code), $this->getKeywordString()) !== false;
13
+	}
14
+
15
+	protected function isKeywordContext(array $tokens, int $pos): bool
16
+	{
17
+		$previousNonSpaceToken = $this->getPreviousNonSpaceToken($tokens, $pos);
18
+		return $previousNonSpaceToken === null || $previousNonSpaceToken[0] !== \T_OBJECT_OPERATOR;
19
+	}
20
+
21
+	public function emulate(string $code, array $tokens): array
22
+	{
23
+		$keywordString = $this->getKeywordString();
24
+		foreach ($tokens as $i => $token) {
25
+			if ($token[0] === T_STRING && strtolower($token[1]) === $keywordString
26
+					&& $this->isKeywordContext($tokens, $i)) {
27
+				$tokens[$i][0] = $this->getKeywordToken();
28
+			}
29
+		}
30
+
31
+		return $tokens;
32
+	}
33
+
34
+	/**
35
+	 * @param mixed[] $tokens
36
+	 * @return array|string|null
37
+	 */
38
+	private function getPreviousNonSpaceToken(array $tokens, int $start)
39
+	{
40
+		for ($i = $start - 1; $i >= 0; --$i) {
41
+			if ($tokens[$i][0] === T_WHITESPACE) {
42
+				continue;
43
+			}
44
+
45
+			return $tokens[$i];
46
+		}
47
+
48
+		return null;
49
+	}
50
+
51
+	public function reverseEmulate(string $code, array $tokens): array
52
+	{
53
+		$keywordToken = $this->getKeywordToken();
54
+		foreach ($tokens as $i => $token) {
55
+			if ($token[0] === $keywordToken) {
56
+				$tokens[$i][0] = \T_STRING;
57
+			}
58
+		}
59
+
60
+		return $tokens;
61
+	}
62 62
 }
Please login to merge, or discard this patch.
vendor/symfony/css-selector/CssSelectorConverter.php 1 patch
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -26,42 +26,42 @@
 block discarded – undo
26 26
  */
27 27
 class CssSelectorConverter
28 28
 {
29
-    private $translator;
30
-    private array $cache;
29
+	private $translator;
30
+	private array $cache;
31 31
 
32
-    private static array $xmlCache = [];
33
-    private static array $htmlCache = [];
32
+	private static array $xmlCache = [];
33
+	private static array $htmlCache = [];
34 34
 
35
-    /**
36
-     * @param bool $html Whether HTML support should be enabled. Disable it for XML documents
37
-     */
38
-    public function __construct(bool $html = true)
39
-    {
40
-        $this->translator = new Translator();
35
+	/**
36
+	 * @param bool $html Whether HTML support should be enabled. Disable it for XML documents
37
+	 */
38
+	public function __construct(bool $html = true)
39
+	{
40
+		$this->translator = new Translator();
41 41
 
42
-        if ($html) {
43
-            $this->translator->registerExtension(new HtmlExtension($this->translator));
44
-            $this->cache = &self::$htmlCache;
45
-        } else {
46
-            $this->cache = &self::$xmlCache;
47
-        }
42
+		if ($html) {
43
+			$this->translator->registerExtension(new HtmlExtension($this->translator));
44
+			$this->cache = &self::$htmlCache;
45
+		} else {
46
+			$this->cache = &self::$xmlCache;
47
+		}
48 48
 
49
-        $this->translator
50
-            ->registerParserShortcut(new EmptyStringParser())
51
-            ->registerParserShortcut(new ElementParser())
52
-            ->registerParserShortcut(new ClassParser())
53
-            ->registerParserShortcut(new HashParser())
54
-        ;
55
-    }
49
+		$this->translator
50
+			->registerParserShortcut(new EmptyStringParser())
51
+			->registerParserShortcut(new ElementParser())
52
+			->registerParserShortcut(new ClassParser())
53
+			->registerParserShortcut(new HashParser())
54
+		;
55
+	}
56 56
 
57
-    /**
58
-     * Translates a CSS expression to its XPath equivalent.
59
-     *
60
-     * Optionally, a prefix can be added to the resulting XPath
61
-     * expression with the $prefix parameter.
62
-     */
63
-    public function toXPath(string $cssExpr, string $prefix = 'descendant-or-self::'): string
64
-    {
65
-        return $this->cache[$prefix][$cssExpr] ?? $this->cache[$prefix][$cssExpr] = $this->translator->cssToXPath($cssExpr, $prefix);
66
-    }
57
+	/**
58
+	 * Translates a CSS expression to its XPath equivalent.
59
+	 *
60
+	 * Optionally, a prefix can be added to the resulting XPath
61
+	 * expression with the $prefix parameter.
62
+	 */
63
+	public function toXPath(string $cssExpr, string $prefix = 'descendant-or-self::'): string
64
+	{
65
+		return $this->cache[$prefix][$cssExpr] ?? $this->cache[$prefix][$cssExpr] = $this->translator->cssToXPath($cssExpr, $prefix);
66
+	}
67 67
 }
Please login to merge, or discard this patch.
vendor/symfony/css-selector/Node/Specificity.php 1 patch
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -25,49 +25,49 @@
 block discarded – undo
25 25
  */
26 26
 class Specificity
27 27
 {
28
-    public const A_FACTOR = 100;
29
-    public const B_FACTOR = 10;
30
-    public const C_FACTOR = 1;
28
+	public const A_FACTOR = 100;
29
+	public const B_FACTOR = 10;
30
+	public const C_FACTOR = 1;
31 31
 
32
-    private int $a;
33
-    private int $b;
34
-    private int $c;
32
+	private int $a;
33
+	private int $b;
34
+	private int $c;
35 35
 
36
-    public function __construct(int $a, int $b, int $c)
37
-    {
38
-        $this->a = $a;
39
-        $this->b = $b;
40
-        $this->c = $c;
41
-    }
36
+	public function __construct(int $a, int $b, int $c)
37
+	{
38
+		$this->a = $a;
39
+		$this->b = $b;
40
+		$this->c = $c;
41
+	}
42 42
 
43
-    public function plus(self $specificity): self
44
-    {
45
-        return new self($this->a + $specificity->a, $this->b + $specificity->b, $this->c + $specificity->c);
46
-    }
43
+	public function plus(self $specificity): self
44
+	{
45
+		return new self($this->a + $specificity->a, $this->b + $specificity->b, $this->c + $specificity->c);
46
+	}
47 47
 
48
-    public function getValue(): int
49
-    {
50
-        return $this->a * self::A_FACTOR + $this->b * self::B_FACTOR + $this->c * self::C_FACTOR;
51
-    }
48
+	public function getValue(): int
49
+	{
50
+		return $this->a * self::A_FACTOR + $this->b * self::B_FACTOR + $this->c * self::C_FACTOR;
51
+	}
52 52
 
53
-    /**
54
-     * Returns -1 if the object specificity is lower than the argument,
55
-     * 0 if they are equal, and 1 if the argument is lower.
56
-     */
57
-    public function compareTo(self $specificity): int
58
-    {
59
-        if ($this->a !== $specificity->a) {
60
-            return $this->a > $specificity->a ? 1 : -1;
61
-        }
53
+	/**
54
+	 * Returns -1 if the object specificity is lower than the argument,
55
+	 * 0 if they are equal, and 1 if the argument is lower.
56
+	 */
57
+	public function compareTo(self $specificity): int
58
+	{
59
+		if ($this->a !== $specificity->a) {
60
+			return $this->a > $specificity->a ? 1 : -1;
61
+		}
62 62
 
63
-        if ($this->b !== $specificity->b) {
64
-            return $this->b > $specificity->b ? 1 : -1;
65
-        }
63
+		if ($this->b !== $specificity->b) {
64
+			return $this->b > $specificity->b ? 1 : -1;
65
+		}
66 66
 
67
-        if ($this->c !== $specificity->c) {
68
-            return $this->c > $specificity->c ? 1 : -1;
69
-        }
67
+		if ($this->c !== $specificity->c) {
68
+			return $this->c > $specificity->c ? 1 : -1;
69
+		}
70 70
 
71
-        return 0;
72
-    }
71
+		return 0;
72
+	}
73 73
 }
Please login to merge, or discard this patch.
vendor/symfony/css-selector/Node/AbstractNode.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -23,10 +23,10 @@
 block discarded – undo
23 23
  */
24 24
 abstract class AbstractNode implements NodeInterface
25 25
 {
26
-    private string $nodeName;
26
+	private string $nodeName;
27 27
 
28
-    public function getNodeName(): string
29
-    {
30
-        return $this->nodeName ??= preg_replace('~.*\\\\([^\\\\]+)Node$~', '$1', static::class);
31
-    }
28
+	public function getNodeName(): string
29
+	{
30
+		return $this->nodeName ??= preg_replace('~.*\\\\([^\\\\]+)Node$~', '$1', static::class);
31
+	}
32 32
 }
Please login to merge, or discard this patch.
vendor/symfony/css-selector/Node/ElementNode.php 1 patch
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -23,37 +23,37 @@
 block discarded – undo
23 23
  */
24 24
 class ElementNode extends AbstractNode
25 25
 {
26
-    private ?string $namespace;
27
-    private ?string $element;
28
-
29
-    public function __construct(string $namespace = null, string $element = null)
30
-    {
31
-        $this->namespace = $namespace;
32
-        $this->element = $element;
33
-    }
34
-
35
-    public function getNamespace(): ?string
36
-    {
37
-        return $this->namespace;
38
-    }
39
-
40
-    public function getElement(): ?string
41
-    {
42
-        return $this->element;
43
-    }
44
-
45
-    /**
46
-     * {@inheritdoc}
47
-     */
48
-    public function getSpecificity(): Specificity
49
-    {
50
-        return new Specificity(0, 0, $this->element ? 1 : 0);
51
-    }
52
-
53
-    public function __toString(): string
54
-    {
55
-        $element = $this->element ?: '*';
56
-
57
-        return sprintf('%s[%s]', $this->getNodeName(), $this->namespace ? $this->namespace.'|'.$element : $element);
58
-    }
26
+	private ?string $namespace;
27
+	private ?string $element;
28
+
29
+	public function __construct(string $namespace = null, string $element = null)
30
+	{
31
+		$this->namespace = $namespace;
32
+		$this->element = $element;
33
+	}
34
+
35
+	public function getNamespace(): ?string
36
+	{
37
+		return $this->namespace;
38
+	}
39
+
40
+	public function getElement(): ?string
41
+	{
42
+		return $this->element;
43
+	}
44
+
45
+	/**
46
+	 * {@inheritdoc}
47
+	 */
48
+	public function getSpecificity(): Specificity
49
+	{
50
+		return new Specificity(0, 0, $this->element ? 1 : 0);
51
+	}
52
+
53
+	public function __toString(): string
54
+	{
55
+		$element = $this->element ?: '*';
56
+
57
+		return sprintf('%s[%s]', $this->getNodeName(), $this->namespace ? $this->namespace.'|'.$element : $element);
58
+	}
59 59
 }
Please login to merge, or discard this patch.
vendor/symfony/css-selector/Node/PseudoNode.php 1 patch
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -23,35 +23,35 @@
 block discarded – undo
23 23
  */
24 24
 class PseudoNode extends AbstractNode
25 25
 {
26
-    private $selector;
27
-    private string $identifier;
28
-
29
-    public function __construct(NodeInterface $selector, string $identifier)
30
-    {
31
-        $this->selector = $selector;
32
-        $this->identifier = strtolower($identifier);
33
-    }
34
-
35
-    public function getSelector(): NodeInterface
36
-    {
37
-        return $this->selector;
38
-    }
39
-
40
-    public function getIdentifier(): string
41
-    {
42
-        return $this->identifier;
43
-    }
44
-
45
-    /**
46
-     * {@inheritdoc}
47
-     */
48
-    public function getSpecificity(): Specificity
49
-    {
50
-        return $this->selector->getSpecificity()->plus(new Specificity(0, 1, 0));
51
-    }
52
-
53
-    public function __toString(): string
54
-    {
55
-        return sprintf('%s[%s:%s]', $this->getNodeName(), $this->selector, $this->identifier);
56
-    }
26
+	private $selector;
27
+	private string $identifier;
28
+
29
+	public function __construct(NodeInterface $selector, string $identifier)
30
+	{
31
+		$this->selector = $selector;
32
+		$this->identifier = strtolower($identifier);
33
+	}
34
+
35
+	public function getSelector(): NodeInterface
36
+	{
37
+		return $this->selector;
38
+	}
39
+
40
+	public function getIdentifier(): string
41
+	{
42
+		return $this->identifier;
43
+	}
44
+
45
+	/**
46
+	 * {@inheritdoc}
47
+	 */
48
+	public function getSpecificity(): Specificity
49
+	{
50
+		return $this->selector->getSpecificity()->plus(new Specificity(0, 1, 0));
51
+	}
52
+
53
+	public function __toString(): string
54
+	{
55
+		return sprintf('%s[%s:%s]', $this->getNodeName(), $this->selector, $this->identifier);
56
+	}
57 57
 }
Please login to merge, or discard this patch.
vendor/symfony/css-selector/Node/CombinedSelectorNode.php 1 patch
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -23,44 +23,44 @@
 block discarded – undo
23 23
  */
24 24
 class CombinedSelectorNode extends AbstractNode
25 25
 {
26
-    private $selector;
27
-    private string $combinator;
28
-    private $subSelector;
26
+	private $selector;
27
+	private string $combinator;
28
+	private $subSelector;
29 29
 
30
-    public function __construct(NodeInterface $selector, string $combinator, NodeInterface $subSelector)
31
-    {
32
-        $this->selector = $selector;
33
-        $this->combinator = $combinator;
34
-        $this->subSelector = $subSelector;
35
-    }
30
+	public function __construct(NodeInterface $selector, string $combinator, NodeInterface $subSelector)
31
+	{
32
+		$this->selector = $selector;
33
+		$this->combinator = $combinator;
34
+		$this->subSelector = $subSelector;
35
+	}
36 36
 
37
-    public function getSelector(): NodeInterface
38
-    {
39
-        return $this->selector;
40
-    }
37
+	public function getSelector(): NodeInterface
38
+	{
39
+		return $this->selector;
40
+	}
41 41
 
42
-    public function getCombinator(): string
43
-    {
44
-        return $this->combinator;
45
-    }
42
+	public function getCombinator(): string
43
+	{
44
+		return $this->combinator;
45
+	}
46 46
 
47
-    public function getSubSelector(): NodeInterface
48
-    {
49
-        return $this->subSelector;
50
-    }
47
+	public function getSubSelector(): NodeInterface
48
+	{
49
+		return $this->subSelector;
50
+	}
51 51
 
52
-    /**
53
-     * {@inheritdoc}
54
-     */
55
-    public function getSpecificity(): Specificity
56
-    {
57
-        return $this->selector->getSpecificity()->plus($this->subSelector->getSpecificity());
58
-    }
52
+	/**
53
+	 * {@inheritdoc}
54
+	 */
55
+	public function getSpecificity(): Specificity
56
+	{
57
+		return $this->selector->getSpecificity()->plus($this->subSelector->getSpecificity());
58
+	}
59 59
 
60
-    public function __toString(): string
61
-    {
62
-        $combinator = ' ' === $this->combinator ? '<followed>' : $this->combinator;
60
+	public function __toString(): string
61
+	{
62
+		$combinator = ' ' === $this->combinator ? '<followed>' : $this->combinator;
63 63
 
64
-        return sprintf('%s[%s %s %s]', $this->getNodeName(), $this->selector, $combinator, $this->subSelector);
65
-    }
64
+		return sprintf('%s[%s %s %s]', $this->getNodeName(), $this->selector, $combinator, $this->subSelector);
65
+	}
66 66
 }
Please login to merge, or discard this patch.