1
0
Fork 0

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

pull/10476/head
Jordi Boggiano 2022-02-15 16:41:06 +01:00
parent eee8816bc3
commit f808e4907c
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
2 changed files with 2 additions and 2 deletions

View File

@ -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

View File

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