function PrettyPrinterAbstract::pCommaSeparatedMultiline
Pretty prints a comma-separated list of nodes in multiline style, including comments.
The result includes a leading newline and one level of indentation (same as pStmts).
Parameters
Node[] $nodes Array of Nodes to be printed:
bool $trailingComma Whether to use a trailing comma:
Return value
string Comma separated pretty printed nodes in multiline style
2 calls to PrettyPrinterAbstract::pCommaSeparatedMultiline()
- Standard::pExpr_Match in vendor/
nikic/ php-parser/ lib/ PhpParser/ PrettyPrinter/ Standard.php - Standard::pMaybeMultiline in vendor/
nikic/ php-parser/ lib/ PhpParser/ PrettyPrinter/ Standard.php
File
-
vendor/
nikic/ php-parser/ lib/ PhpParser/ PrettyPrinterAbstract.php, line 499
Class
Namespace
PhpParserCode
protected function pCommaSeparatedMultiline(array $nodes, bool $trailingComma) : string {
$this->indent();
$result = '';
$lastIdx = count($nodes) - 1;
foreach ($nodes as $idx => $node) {
if ($node !== null) {
$comments = $node->getComments();
if ($comments) {
$result .= $this->nl . $this->pComments($comments);
}
$result .= $this->nl . $this->p($node);
}
else {
$result .= $this->nl;
}
if ($trailingComma || $idx !== $lastIdx) {
$result .= ',';
}
}
$this->outdent();
return $result;
}