protected function ensureStaticalProxyExists(string $alias): string
    {
        $path = $this->getCachePath() . \DIRECTORY_SEPARATOR . 'staticalproxy-' . \sha1($alias) . '.php';

        if (\file_exists($path)) {
            return $path;
        }

        \file_put_contents(
            $path,
            $this->formatStaticalProxyStub(
                $alias,
                \file_get_contents(__DIR__ . \DIRECTORY_SEPARATOR . 'Stubs' . \DIRECTORY_SEPARATOR . 'StaticalProxy.stub')
            )
        );

        return $path;
    }