1--TEST-- 2ReflectionAttribute::newInstance(): #[\Deprecated] 3--FILE-- 4<?php 5 6#[\Deprecated] 7function test1() { 8} 9 10#[\Deprecated()] 11function test2() { 12} 13 14#[\Deprecated("use test() instead")] 15function test3() { 16} 17 18#[\Deprecated(since: "2.0")] 19function test4() { 20} 21 22$reflection = new ReflectionFunction('test1'); 23var_dump($reflection->getAttributes()[0]->newInstance()); 24 25$reflection = new ReflectionFunction('test2'); 26var_dump($reflection->getAttributes()[0]->newInstance()); 27 28$reflection = new ReflectionFunction('test3'); 29var_dump($reflection->getAttributes()[0]->newInstance()); 30 31$reflection = new ReflectionFunction('test4'); 32var_dump($reflection->getAttributes()[0]->newInstance()); 33 34?> 35--EXPECTF-- 36object(Deprecated)#%d (2) { 37 ["message"]=> 38 NULL 39 ["since"]=> 40 NULL 41} 42object(Deprecated)#%d (2) { 43 ["message"]=> 44 NULL 45 ["since"]=> 46 NULL 47} 48object(Deprecated)#%d (2) { 49 ["message"]=> 50 string(18) "use test() instead" 51 ["since"]=> 52 NULL 53} 54object(Deprecated)#%d (2) { 55 ["message"]=> 56 NULL 57 ["since"]=> 58 string(3) "2.0" 59} 60