Skip to content

Commit 65c28a4

Browse files
committed
Callback::toReflection() removed support for Nette\Reflection (BC break)
1 parent 98b1e4d commit 65c28a4

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/Utils/Callback.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,16 +144,14 @@ public static function toReflection($callable): \ReflectionFunctionAbstract
144144
$callable = self::unwrap($callable);
145145
}
146146

147-
$class = class_exists(Nette\Reflection\Method::class) ? Nette\Reflection\Method::class : 'ReflectionMethod';
148147
if (is_string($callable) && strpos($callable, '::')) {
149-
return new $class($callable);
148+
return new \ReflectionMethod($callable);
150149
} elseif (is_array($callable)) {
151-
return new $class($callable[0], $callable[1]);
150+
return new \ReflectionMethod($callable[0], $callable[1]);
152151
} elseif (is_object($callable) && !$callable instanceof \Closure) {
153-
return new $class($callable, '__invoke');
152+
return new \ReflectionMethod($callable, '__invoke');
154153
} else {
155-
$class = class_exists(Nette\Reflection\GlobalFunction::class) ? Nette\Reflection\GlobalFunction::class : 'ReflectionFunction';
156-
return new $class($callable);
154+
return new \ReflectionFunction($callable);
157155
}
158156
}
159157

0 commit comments

Comments
 (0)