1Attributes 2----- 3<?php 4#[A] 5class X { 6 #[A] 7 public function m(#[A] & $p) {} 8 9 #[A] 10 public 11 $prop; 12 13 #[A] 14 const 15 X = 42; 16} 17 18#[A] 19trait X {} 20 21#[A] 22interface X {} 23 24#[A] 25function f() {} 26 27new #[A] class {}; 28#[A] function() {}; 29#[A] fn() 30 => 42; 31----- 32$attrGroup = new Node\AttributeGroup([ 33 new Node\Attribute(new Node\Name('B'), []), 34]); 35$stmts[0]->attrGroups[] = $attrGroup; 36$stmts[0]->stmts[0]->attrGroups[] = $attrGroup; 37$stmts[0]->stmts[0]->params[0]->attrGroups[] = $attrGroup; 38$stmts[0]->stmts[1]->attrGroups[] = $attrGroup; 39$stmts[0]->stmts[2]->attrGroups[] = $attrGroup; 40$stmts[1]->attrGroups[] = $attrGroup; 41$stmts[2]->attrGroups[] = $attrGroup; 42$stmts[3]->attrGroups[] = $attrGroup; 43$stmts[4]->expr->class->attrGroups[] = $attrGroup; 44$stmts[5]->expr->attrGroups[] = $attrGroup; 45$stmts[6]->expr->attrGroups[] = $attrGroup; 46----- 47<?php 48#[A] 49#[B] 50class X { 51 #[A] 52 #[B] 53 public function m(#[A] #[B] & $p) {} 54 55 #[A] 56 #[B] 57 public 58 $prop; 59 60 #[A] 61 #[B] 62 const 63 X = 42; 64} 65 66#[A] 67#[B] 68trait X {} 69 70#[A] 71#[B] 72interface X {} 73 74#[A] 75#[B] 76function f() {} 77 78new #[A] #[B] class {}; 79#[A] #[B] function() {}; 80#[A] #[B] fn() 81 => 42; 82----- 83<?php 84class X { 85 public function m() {} 86 87 public 88 $prop; 89 90 const 91 X = 42; 92} 93 94trait X {} 95 96interface X {} 97 98function f() {} 99 100new class {}; 101function() {}; 102fn() 103 => 42; 104----- 105$attrGroup = new Node\AttributeGroup([ 106 new Node\Attribute(new Node\Name('A'), []), 107]); 108$attrGroup2 = new Node\AttributeGroup([ 109 new Node\Attribute(new Node\Name('B'), []), 110]); 111$stmts[0]->attrGroups[] = $attrGroup; 112$stmts[0]->attrGroups[] = $attrGroup2; 113$stmts[0]->stmts[0]->attrGroups[] = $attrGroup; 114$stmts[0]->stmts[0]->attrGroups[] = $attrGroup2; 115$stmts[0]->stmts[1]->attrGroups[] = $attrGroup; 116$stmts[0]->stmts[2]->attrGroups[] = $attrGroup; 117$stmts[1]->attrGroups[] = $attrGroup; 118$stmts[2]->attrGroups[] = $attrGroup; 119$stmts[3]->attrGroups[] = $attrGroup; 120$stmts[4]->expr->class->attrGroups[] = $attrGroup; 121$stmts[5]->expr->attrGroups[] = $attrGroup; 122$stmts[6]->expr->attrGroups[] = $attrGroup; 123----- 124<?php 125#[A] 126#[B] 127class X { 128 #[A] 129 #[B] 130 public function m() {} 131 132 #[A] 133 public 134 $prop; 135 136 #[A] 137 const 138 X = 42; 139} 140 141#[A] 142trait X {} 143 144#[A] 145interface X {} 146 147#[A] 148function f() {} 149 150new #[A] class {}; 151#[A] function() {}; 152#[A] fn() 153 => 42; 154----- 155<?php 156 157#[ A, B] 158class X {}; 159#[ 160 A, 161 B, 162] 163class X {}; 164----- 165$attr = new Node\Attribute(new Node\Name('C'), []); 166$stmts[0]->attrGroups[0]->attrs[] = $attr; 167$stmts[1]->attrGroups[0]->attrs[] = $attr; 168----- 169<?php 170 171#[ A, B, C] 172class X {}; 173#[ 174 A, 175 B, 176 C, 177] 178class X {}; 179