1Property hooks 2----- 3<?php 4class Test { 5 public $prop 6 { 7 get => 42; 8 } 9} 10----- 11$stmts[0]->stmts[0]->hooks[] = new Node\PropertyHook('set', new Scalar\Int_(123)); 12----- 13<?php 14class Test { 15 public $prop 16 { 17 get => 42; 18 set => 123; 19 } 20} 21----- 22<?php 23class Test { 24 public function __construct( 25 public $prop 26 { get => 42; } 27 ) {} 28} 29----- 30$stmts[0]->stmts[0]->params[0]->hooks[] = new Node\PropertyHook('set', new Scalar\Int_(123)); 31----- 32<?php 33class Test { 34 public function __construct( 35 public $prop 36 { get => 42; 37 set => 123; } 38 ) {} 39} 40----- 41<?php 42class Test { 43 public $prop { 44 set 45 { 46 $a; 47 } 48 } 49} 50----- 51$stmts[0]->stmts[0]->hooks[0]->body[] = new Stmt\Expression(new Expr\Variable('b')); 52----- 53<?php 54class Test { 55 public $prop { 56 set 57 { 58 $a; 59 $b; 60 } 61 } 62} 63----- 64<?php 65class Test { 66 public $prop { 67 get 68 => 42; 69 } 70} 71----- 72$stmts[0]->stmts[0]->hooks[0]->flags = Modifiers::FINAL; 73----- 74<?php 75class Test { 76 public $prop { 77 final get 78 => 42; 79 } 80} 81----- 82<?php 83// For now, just make sure this works. 84class Test { 85 public $prop { 86 get 87 => 42; 88 } 89} 90----- 91$stmts[0]->stmts[0]->hooks[0]->body = [new Stmt\Return_(new Scalar\Int_(24))]; 92----- 93<?php 94// For now, just make sure this works. 95class Test { 96 public $prop { 97 get { 98 return 24; 99 } 100 } 101} 102----- 103<?php 104// For now, just make sure this works. 105class Test { 106 public $prop1 { 107 & get; 108 } 109 public $prop2 { 110 & get; 111 } 112} 113----- 114$stmts[0]->stmts[0]->hooks[0]->body = new Scalar\Int_(24); 115$stmts[0]->stmts[1]->hooks[0]->body = [new Stmt\Return_(new Scalar\Int_(24))]; 116----- 117<?php 118// For now, just make sure this works. 119class Test { 120 public $prop1 { 121 &get => 24; 122 } 123 public $prop2 { 124 &get { 125 return 24; 126 } 127 } 128} 129