1--TEST--
2Named flags parameter for Attribute attribute
3--FILE--
4<?php
5
6#[Attribute(flags: Attribute::TARGET_CLASS)]
7class MyAttribute {
8}
9
10#[MyAttribute]
11function test() {}
12
13(new ReflectionFunction('test'))->getAttributes()[0]->newInstance();
14
15?>
16--EXPECTF--
17Fatal error: Uncaught Error: Attribute "MyAttribute" cannot target function (allowed targets: class) in %s:%d
18Stack trace:
19#0 %s(%d): ReflectionAttribute->newInstance()
20#1 {main}
21  thrown in %s on line %d
22