mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 12:55:26 +01:00
Experiment with calling closure in method
This commit is contained in:
parent
55aa1f78cb
commit
69a2fa3bf9
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user