From 69a2fa3bf94a5ac25a1be272da52aee6facf4c06 Mon Sep 17 00:00:00 2001 From: Matthew Brown Date: Sat, 15 Jun 2019 18:29:24 -0400 Subject: [PATCH] Experiment with calling closure in method --- src/Psalm/Internal/Fork/Pool.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Psalm/Internal/Fork/Pool.php b/src/Psalm/Internal/Fork/Pool.php index 28a0fbfbe..fcb130e53 100644 --- a/src/Psalm/Internal/Fork/Pool.php +++ b/src/Psalm/Internal/Fork/Pool.php @@ -133,7 +133,7 @@ class Pool $task_done_buffer = ''; foreach ($task_data_iterator as $i => $task_data) { - $task_result = $task_closure($i, $task_data); + $task_result = self::runTaskClosure($task_closure, $i, $task_data); $task_done_message = new ForkTaskDoneMessage($task_result); $serialized_message = $task_done_buffer . base64_encode(serialize($task_done_message)) . PHP_EOL; @@ -177,6 +177,16 @@ class Pool exit(self::EXIT_SUCCESS); } + /** + * @param \Closure(int, mixed):mixed $task_closure + * @param mixed $task_data + * @return mixed + */ + private static function runTaskClosure(\Closure $task_closure, int $i, $task_data) + { + return $task_closure($i, $task_data); + } + /** * Prepare the socket pair to be used in a parent process and * return the stream the parent will use to read results.