1
0
mirror of https://github.com/danog/parallel.git synced 2024-11-26 12:24:40 +01:00

Remove static binding from require closure

This commit is contained in:
Aaron Piotrowski 2019-05-11 09:48:24 -05:00
parent 1acd54e848
commit d70a82d04c
No known key found for this signature in database
GPG Key ID: ADD1EF783EDE9EEB

View File

@ -93,7 +93,7 @@ final class Parallel implements Context
$this->hub = Loop::getState(self::class);
if (!$this->hub instanceof Internal\ParallelHub) {
$this->hub = new Internal\ParallelHub();
$this->hub = new Internal\ParallelHub;
Loop::setState(self::class, $this->hub);
}
@ -215,7 +215,7 @@ final class Parallel implements Context
// Protect current scope by requiring script within another function.
$callable = (function () use ($argc, $argv): callable { // Using $argc so it is available to the required script.
return require $argv[0];
})();
})->bindTo(null, null)();
} catch (\TypeError $exception) {
throw new \Error(\sprintf("Script '%s' did not return a callable function", $path), 0, $exception);
} catch (\ParseError $exception) {