Skip to content

Instantly share code, notes, and snippets.

@daviddoran
Last active November 12, 2015 14:42
Show Gist options
  • Save daviddoran/1090ebea9bbaec6a3f15 to your computer and use it in GitHub Desktop.
Save daviddoran/1090ebea9bbaec6a3f15 to your computer and use it in GitHub Desktop.
<?hh // strict
namespace Hack\UserDocumentation\TypeChecker\Modes\Examples\CallIntoDecl;
require __DIR__ . '/decl.inc.php';
// This actually makes the call to calling_into_decl() since we cannot have
// top level functions in strict mode
require __DIR__ . '/main-function.inc.php';
// use \Hack\UserDocumentation\TypeChecker\Modes\Examples\Decl as Decl;
function calling_into_decl(): string {
// If php_func wasn't in decl mode, then we would get an unbound name error.
// As it is, we can call this function and the typechecker will ensure we are
// passing in the right number of arguments, but not the types of them.
return \Hack\UserDocumentation\TypeChecker\Modes\Examples\Decl\php_func("a", "b");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment