File tree Expand file tree Collapse file tree 1 file changed +46
-8
lines changed Expand file tree Collapse file tree 1 file changed +46
-8
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ Resolve attribute names
5
5
function dump_attributes ($ attributes ) {
6
6
$ arr = [];
7
7
foreach ($ attributes as $ attribute ) {
8
- $ arr [$ attribute ->getName ()] = $ attribute ->getArguments ();
8
+ $ arr [] = [ ' name ' => $ attribute ->getName (), ' args ' => $ attribute ->getArguments ()] ;
9
9
}
10
10
var_dump ($ arr );
11
11
}
@@ -17,24 +17,62 @@ namespace Doctrine\ORM\Mapping {
17
17
18
18
namespace Foo {
19
19
use Doctrine \ORM \Mapping \Entity ;
20
+ use Doctrine \ORM \Mapping as ORM ;
20
21
21
- <<Entity (["foo " => "bar " ])>>
22
+ <<Entity ("imported class " )>>
23
+ <<ORM \Entity ("imported namespace " )>>
24
+ <<\Doctrine \ORM \Mapping \Entity ("absolute from namespace " )>>
25
+ <<\Entity ("import absolute from global " )>>
22
26
function foo () {
23
27
}
24
28
}
25
29
26
30
namespace {
31
+ class Entity {}
32
+
27
33
dump_attributes ((new ReflectionFunction ('Foo\foo ' ))->getAttributes ());
28
34
}
29
35
?>
30
36
--EXPECTF--
31
- array(1) {
32
- ["Doctrine\ORM\Mapping\Entity"]=>
33
- array(1) {
34
- [0]=>
37
+ array(4) {
38
+ [0]=>
39
+ array(2) {
40
+ ["name"]=>
41
+ string(27) "Doctrine\ORM\Mapping\Entity"
42
+ ["args"]=>
43
+ array(1) {
44
+ [0]=>
45
+ string(14) "imported class"
46
+ }
47
+ }
48
+ [1]=>
49
+ array(2) {
50
+ ["name"]=>
51
+ string(27) "Doctrine\ORM\Mapping\Entity"
52
+ ["args"]=>
53
+ array(1) {
54
+ [0]=>
55
+ string(18) "imported namespace"
56
+ }
57
+ }
58
+ [2]=>
59
+ array(2) {
60
+ ["name"]=>
61
+ string(27) "Doctrine\ORM\Mapping\Entity"
62
+ ["args"]=>
63
+ array(1) {
64
+ [0]=>
65
+ string(23) "absolute from namespace"
66
+ }
67
+ }
68
+ [3]=>
69
+ array(2) {
70
+ ["name"]=>
71
+ string(6) "Entity"
72
+ ["args"]=>
35
73
array(1) {
36
- ["foo" ]=>
37
- string(3 ) "bar "
74
+ [0 ]=>
75
+ string(27 ) "import absolute from global "
38
76
}
39
77
}
40
78
}
You can’t perform that action at this time.
0 commit comments