Make check callback for flock
@return Callable
164281
private function makeCheckCallback( $check )
    {
        // callable
        if( is_callable($check) ) {
            $this->check = $check;
            $this->type = $this->makeCallbackHumanReadable( $check );
            return;
        }

        // class or obj
        if( is_object($check) ) {
            $class = get_class( $check );
        } elseif( is_string($check) ) {
            $class = (string) $check;
        } else {
            throw new BadTypeException( $check, "Class|Object|Callable");
        }
        $this->type = $class;
        $this->check = function( $newMember ) use ( $class ) {
            return is_a( $newMember, $class );
        };
    }
807566
private function checkCallback() : void
    {
        if (isset($this->onload) && !$this->is_loaded) {
            $this->is_loaded = true;
            call_user_func($this->onload, $this);
        }
    }
97123
protected function getCallable()
    {
        $callback = null;
        if (is_object($this->runnable) && $this->runnable instanceof Runnable) {
            $callback = array($this->runnable, 'run');
        } elseif (is_callable($this->runnable)) {
            $callback = $this->runnable;
        } else {
            $callback = array($this, 'run');
        }

        return $callback;
    }
23132
public function validateDish(): callable
    {
        return function ($value): RecipeInterface {
            /**
             * @var Recipe $this
             */
            if ($this->exceptedDish instanceof DishInterface) {
                $this->exceptedDish->isExcepted($value);
            }

            return $this;
        };
    }
647831
public function wait(): bool
    {
        if (!$this->pid) {
            throw new BadMethodCallException('wait can only be called from the parent of a forked process');
        }

        // Cascade the call to waitAll for asynchronous processes
        if ($this->async) {
            return $this->waitAll();
        }

        // Wait for the process to complete
        pcntl_waitpid($this->pid, $status);

        // Capture any messages returned by the child process
        if ($msg = $this->channel->receive()) {
            $this->messages[] = $msg;
        }

        // If the process did not exit gracefully, mark it as failed
        if (!pcntl_wifexited($status)) {
            return false;
        }

        // If the process exited gracefully, check the exit code
        return pcntl_wexitstatus($status) === 0;
    }
45912
protected function getRetryDecider(): callable
    {
        return function (
            $retries,
            Request $request,
            Response $response = null,
            RequestException $exception = null
        ) {
            // Don't retry unless this is a Connection issue
            if (!$exception instanceof ConnectException) {
                return false;
            }

            // Limit the number of retries
            return $retries < 4;
        };
    }
1042305
public function startCheck()
    {
        $masterPool = getInstance()->getAsynPool($this->master);
        if (!$masterPool) {
            $masterPool = new MysqlAsynPool(getInstance()->config, $this->master);
            getInstance()->addAsynPool($this->master, $masterPool, true);
        }

        foreach ($this->slaves as $slavePoolName) {
            $slavePool = getInstance()->getAsynPool($slavePoolName);
            if (!$slavePool) {
                $slavePool = new MysqlAsynPool(getInstance()->config, $slavePoolName);
                getInstance()->addAsynPool($slavePoolName, $slavePool, true);
            }
        }

        return $this;
    }
4004
public function tick()
    {
        while (!$this->queue->isEmpty() && $this->loop->isRunning())
        {
            $this->callback = $this->queue->dequeue();
            $callback = $this->callback; // without this proxy PHPStorm marks line as fatal error.
            $callback($this->loop);
        }
    }
1009735
private function tick() {
        $this->deferQueue = \array_merge($this->deferQueue, $this->nextTickQueue);
        $this->nextTickQueue = [];

        $this->activate($this->enableQueue);
        $this->enableQueue = [];

        try {
            foreach ($this->deferQueue as $watcher) {
                if (!isset($this->deferQueue[$watcher->id])) {
                    continue; // Watcher disabled by another defer watcher.
                }

                unset($this->watchers[$watcher->id], $this->deferQueue[$watcher->id]);

                $callback = $watcher->callback;
                $callback($watcher->id, $watcher->data);
            }

            $this->dispatch(empty($this->nextTickQueue) && empty($this->enableQueue) && $this->running);

        } catch (\Throwable $exception) {
            if (null === $this->errorHandler) {
                throw $exception;
            }

            $errorHandler = $this->errorHandler;
            $errorHandler($exception);
        } catch (\Exception $exception) { // @todo Remove when PHP 5.x support is no longer needed.
            if (null === $this->errorHandler) {
                throw $exception;
            }

            $errorHandler = $this->errorHandler;
            $errorHandler($exception);
        }
    }
407816
public function listen(): Promise
    {
        return call(function () {
            while (null !== ($chunk = yield $this->stream->read())) {
                foreach ($this->onNewFrameCallables as $newFrameCallable) {
                    $newFrameCallable($this->transformChunk($chunk));
                }
            }
        });
    }
1141012
function watch(): Result {
    $this->build();
    return $this->taskWatch()
      ->monitor('lib', function() { $this->build(); })
      ->monitor('test', function() { $this->test(); })
      ->run();
  }
929117
protected function checkCallable()
    {
        $callback = $this->getConfig('callback');

        if (!is_callable($callback)) {
            throw new InvalidArgumentException(sprintf(
                'The `callback` option is not a callable. Got `%s` instead.',
                gettype($callback)
            ));
        }
    }
1176508
private function refresh()
    {
        $this->setHandler($this->config->get('logging.default', 'stack'));

        $this->messages = [
            'handler' => '',
            'files'   => [],
        ];
        $this->files    = [];

        $this->checkHandler();
        $this->checkLogFiles();

        return $this;
    }
807870
public function continueRecipe(): callable
    {
        return function (array $with = [], string $nextStep = null): ChefInterface {
            /**
             * @var Chef $this
             */
            $this->updateMyWorkPlan($with);

            while (($callable = $this->getNextStep($nextStep)) instanceof BowlInterface) {
                try {
                    $callable->execute($this, $this->workPlan);
                } catch (\Throwable $error) {
                    $this->position = \count($this->steps) + 1;

                    $this->callErrors($error);
                }

                $nextStep = null;
            }

            return $this;
        };
    }
306222
public function firstCall(): Call
    {
        if (isset($this->calls[0])) {
            return $this->callVerifierFactory->fromCall($this->calls[0]);
        }

        throw new UndefinedCallException(0);
    }
1365394
public function callbackResponse()
    {
        // cleanup
        $this->getCaller()->setParameter("VERSION", null);
        $this->getCaller()->setParameter("PWD", null);
        $this->getCaller()->setParameter("USER", null);
        $this->getCaller()->setParameter("SIGNATURE", null);

        return $this->getCaller()->getCallBackResponse("CallbackResponse");
    }
147289
protected function callAfterDispatchCallbacks()
    {
        try {
            foreach ($this->after_filter_callbacks as $callback) {
                if (is_callable($callback)) {
                    if (is_string($callback)) {
                        $callback($this);

                    } else {
                        call_user_func($callback, $this);

                    }
                }
            }
        } catch (Throwable $e) { // PHP 7 compatibility
            $this->error($e);
        } catch (Exception $e) { // TODO: Remove this catch block once PHP 5.x support is no longer necessary.
            $this->error($e);
        }
    }