Skip to content

Instantly share code, notes, and snippets.

@ckwalsh
Created April 19, 2014 06:27
Show Gist options
  • Save ckwalsh/11075918 to your computer and use it in GitHub Desktop.
Save ckwalsh/11075918 to your computer and use it in GitHub Desktop.
ckwalsh@ckwalsh:~$ cat foo.php
<?hh
namespace Foo;
class Bar {
function foobar(): this {
return $this;
}
}
$b = new Bar();
$b2 = $b->foobar();
ckwalsh@ckwalsh:~$ hhvm --version
HipHop VM 3.1.0-dev+2014.04.18 (rel)
Compiler: heads/master-0-gccf06d57ebf7da5f9cab87dcdfa1439494a7e34b
Repo schema: 612222bbdfacd77d127e829b0e7e928b04905850
ckwalsh@ckwalsh:~$ hhvm foo.php
Fatal error: Value returned from Foo\Bar::foobar() must be of type Foo\this, Foo\Bar given in /home/ckwalsh/foo.php on line 7
ckwalsh@ckwalsh:~$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment