Browse Source

make Type.getClass also return interfaces on PHP (fixed issue #857)

Simon Krajewski 13 years ago
parent
commit
f752caad01
3 changed files with 9 additions and 3 deletions
  1. 1 1
      std/php/_std/Type.hx
  2. 5 0
      tests/unit/MyInterface.hx
  3. 3 2
      tests/unit/TestReflect.hx

+ 1 - 1
std/php/_std/Type.hx

@@ -59,7 +59,7 @@ enum ValueType {
 
 	public static function resolveClass( name : String ) : Class<Dynamic> untyped {
 		var c = untyped __call__("_hx_qtype", name);
-		if(__php__("$c instanceof _hx_class"))
+		if(__php__("$c instanceof _hx_class || $c instanceof _hx_interface"))
 			return c;
 		else
 			return null;

+ 5 - 0
tests/unit/MyInterface.hx

@@ -0,0 +1,5 @@
+package unit;
+
+interface MyInterface 
+{
+}

+ 3 - 2
tests/unit/TestReflect.hx

@@ -63,7 +63,7 @@ class TestReflect extends Test {
 		null,Int,String,Bool,Float,
 		Array,Hash,List,Date,Xml,Math,
 		unit.MyEnum,unit.MyClass,unit.MySubClass,
-		Class,Enum,Void,Dynamic,
+		Class,Enum,Void,Dynamic,unit.MyInterface
 	];
 
 	static inline function u( s : String ) : String {
@@ -82,7 +82,8 @@ class TestReflect extends Test {
 		"null","Int","String","Bool","Float",
 		"Array",u("Hash"),u("List"),"Date","Xml","Math",
 		u2("unit","MyEnum"),u2("unit","MyClass"),u2("unit","MySubClass"),
-		#if !flash9 u #end("Class"),u("Enum"),u("Void"),u("Dynamic"),
+		#if !flash9 u #end("Class"), u("Enum"), u("Void"), u("Dynamic"),
+		u2("unit","MyInterface")
 	];
 
 	public function testTypes() {