Skip to content
This repository has been archived by the owner on May 9, 2022. It is now read-only.

Commit

Permalink
Allows you to use it on anonymous classes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Pol Dellaiera authored and Pol Dellaiera committed Sep 28, 2017
1 parent 9fcaade commit 45d7465
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/DynamicObjectsTrait.php
Expand Up @@ -196,7 +196,14 @@ public function doDynamicRequest(\Closure $func, array $parameters = [], $memoiz
return $this->memoize($func, $parameters);
}

return call_user_func_array($func->bindTo($this, get_called_class()), $parameters);
$class = get_called_class();
$reflexion = new \ReflectionClass($class);

if (!$reflexion->isAnonymous()) {
$func = $func->bindTo($this, $class);
}

return call_user_func_array($func, $parameters);
}

/**
Expand Down

0 comments on commit 45d7465

Please sign in to comment.