return $this->pImplode($nodes, ', ');
}
+ /**
+ * 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).
+ *
+ * @param Node[] $nodes Array of Nodes to be printed
+ * @param bool $trailingComma Whether to use a trailing comma
+ *
+ * @return string Comma separated pretty printed nodes in multiline style
+ */
+ protected function pCommaSeparatedMultiline(array $nodes, $trailingComma) {
+ $result = '';
+ $lastIdx = count($nodes) - 1;
+ foreach ($nodes as $idx => $node) {
+ if ($node !== null) {
+ $comments = $node->getAttribute('comments', array());
+ if ($comments) {
+ $result .= "\n" . $this->pComments($comments);
+ }
+
+ $result .= "\n" . $this->p($node);
+ } else {
+ $result .= "\n";
+ }
+ if ($trailingComma || $idx !== $lastIdx) {
+ $result .= ',';
+ }
+ }
+
+ return preg_replace('~\n(?!$|' . $this->noIndentToken . ')~', "\n ", $result);
+ }
+
/**
* Signals the pretty printer that a string shall not be indented.
*