public static function visitInParallel($visitors)
    {
        $visitorsCount = count($visitors);
        $skipping      = new SplFixedArray($visitorsCount);

        return [
            'enter' => static function (Node $node) use ($visitors, $skipping, $visitorsCount) {
                for ($i = 0; $i < $visitorsCount; $i++) {
                    if (! empty($skipping[$i])) {
                        continue;
                    }

                    $fn = self::getVisitFn(
                        $visitors[$i],
                        $node->kind, /* isLeaving */
                        false
                    );

                    if (! $fn) {
                        continue;
                    }

                    $result = call_user_func_array($fn, func_get_args());

                    if ($result instanceof VisitorOperation) {
                        if ($result->doContinue) {
                            $skipping[$i] = $node;
                        } elseif ($result->doBreak) {
                            $skipping[$i] = $result;
                        } elseif ($result->removeNode) {
                            return $result;
                        }
                    } elseif ($result !== null) {
                        return $result;
                    }
                }
            },
            'leave' => static function (Node $node) use ($visitors, $skipping, $visitorsCount) {
                for ($i = 0; $i < $visitorsCount; $i++) {
                    if (empty($skipping[$i])) {
                        $fn = self::getVisitFn(
                            $visitors[$i],
                            $node->kind, /* isLeaving */
                            true
                        );

                        if ($fn) {
                            $result = call_user_func_array($fn, func_get_args());
                            if ($result instanceof VisitorOperation) {
                                if ($result->doBreak) {
                                    $skipping[$i] = $result;
                                } elseif ($result->removeNode) {
                                    return $result;
                                }
                            } elseif ($result !== null) {
                                return $result;
                            }
                        }
                    } elseif ($skipping[$i] === $node) {
                        $skipping[$i] = null;
                    }
                }
            },
        ];
    }
public static function visitInParallel($visitors)
    {
        $visitorsCount = count($visitors);
        $skipping      = new SplFixedArray($visitorsCount);

        return [
            'enter' => static function (Node $node) use ($visitors, $skipping, $visitorsCount) {
                for ($i = 0; $i < $visitorsCount; $i++) {
                    if (! empty($skipping[$i])) {
                        continue;
                    }

                    $fn = self::getVisitFn(
                        $visitors[$i],
                        $node->kind, /* isLeaving */
                        false
                    );

                    if (! $fn) {
                        continue;
                    }

                    $result = call_user_func_array($fn, func_get_args());

                    if ($result instanceof VisitorOperation) {
                        if ($result->doContinue) {
                            $skipping[$i] = $node;
                        } elseif ($result->doBreak) {
                            $skipping[$i] = $result;
                        } elseif ($result->removeNode) {
                            return $result;
                        }
                    } elseif ($result !== null) {
                        return $result;
                    }
                }
            },
            'leave' => static function (Node $node) use ($visitors, $skipping, $visitorsCount) {
                for ($i = 0; $i < $visitorsCount; $i++) {
                    if (empty($skipping[$i])) {
                        $fn = self::getVisitFn(
                            $visitors[$i],
                            $node->kind, /* isLeaving */
                            true
                        );

                        if ($fn) {
                            $result = call_user_func_array($fn, func_get_args());
                            if ($result instanceof VisitorOperation) {
                                if ($result->doBreak) {
                                    $skipping[$i] = $result;
                                } elseif ($result->removeNode) {
                                    return $result;
                                }
                            } elseif ($result !== null) {
                                return $result;
                            }
                        }
                    } elseif ($skipping[$i] === $node) {
                        $skipping[$i] = null;
                    }
                }
            },
        ];
    }
@param callable[][] $visitors

@return callable[][]