2
0
Эх сурвалжийг харах

[php] fixed typed cast to NativeArray (closes #10576)

Aleksandr Kuzmenko 3 жил өмнө
parent
commit
dd5385900d

+ 2 - 0
src/generators/genphp7.ml

@@ -1416,6 +1416,7 @@ class code_writer (ctx:php_generator_context) hx_type_path php_name =
 								| TAbstract ({ a_path = ["php"],"NativeIndexedArray" }, [param]) -> (self#use_t param) ^ "[]"
 								| _ -> "array"
 							)
+						| (["php"],"NativeArray") -> "array"
 						| _ when Meta.has Meta.CoreType abstr.a_meta -> "mixed"
 						| _ -> self#use_t abstr.a_this
 		(**
@@ -2072,6 +2073,7 @@ class code_writer (ctx:php_generator_context) hx_type_path php_name =
 							| "float" -> "'Float'"
 							| "bool" -> "'Bool'"
 							| "string" -> "'String'"
+							| "array" -> "'array'"
 							| "mixed" -> "'Dynamic'"
 							| "Enum" -> "'Enum'"
 							| "Class" -> "'Class'"

+ 1 - 1
std/php/Boot.hx

@@ -339,7 +339,7 @@ class Boot {
 				if (value.is_string()) {
 					return value;
 				}
-			case 'php\\NativeArray':
+			case 'array':
 				if (value.is_array()) {
 					return value;
 				}

+ 10 - 0
tests/unit/src/unit/issues/Issue10576.hx

@@ -0,0 +1,10 @@
+package unit.issues;
+
+class Issue10576 extends Test {
+#if php
+	function test() {
+		cast(new php.NativeArray(), php.NativeArray);
+        noAssert();
+	}
+#end
+}