diff --git a/std/php/Syntax.hx b/std/php/Syntax.hx index 46c920b3f5d..a16eeea2529 100644 --- a/std/php/Syntax.hx +++ b/std/php/Syntax.hx @@ -162,6 +162,7 @@ extern class Syntax { Haxe generates `Std.is(value, Type)` calls as `$value instanceof Type` automatically where possible. So you may need this only if you have a `Class` stored in a variable. **/ + @:overload(function( value:AsVar, phpClassName:AsVar ) : Bool {}) static function instanceof( value:AsVar, type:AsVar> ) : Bool; /** diff --git a/tests/unit/src/unit/TestPhp.hx b/tests/unit/src/unit/TestPhp.hx index 889a40dd1da..d9cfee8fda5 100644 --- a/tests/unit/src/unit/TestPhp.hx +++ b/tests/unit/src/unit/TestPhp.hx @@ -193,6 +193,13 @@ class TestPhp extends Test t(a.indexOf(fn2) < 0); f(a.remove(fn2)); } + + function testSyntaxInstanceof() { + var o = new ClosureDummy(); + var phpClassName = Boot.castClass(ClosureDummy).phpClassName; + t(Syntax.instanceof(o, ClosureDummy)); + t(Syntax.instanceof(o, phpClassName)); + } } private class ClosureDummy {