Skip to content

Instantly share code, notes, and snippets.

@jazzdan
Forked from anonymous/main.php
Last active August 29, 2015 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jazzdan/0dcb850e6b2f59cdedbe to your computer and use it in GitHub Desktop.
Save jazzdan/0dcb850e6b2f59cdedbe to your computer and use it in GitHub Desktop.
<?hh // strict
class Caller {
public function set(string $property_name, Foo $object): void {
$object->$property_name = 'poopy';
}
public function call(string $property_name, Foo $object): string {
return $object->$property_name;
}
}
?hh // strict
class Foo {
}
<?php
require 'foo.hh';
require 'caller.hh';
$caller = new Caller();
$foo = new Foo();
$caller->set('poo', $foo);
echo $caller->call('poo', $foo);
$ hh_client .
/home/vagrant/dynamic_properties/caller.hh:5:14,27: Dynamic method call (Naming[2011])
/home/vagrant/dynamic_properties/caller.hh:8:20,33: Dynamic method call (Naming[2011])
$ hhvm main.php
poopy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment