- Output for 8.1.0 - 8.1.30, 8.2.0 - 8.2.25, 8.3.0 - 8.3.14
- array(1) { [0]=> object(ReflectionAttribute)#2 (0) { } } string(3) "Foo" int(1)
<?php
class Foo {}
#[Foo]
class Bar {}
$reflection = new ReflectionClass(Bar::class);
var_dump(
$attr = $reflection->getAttributes(),
$attr[0]->getName(),
$attr[0]->getTarget(),
);