@return Closure

@SuppressWarnings(PHPMD.StaticAccess)
762108
protected function getCreateAnalyzerClosure()
    {
        return function ($app) {
            /** @var AnalysisStrategyInterface $strategy */
            $strategy = $app[AnalysisStrategyInterface::class];
            $analyzer = Analyzer::instance($strategy);

            $logger = $this->getLoggerIfEnabled($app);
            $logger === null ?: $analyzer->setLogger($logger);

            return $analyzer;
        };
    }
273838
public function getClosures() {
    if (!isset($this->closures)) {
      $cc = new ClosureCompiler();
    
      list($closureCode, $methods) = $cc->compile(new GClass(\Psc\Code\Code::getClass($this)));
      unset($methods[array_search('getClosures', $methods)]);
    
      $that = $this;
      eval($closureCode);
      
      $this->closures = compact($methods);
    }
    
    return $this->closures;
  }
1319462
public static function rowMapper(): Closure
    {
        return static function (stdClass $row): Family {
            return Family::getInstance($row->f_id, Tree::findById((int) $row->f_file), $row->f_gedcom);
        };
    }
212252
protected function getAuthorsColumn(): Closure
    {
        return function(ExtensionContract $extension) {
            $authors = array_map(function(array $author) {
                if (array_key_exists('email', $author)) {
                    return (string) HTML::mailto($author['email'], $author['name']);
                }

                return $author['name'];
            }, $extension->getPackage()->getAuthors());

            $prefix = '';

            if ($extension->getVendorName() === 'antaresproject') {
                $prefix = trans('antares/foundation::title.antares_team');
            }

            return $prefix . ' - ' . implode(', ', $authors);
        };
    }
750888
public function toString()
    {
        if ($this->isClosure()) {
            throw new LogicException('You cannot serialize a closure.');
        }

        if ($this->isFunction()) {
            return $this->getCallMethod();
        }

        $separator = $this->isStaticMethod() ? '::' : '->';

        return $this->getCallClass() . $separator . $this->getCallMethod();

    }
361186
public function getBody()
    {
        if ($this->body instanceof \Closure) {
            $method = $this->body;

            $this->body = $method();
        }

        return $this->body;
    }
325525
protected function makeCallable()
    {
        if ($this->call instanceof Closure || $this->isFunction()) {
            return $this->call;
        }

        if ($this->isStaticMethod()) {
            return [$this->getCallClass(), $this->getCallMethod()];
        }

        return [$this->getCallInstance(), $this->getCallMethod()];

    }
188909
protected function construct(string $abstract) : Closure
    {
        $inspector = new ReflectionClass($abstract);

        if (($constructor = $inspector->getConstructor()) && ($dependencies = $constructor->getParameters())) {

            // if, and only if, a class has a constructor with parameters, we try to solve then
            // creating a resolving callback that in every call will recalculate all dependencies
            // for the given class, and offcourse, using a cached resolving callback if exists.

            return function (string $abstract, array $parameters) use ($inspector, $dependencies) {
                return $inspector->newInstanceArgs(
                    $this->process($abstract, $parameters, $dependencies)
                );
            };
        }

        return function (string $abstract) {
            return new $abstract;
        };
    }
93230
public static function from(Closure $closure)
    {
        if (static::$context === null) {
            $instance = new static($closure);
        } elseif (isset(static::$context->scope[$closure])) {
            $instance = static::$context->scope[$closure];
        } else {
            $instance = new static($closure);
            static::$context->scope[$closure] = $instance;
        }

        return $instance;
    }
601863
public function resolve($closure)
    {
        if (is_array($closure)) {
            $reflection = new \ReflectionMethod($closure[0], $closure[1]);
        } else {
            $reflection = new \ReflectionFunction($closure);
        }

        $arguments = $reflection->getParameters();

        $arguments = array_map(function ($argument) {
            return isset($this->bindMaps[$argument->name]) ? $this->bindMaps[$argument->name] : null;
        }, $arguments);

        return @call_user_func_array($closure, $arguments);
    }
754642
private function tabSorter(): Closure
    {
        return static function (ModuleTabInterface $x, ModuleTabInterface $y): int {
            return $x->getTabOrder() <=> $y->getTabOrder();
        };
    }
587477
private function getNodeToStringConverter(): Closure
    {
        return function (...$nodes) {
            $value = '';
            foreach ($nodes as $node) {
                if (is_scalar($node)) {
                    $value .= $node;
                } else {
                    $value .= $node->getValue();
                }
            }

            return $value;
        };
    }
1179234
private function createPipelineCallback() : Closure
    {
        return function ($stack, $pipe) {
            return function ($request) use ($stack, $pipe) {
                if ($pipe instanceof Closure) {
                    return call_user_func($pipe, $request, $stack);
                } elseif (!is_object($pipe)) {
                    list($callback, $parameters) = $this->createParameters($pipe, $request, $stack, true);
                } else {
                    if (!method_exists($pipe, $this->method)) {
                        throw new PipelineException(sprintf("%s::%s doesn't exist", get_class($pipe), $this->method));
                    }

                    list($callback, $parameters) = $this->createParameters($pipe, $request, $stack);
                }

                return $this->call($callback, $parameters);
            };
        };
    }
101058
private function phpErrorHandler(): Closure
    {
        return static function (int $errno, string $errstr, string $errfile, int $errline): bool {
            // Ignore errors that are silenced with '@'
            if (error_reporting() & $errno) {
                throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
            }

            return true;
        };
    }
327191
public function share(Closure $callable) : Closure
    {
        return function () use ($callable) {
            static $object;
            $c = $this;

            if (is_null($object) && $callable instanceof Closure) {
                $object = $callable($c);
            }

            return $object;
        };
    }
883073
public function getFilter(): Closure
    {
        $rootDirectory = $this->rootDirectory;
        $includePaths = $this->includePaths;
        $excludePaths = $this->excludePaths;

        return function (SplFileInfo $file) use ($rootDirectory, $includePaths, $excludePaths) {

            if ($file->getExtension() !== 'php') {
                return false;
            }

            $fullPath = $this->getFileFullPath($file);
            // Do not touch files that not under rootDirectory
            if (strpos($fullPath, $rootDirectory) !== 0) {
                return false;
            }

            if (!empty($includePaths)) {
                $found = false;
                foreach ($includePaths as $includePattern) {
                    if (fnmatch("{$includePattern}*", $fullPath, FNM_NOESCAPE)) {
                        $found = true;
                        break;
                    }
                }
                if (!$found) {
                    return false;
                }
            }

            foreach ($excludePaths as $excludePattern) {
                if (fnmatch("{$excludePattern}*", $fullPath, FNM_NOESCAPE)) {
                    return false;
                }
            }

            return true;
        };
    }
1112537
private function footerSorter(): Closure
    {
        return static function (ModuleFooterInterface $x, ModuleFooterInterface $y): int {
            return $x->getFooterOrder() <=> $y->getFooterOrder();
        };
    }