xref: /PHP-8.3/Zend/tests/enum/ast-dumper.phpt (revision 269c8dac)
1--TEST--
2Enum AST dumper
3--FILE--
4<?php
5
6try {
7    assert((function () {
8        enum Foo {
9            case Bar;
10        }
11
12        #[EnumAttr]
13        enum IntFoo: int {
14            #[CaseAttr]
15            case Bar = 1 << 0;
16            case Baz = 1 << 1;
17
18            public function self() {
19                return $this;
20            }
21        }
22
23        return false;
24    })());
25} catch (Error $e) {
26    echo $e->getMessage();
27}
28
29?>
30--EXPECT--
31assert(function () {
32    enum Foo {
33        case Bar;
34    }
35
36    #[EnumAttr]
37    enum IntFoo: int {
38        #[CaseAttr]
39        case Bar = 1 << 0;
40        case Baz = 1 << 1;
41        public function self() {
42            return $this;
43        }
44
45    }
46
47    return false;
48}())
49