summaryrefslogtreecommitdiff
path: root/Zend/tests/enum/name-property.phpt
blob: 2197f235bbb2d8ecab3eb279a07a3f91309b078b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
--TEST--
Enum name property
--FILE--
<?php

enum Foo {
    case Bar;
    case Baz;
}

enum IntFoo: int {
    case Bar = 0;
    case Baz = 1;
}

var_dump((new ReflectionClass(Foo::class))->getProperties());
var_dump(Foo::Bar->name);

var_dump((new ReflectionClass(IntFoo::class))->getProperties());
var_dump(IntFoo::Bar->name);

?>
--EXPECT--
array(1) {
  [0]=>
  object(ReflectionProperty)#2 (2) {
    ["name"]=>
    string(4) "name"
    ["class"]=>
    string(3) "Foo"
  }
}
string(3) "Bar"
array(2) {
  [0]=>
  object(ReflectionProperty)#3 (2) {
    ["name"]=>
    string(4) "name"
    ["class"]=>
    string(6) "IntFoo"
  }
  [1]=>
  object(ReflectionProperty)#4 (2) {
    ["name"]=>
    string(5) "value"
    ["class"]=>
    string(6) "IntFoo"
  }
}
string(3) "Bar"