Skip to content

Instantly share code, notes, and snippets.

@ckwalsh
Created April 11, 2014 20:07
Show Gist options
  • Save ckwalsh/10497446 to your computer and use it in GitHub Desktop.
Save ckwalsh/10497446 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 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