<?php
namespace X;
class TestClass
{
public function __construct()
{
}
public function __invoke()
{
}
public function foo()
{
}
public static function bar()
{
}
}
//$r = new \ReflectionMethod('X\TestClass::foo');
//$r = new \ReflectionMethod('X\TestClass::__construct');
//$r = new \ReflectionMethod(new TestClass(), '__construct');
//$r = new \ReflectionMethod('X\TestClass::bar');
//var_dump($r->class, $r->name);
//var_dump(is_callable(['X\TestClass', '__invoke']));
//var_dump(is_callable(['a' => 'X\TestClass', 'b' => 'bar']));
var_dump(method_exists(null, '__invoke'));
Fatal error: Uncaught TypeError: method_exists(): Argument #1 ($object_or_class) must be of type object|string, null given in /in/l9ibi:33
Stack trace:
#0 /in/l9ibi(33): method_exists(NULL, '__invoke')
#1 {main}
thrown in /in/l9ibi on line 33
Process exited with code 255.