1--TEST--
2Attributes: Example from Attributes RFC
3--FILE--
4<?php
5// https://wiki.php.net/rfc/attributes_v2#attribute_syntax
6namespace My\Attributes {
7    use Attribute;
8
9    #[Attribute]
10    class SingleArgument {
11        public $argumentValue;
12
13        public function __construct($argumentValue) {
14             $this->argumentValue = $argumentValue;
15        }
16    }
17}
18
19namespace {
20    use My\Attributes\SingleArgument;
21
22    #[SingleArgument("Hello World")]
23    class Foo {
24    }
25
26    $reflectionClass = new \ReflectionClass(Foo::class);
27    $attributes = $reflectionClass->getAttributes();
28
29    var_dump($attributes[0]->getName());
30    var_dump($attributes[0]->getArguments());
31    var_dump($attributes[0]->newInstance());
32}
33?>
34--EXPECTF--
35string(28) "My\Attributes\SingleArgument"
36array(1) {
37  [0]=>
38  string(11) "Hello World"
39}
40object(My\Attributes\SingleArgument)#%d (1) {
41  ["argumentValue"]=>
42  string(11) "Hello World"
43}
44