xref: /PHP-8.4/ext/reflection/tests/gh8444.phpt (revision 1944c14c)
1--TEST--
2GH-8444 (Fix ReflectionProperty::__toString() of properties containing instantiated enums)
3--FILE--
4<?php
5
6enum Foo
7{
8    case Bar;
9}
10
11class Bar
12{
13    public Foo $enum = Foo::Bar;
14    public $enumInArray = [Foo::Bar];
15}
16
17echo new \ReflectionProperty('Bar', 'enum'), "\n";
18echo new \ReflectionProperty('Bar', 'enumInArray'), "\n";
19
20echo new \ReflectionProperty(new Bar, 'enum'), "\n";
21echo new \ReflectionProperty(new Bar, 'enumInArray'), "\n";
22
23?>
24--EXPECT--
25Property [ public Foo $enum = Foo::Bar ]
26
27Property [ public $enumInArray = [Foo::Bar] ]
28
29Property [ public Foo $enum = Foo::Bar ]
30
31Property [ public $enumInArray = [Foo::Bar] ]
32