Arquivos
hhvm/hphp/test/slow/object_invoke_method/764.php
T
Paul Tarjan c2ec1c97c9 sortof format slow tests
A poor man's formatter since I didn't like any of the other ones I found. The original C++ source sometimes put newlines and sometimes not.

Codemods:

    codemod '([;{}])([^\n])' '\1\n\2'
    codemod -m '\s*<\?php\s+' '<?php\n\n'
    codemod '\t' '  '

I hand-fixed all the failing tests
2013-05-30 17:32:57 -07:00

48 linhas
917 B
PHP

<?php
// standard execution
class C1 {
public function __invoke($a0, $a1) {
var_dump('C1');
var_dump($a0, $a1);
}
}
class D1 extends C1 {
}
class E1 extends D1 {
public function __invoke($a0, $a1) {
var_dump('D2');
var_dump($a0, $a1);
}
}
class F1 {
public function __invoke($a0) {
return $a0 > 10;
}
}
$c = new C1;
$d = new D1;
$e = new E1;
$c(0, 1);
$d(0, 1);
$e(0, 1);
call_user_func($c, 0, 1);
call_user_func($d, 0, 1);
call_user_func($e, 0, 1);
call_user_func_array($c, array(0, 1));
call_user_func_array($d, array(0, 1));
call_user_func_array($e, array(0, 1));
$c->__invoke(0, 1);
$d->__invoke(0, 1);
$e->__invoke(0, 1);
C1::__invoke(0, 1);
D1::__invoke(0, 1);
E1::__invoke(0, 1);
function mk($n) {
return $n . '::__invoke';
}
call_user_func(mk('C1'), 0, 1);
call_user_func(mk('D1'), 0, 1);
call_user_func(mk('E1'), 0, 1);
var_dump(array_filter(array(0, 1, 11, 13), new F1));