diff --git a/tests/ReflectionClosure6Test.php b/tests/ReflectionClosure6Test.php new file mode 100644 index 00000000..d13a5e6f --- /dev/null +++ b/tests/ReflectionClosure6Test.php @@ -0,0 +1,19 @@ + $this instanceof (Forest::class); // Turning `instanceof` into an expression results into this incorrect compilation + $e1 = 'fn (\Foo\Bar $a) => $this instanceof (\Foo\Baz\Qux\Forest::class)'; + + $f2 = fn (Baz $a) => $this instanceof (class_exists(Foo::class) ? Foo::class : Forest::class); + $e2 = 'fn (\Foo\Bar $a) => $this instanceof (class_exists(\Foo:class) ? \Foo::class : \Foo\Baz\Qux\Forest::class)'; + + expect($f1)->toBeCode($e1); + expect($f2)->toBeCode($e2); +}); \ No newline at end of file