Ver código fonte

[php] remove usage of "untyped" (closes #6900)

Alexander Kuzmenko 7 anos atrás
pai
commit
f3252fcf9e
3 arquivos alterados com 12 adições e 2 exclusões
  1. 1 1
      std/DateTools.hx
  2. 10 0
      std/php/Global.hx
  3. 1 1
      std/sys/Http.hx

+ 1 - 1
std/DateTools.hx

@@ -144,7 +144,7 @@ class DateTools {
 		#if (neko && !(macro || interp))
 			return new String(untyped date_format(d.__t, f.__s));
 		#elseif php
-			return untyped __call__("strftime",f,d.__t);
+			return php.Global.strftime(f, php.Syntax.int(@:privateAccess d.__t));
 		#else
 			return __format(d,f);
 		#end

+ 10 - 0
std/php/Global.hx

@@ -1107,6 +1107,16 @@ extern class Global {
 	**/
 	static function date( format:String, ?timestamp:Int ) : EitherType<String,Bool>;
 
+	/**
+		@see http://php.net/manual/en/function.time.php
+	**/
+	static function time() : Int;
+
+	/**
+		@see http://php.net/manual/en/function.strftime.php
+	**/
+	static function strftime( format:String, ?timestamp:Int ) : EitherType<String,Bool>;
+
 	/**
 		@see http://php.net/manual/en/function.strtotime.php
 	**/

+ 1 - 1
std/sys/Http.hx

@@ -37,7 +37,7 @@ class Http extends haxe.http.HttpBase {
 	public function new(url:String) {
 		cnxTimeout = 10;
 		#if php
-		noShutdown = ! untyped __call__('function_exists', 'stream_socket_shutdown');
+		noShutdown = !php.Global.function_exists('stream_socket_shutdown');
 		#end
 		super(url);
 	}