Arquivos
hhvm/hphp/test/quick/callable.php
T
Paul Tarjan ae4d1a0def fix callble typehint in interp mode
Somehow the JIT doesn't hit this codepath, but with interp mode the param is a string, but we think `callable` means an object of type callable.

I hate to hadd another top-level if statement to every call. Would a switch statement on the type be better?
2013-06-03 10:54:36 -07:00

24 linhas
319 B
PHP

<?php
function check($f) {
var_dump($f);
var_dump(is_callable($f));
}
function typehint(callable $a) {
var_dump('worked');
}
function id() {}
function main() {
check('');
check('id');
check('blarblah');
$cl = function() { return 'closure'; };
typehint($cl);
typehint('id');
}
main();