### Description The following code: ```php #[Attribute(Attribute::TARGET_METHOD)] class A { } class B { #[A] public function m() { } } $a = new B(); $c = [$a, 'm']; $r = new ReflectionFunction($c(...)); var_dump($r->getAttributes()[0]->newInstance()); ``` Resulted in [this output](https://3v4l.org/fepGP): ``` Fatal error: Uncaught Error: Attribute "A" cannot target function (allowed targets: method) ``` But I expected this output instead: ``` object(A)#5 (0) { } ``` ### PHP Version PHP >= 8.1.6 ### Operating System _No response_