File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed
src/main/php/lang/ast/emit Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change 6
6
"description" : " XP Compiler" ,
7
7
"keywords" : [" module" , " xp" ],
8
8
"require" : {
9
- "xp-framework/core" : " ^10.8 " ,
9
+ "xp-framework/core" : " ^10.0 | ^9.0 | ^8.0 | ^7.0 " ,
10
10
"xp-framework/ast" : " dev-feature/php-enums as 7.1.0" ,
11
11
"php" : " >=7.0.0"
12
12
},
Original file line number Diff line number Diff line change 4
4
5
5
class Reflection extends Type {
6
6
private $ reflect ;
7
+ private static $ UNITENUM ;
7
8
8
- static function __static () { }
9
+ static function __static () {
10
+ self ::$ UNITENUM = interface_exists (\UnitEnum::class, false ); // Compatibility with XP < 10.8.0
11
+ }
9
12
10
13
/** @param string $type */
11
14
public function __construct ($ type ) {
@@ -28,7 +31,7 @@ public function name() { return $this->reflect->name; }
28
31
public function rewriteEnumCase ($ member ) {
29
32
if ($ this ->reflect ->isSubclassOf (Enum::class)) {
30
33
return $ this ->reflect ->getStaticPropertyValue ($ member , null ) instanceof Enum;
31
- } else if (!self ::$ ENUMS && $ this ->reflect ->isSubclassOf (\UnitEnum::class)) {
34
+ } else if (!self ::$ ENUMS && self :: $ UNITENUM && $ this ->reflect ->isSubclassOf (\UnitEnum::class)) {
32
35
$ value = $ this ->reflect ->getConstant ($ member ) ?: $ this ->reflect ->getStaticPropertyValue ($ member , null );
33
36
return $ value instanceof \UnitEnum;
34
37
}
You can’t perform that action at this time.
0 commit comments