diff --git a/src/idl_gen_php.cpp b/src/idl_gen_php.cpp index ae5675483..3d391c71e 100644 --- a/src/idl_gen_php.cpp +++ b/src/idl_gen_php.cpp @@ -828,7 +828,7 @@ class PhpGenerator : public BaseGenerator { for (auto it = enum_def.vals.vec.begin(); it != enum_def.vals.vec.end(); ++it) { auto &ev = **it; - code += Indent + Indent + "\"" + ev.name + "\",\n"; + code += Indent + Indent + enum_def.name + "::" + ev.name + "=>" + "\"" + ev.name + "\",\n"; } code += Indent + ");\n\n"; diff --git a/tests/MyGame/Example/Any.php b/tests/MyGame/Example/Any.php index da691760c..929caaf66 100644 --- a/tests/MyGame/Example/Any.php +++ b/tests/MyGame/Example/Any.php @@ -11,10 +11,10 @@ class Any const MyGame_Example2_Monster = 3; private static $names = array( - "NONE", - "Monster", - "TestSimpleTableWithEnum", - "MyGame_Example2_Monster", + Any::NONE=>"NONE", + Any::Monster=>"Monster", + Any::TestSimpleTableWithEnum=>"TestSimpleTableWithEnum", + Any::MyGame_Example2_Monster=>"MyGame_Example2_Monster", ); public static function Name($e) diff --git a/tests/MyGame/Example/AnyAmbiguousAliases.php b/tests/MyGame/Example/AnyAmbiguousAliases.php index 8d8246212..13d318a06 100644 --- a/tests/MyGame/Example/AnyAmbiguousAliases.php +++ b/tests/MyGame/Example/AnyAmbiguousAliases.php @@ -11,10 +11,10 @@ class AnyAmbiguousAliases const M3 = 3; private static $names = array( - "NONE", - "M1", - "M2", - "M3", + AnyAmbiguousAliases::NONE=>"NONE", + AnyAmbiguousAliases::M1=>"M1", + AnyAmbiguousAliases::M2=>"M2", + AnyAmbiguousAliases::M3=>"M3", ); public static function Name($e) diff --git a/tests/MyGame/Example/AnyUniqueAliases.php b/tests/MyGame/Example/AnyUniqueAliases.php index 5d51f8262..fe551cceb 100644 --- a/tests/MyGame/Example/AnyUniqueAliases.php +++ b/tests/MyGame/Example/AnyUniqueAliases.php @@ -11,10 +11,10 @@ class AnyUniqueAliases const M2 = 3; private static $names = array( - "NONE", - "M", - "T", - "M2", + AnyUniqueAliases::NONE=>"NONE", + AnyUniqueAliases::M=>"M", + AnyUniqueAliases::T=>"T", + AnyUniqueAliases::M2=>"M2", ); public static function Name($e) diff --git a/tests/MyGame/Example/Color.php b/tests/MyGame/Example/Color.php index 70c7bfd94..d89529e8f 100644 --- a/tests/MyGame/Example/Color.php +++ b/tests/MyGame/Example/Color.php @@ -10,9 +10,9 @@ class Color const Blue = 8; private static $names = array( - "Red", - "Green", - "Blue", + Color::Red=>"Red", + Color::Green=>"Green", + Color::Blue=>"Blue", ); public static function Name($e) diff --git a/tests/namespace_test/NamespaceA/NamespaceB/EnumInNestedNS.php b/tests/namespace_test/NamespaceA/NamespaceB/EnumInNestedNS.php index d51cb41c4..bcb22b759 100644 --- a/tests/namespace_test/NamespaceA/NamespaceB/EnumInNestedNS.php +++ b/tests/namespace_test/NamespaceA/NamespaceB/EnumInNestedNS.php @@ -10,9 +10,9 @@ class EnumInNestedNS const C = 2; private static $names = array( - "A", - "B", - "C", + EnumInNestedNS::A=>"A", + EnumInNestedNS::B=>"B", + EnumInNestedNS::C=>"C", ); public static function Name($e) diff --git a/tests/union_vector/Character.php b/tests/union_vector/Character.php index bf73c3619..755958bc6 100644 --- a/tests/union_vector/Character.php +++ b/tests/union_vector/Character.php @@ -12,13 +12,13 @@ class Character const Unused = 6; private static $names = array( - "NONE", - "MuLan", - "Rapunzel", - "Belle", - "BookFan", - "Other", - "Unused", + Character::NONE=>"NONE", + Character::MuLan=>"MuLan", + Character::Rapunzel=>"Rapunzel", + Character::Belle=>"Belle", + Character::BookFan=>"BookFan", + Character::Other=>"Other", + Character::Unused=>"Unused", ); public static function Name($e)