Special extern class to support PHP language specifics. Don't use these functions unless you are really sure what you are doing.
Static methods
staticarrayDecl<T>(args:Rest<T>):NativeIndexedArray<T>
Syntax.arrayDecl(arg1, arg2, arg3);
Generates native array declaration:
[$arg1, $arg2, $arg3]
staticassocDecl<T>(?arg:Null<T>):NativeAssocArray<Dynamic>
Syntax.assocDecl({field1:'first', field2:2}});
Generates native associative array declaration:
["field1" => "first", "field2" => 2];
This method is not recursive.
Accepts object declarations only.
That means you can't pass an object stored in a variable to this method like Syntax.assocDecl(someVar)
.
Use php.Lib.associativeArrayOfObject(someVar)
instead.
staticcall<T>(object:AsVar<T>, methodName:String, args:Rest<Dynamic>):Dynamic
Generates a call to instance method: $object->{$methodName}(<args>)
staticinlineclone<T>(value:T):T
staticcode(code:String, args:Rest<Dynamic>):Dynamic
Embeds plain php code.
php
should be a string literal with php code.
It can contain placeholders like {0}
, {1}
which will be replaced with corresponding arguments from args
.
E.g.:
Syntax.code("var_dump({0}, {1})", a, b);
will generate
var_dump($a, $b);
staticcodeDeref(code:String, args:Rest<Dynamic>):Dynamic
The same as code()
, but adds dereferencing
when required to workaround "cannot use temporary expression in write context" php error.
staticconstruct<T>(cls:AsVar<Class<T>>, args:Rest<Dynamic>):T
staticconstruct(className:AsVar<String>, args:Rest<Dynamic>):Dynamic
Generates new $className($arg1, ...$argN)
staticfield<T>(object:AsVar<T>, fieldName:String):Dynamic
Generates instance field access for reading on object
staticinlineforeach<TCollection, TKey, TValue>(collection:TCollection, body:(TKey, TValue) ‑> Void):Void
Syntax.foreach(collection, function(key, value) trace(key, value));
generates:
foreach($collection as $key => $value) {
trace($key, $value);
}
staticgetField<T>(object:AsVar<T>, fieldName:String):Dynamic
Generates instance field access for reading on object
staticgetStaticField(className:AsVar<EitherType<Class<Dynamic>, String>>, fieldName:String):Dynamic
Generates static field access for reading on className
staticinstanceof<V, C>(value:AsVar<V>, type:AsVar<Class<C>>):Bool
staticinstanceof(value:AsVar<Dynamic>, phpClassName:AsVar<String>):Bool
statickeepVar(localVar:Rest<Dynamic>):Void
Don't let compiler to optimize away local var passed to this method.
staticnativeClassName<T>(cls:EitherType<Class<T>, Enum<T>>):String
Generates PHP class name for a provided Haxe class.
trace(Syntax.nativeClassName(php.Web)); // outputs: php\Web
staticsetField<T>(object:AsVar<T>, fieldName:String, value:Dynamic):Void
Generates instance field access for writing on object
staticsetStaticField(object:AsVar<EitherType<Class<Dynamic>, String>>, fieldName:String, value:Dynamic):Void
Generates static field access for writing on object
staticinlinesplat(args:EitherType<NativeArray, Traversable>):Rest<Dynamic>
Adds ...
operator before args
staticstaticCall(className:AsVar<EitherType<Class<Dynamic>, String>>, methodName:String, args:Rest<Dynamic>):Dynamic
Generates a call to static method: $className::{$methodName}(<args>)
staticinlineunion(left:NativeArray, right:NativeArray):NativeArray
Generates $left + $right
for php arrays.