<?php
function call(callable $foo)
{
echo $foo();
}
class Foo {
public function bar() {
call(array($this, 'baz' ));
}
private function baz() { return 'foo' ; }
}
(new Foo)->bar();
Fatal error: Uncaught TypeError: call(): Argument #1 ($foo) must be of type callable, array given, called in /in/D0lN8 on line 10 and defined in /in/D0lN8:3
Stack trace:
#0 /in/D0lN8(10): call(Array)
#1 /in/D0lN8(16): Foo->bar()
#2 {main}
thrown in /in/D0lN8 on line 3
Process exited with code 255.
Fatal error: Uncaught TypeError: Argument 1 passed to call() must be callable, array given, called in /in/D0lN8 on line 10 and defined in /in/D0lN8:3
Stack trace:
#0 /in/D0lN8(10): call(Array)
#1 /in/D0lN8(16): Foo->bar()
#2 {main}
thrown in /in/D0lN8 on line 3
Process exited with code 255.
Catchable fatal error: Argument 1 passed to call() must be callable, array given, called in /in/D0lN8 on line 10 and defined in /in/D0lN8 on line 3
Process exited with code 255.