We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f21ea0d commit 9840695Copy full SHA for 9840695
src/main/php/lang/reflection/Method.class.php
@@ -19,10 +19,20 @@ class Method extends Routine {
19
*/
20
public function closure($instance= null) {
21
try {
22
- return $this->reflect->getClosure($instance);
+ $closure= $this->reflect->getClosure($instance);
23
} catch (\Throwable $e) {
24
throw new IllegalArgumentException($e->getMessage());
25
}
26
+
27
+ // PHP 7.x generates warnings and returns NULL instead of throwing an
28
+ // exception from ReflectionMethod::getClosure()
29
+ if (null === $closure) {
30
+ $e= new IllegalArgumentException('Cannot get closure');
31
+ \xp::gc(__FILE__);
32
+ throw $e;
33
+ }
34
35
+ return $closure;
36
37
38
/**
0 commit comments