1Inserting array item with comment
2-----
3<?php
4
5$items = [
6    'a' => 'foo',
7    'b' => 'bar',
8];
9-----
10$node = new Expr\ArrayItem(new Scalar\String_('baz'), new Scalar\String_('c'));
11$node->setAttribute('comments', [new Comment\Doc(<<<COMMENT
12/**
13 * A doc comment
14 */
15COMMENT
16)]);
17$array = $stmts[0]->expr->expr;
18$array->items[] = $node;
19-----
20<?php
21
22$items = [
23    'a' => 'foo',
24    'b' => 'bar',
25    /**
26     * A doc comment
27     */
28    'c' => 'baz',
29];
30-----
31<?php
32
33$items = [
34    'a' => 'foo',
35    'b' => 'bar',
36];
37-----
38$node = new Expr\ArrayItem(new Scalar\String_('baz'), new Scalar\String_('c'));
39$node->setAttribute('comments', [new Comment("/* Block comment */")]);
40$array = $stmts[0]->expr->expr;
41$array->items[] = $node;
42-----
43<?php
44
45$items = [
46    'a' => 'foo',
47    'b' => 'bar',
48    /* Block comment */
49    'c' => 'baz',
50];
51-----
52<?php
53
54$items = [
55    'a' => 'foo',
56    'b' => 'bar',
57];
58-----
59$node = new Expr\ArrayItem(new Scalar\String_('baz'), new Scalar\String_('c'));
60$node->setAttribute('comments', [new Comment("// Line comment")]);
61$array = $stmts[0]->expr->expr;
62$array->items[] = $node;
63-----
64<?php
65
66$items = [
67    'a' => 'foo',
68    'b' => 'bar',
69    // Line comment
70    'c' => 'baz',
71];
72-----
73<?php
74
75$items = [
76    'a' => 'foo',
77];
78-----
79$node = new Expr\ArrayItem(new Scalar\String_('bar'), new Scalar\String_('b'));
80$node->setAttribute('comments', [new Comment("// Line comment")]);
81$array = $stmts[0]->expr->expr;
82$array->items[] = $node;
83-----
84<?php
85
86$items = [
87    'a' => 'foo',
88    // Line comment
89    'b' => 'bar',
90];
91-----
92<?php
93
94$items = [];
95-----
96$node = new Expr\ArrayItem(new Scalar\String_('foo'), new Scalar\String_('a'));
97$node->setAttribute('comments', [new Comment("// Line comment")]);
98$array = $stmts[0]->expr->expr;
99$array->items[] = $node;
100-----
101<?php
102
103$items = [
104    // Line comment
105    'a' => 'foo',
106];