mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 04:45:20 +01:00
Add PHP 7.0-compatible closure creation
This commit is contained in:
parent
d76459e138
commit
149d7cab1c
@ -52,7 +52,11 @@ class FunctionReturnTypeProvider
|
||||
*/
|
||||
public function register(string $class)
|
||||
{
|
||||
if (version_compare(PHP_VERSION, '7.1.0') >= 0) {
|
||||
$callable = \Closure::fromCallable([$class, 'get']);
|
||||
} else {
|
||||
$callable = (new \ReflectionClass($class))->getMethod('get')->getClosure(new $class);
|
||||
}
|
||||
|
||||
foreach ($class::getFunctionIds() as $function_id) {
|
||||
self::$handlers[$function_id] = $callable;
|
||||
|
Loading…
Reference in New Issue
Block a user