Fix handling for non-lowercased enum keyword, fixes #10521

main
Jordi Boggiano 2 years ago
parent eee8816bc3
commit f808e4907c
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC

@ -271,7 +271,7 @@ class ClassMapGenerator
if ($name[0] === ':') {
// This is an XHP class, https://github.com/facebook/xhp
$name = 'xhp'.substr(str_replace(array('-', ':'), array('_', '__'), $name), 1);
} elseif ($matches['type'][$i] === 'enum') {
} elseif (strtolower($matches['type'][$i]) === 'enum') {
// something like:
// enum Foo: int { HERP = '123'; }
// The regex above captures the colon, which isn't part of

@ -1,6 +1,6 @@
<?php
enum RolesBackedEnum:string {
EnUm RolesBackedEnum:string {
case Admin = 'Administrator';
case Guest = 'Guest';
case Moderator = 'Moderator';

Loading…
Cancel
Save