X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fpsy%2Fpsysh%2Fsrc%2FExecutionClosure.php;h=29a3bcc6d9169eeef89614069aec0a800b3ae28b;hp=d2c551b8c14d2409d1d995b532177e8993cb5950;hb=419f97be044f1aebd0713921ee604841127e9e84;hpb=052617e40b525f8b817d84c29b1c04951f427069 diff --git a/vendor/psy/psysh/src/ExecutionClosure.php b/vendor/psy/psysh/src/ExecutionClosure.php index d2c551b8c..29a3bcc6d 100644 --- a/vendor/psy/psysh/src/ExecutionClosure.php +++ b/vendor/psy/psysh/src/ExecutionClosure.php @@ -25,7 +25,7 @@ class ExecutionClosure */ public function __construct(Shell $__psysh__) { - $exec = function () use ($__psysh__) { + $this->setClosure($__psysh__, function () use ($__psysh__) { try { // Restore execution scope variables extract($__psysh__->getScopeVariables(false)); @@ -66,20 +66,27 @@ class ExecutionClosure $__psysh__->setScopeVariables(get_defined_vars()); return $_; - }; + }); + } + /** + * Set the closure instance. + * + * @param Shell $psysh + * @param \Closure $closure + */ + protected function setClosure(Shell $shell, \Closure $closure) + { if (self::shouldBindClosure()) { - $that = $__psysh__->getBoundObject(); + $that = $shell->getBoundObject(); if (is_object($that)) { - $this->closure = $exec->bindTo($that, get_class($that)); + $closure = $closure->bindTo($that, get_class($that)); } else { - $this->closure = $exec->bindTo(null, null); + $closure = $closure->bindTo(null, $shell->getBoundClass()); } - - return; } - $this->closure = $exec; + $this->closure = $closure; } /**