Updating submodules
[hiphop-php.git] / hphp / test / slow / parenthesized_calls_more.php
blobcdc2f12922d5705a5dbe4aa016399e578da12061
1 <?hh
2 // Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
4 class Foo {
5 public function __construct(public (function(): void) $f)[] {}
6 public function f(): void { echo "f: method\n"; }
8 public static ?(function(int): int) $bar = null;
9 <<__DynamicallyCallable>> public static function pred(int $x): int { return $x - 1; }
10 public static function bar(int $x): int { return 2 * $x; }
13 <<__EntryPoint>>
14 function main(): void {
15 $e = new Foo(() ==> { echo "f: attribute\n"; });
16 $e->f(); // f:method
17 ($e->f)(); // f:attribute
19 Foo::$bar = $x ==> $x + 1; // succ
20 $bar = "pred"; //pred
21 var_dump((Foo::$bar)(10)); // int(11)
22 if (Foo::$bar) {
23 var_dump(Foo::$bar(10)); // int(9)
25 var_dump(Foo::bar(10)); // int(20)