1--TEST-- 2ReflectionAttribute cannot be instantiated directly 3--FILE-- 4<?php 5#[Attribute] 6class A {} 7 8class Foo { 9 #[A] 10 public function bar() {} 11} 12 13$rm = new ReflectionMethod(Foo::class, "bar"); 14$attribute = $rm->getAttributes()[0]; 15 16$rm = new ReflectionMethod($attribute, "__construct"); 17 18try { 19 var_dump($rm->invoke($attribute, 0, 1, 2)); 20} catch (ReflectionException $exception) { 21 echo $exception->getMessage(); 22} 23?> 24--EXPECT-- 25Cannot directly instantiate ReflectionAttribute 26