1
0
mirror of https://github.com/php/php-src.git synced 2026-04-28 18:53:33 +02:00
Files
archived-php-src/Zend/tests/named_params/attributes_named_flags.phpt
T
2020-09-02 20:26:50 +02:00

22 lines
464 B
PHP

--TEST--
Named flags parameter for Attribute attribute
--FILE--
<?php
#[Attribute(flags: Attribute::TARGET_CLASS)]
class MyAttribute {
}
#[MyAttribute]
function test() {}
(new ReflectionFunction('test'))->getAttributes()[0]->newInstance();
?>
--EXPECTF--
Fatal error: Uncaught Error: Attribute "MyAttribute" cannot target function (allowed targets: class) in %s:%d
Stack trace:
#0 %s(%d): ReflectionAttribute->newInstance()
#1 {main}
thrown in %s on line %d