final public function handleCli(bool $buildContainer = false)
    {
        if ($buildContainer) {

            $this->rebuildContainer();

        } elseif ($this->env->isDevMode()) {

            $this->rebuildContainerIfNecessary();
        }

        $container = $this->getContainerInstance();

        if ($container === null) {
            throw new \RuntimeException('Could not get the container');
        }

//        set_error_handler(function ($errno, $errstr, $errfile, $errline, $errcontext) {
//            var_dump($errno, $errstr, $errfile, $errline, $errcontext);
//        });
//
//        register_shutdown_function(function () {
//            var_dump(error_get_last());
//        });

        /** @var Console|null $console */
        $console = $container->get(Console::SERVICE_ID);

        return $console->run();
    }
final public function handleCli(bool $buildContainer = false)
    {
        if ($buildContainer) {

            $this->rebuildContainer();

        } elseif ($this->env->isDevMode()) {

            $this->rebuildContainerIfNecessary();
        }

        $container = $this->getContainerInstance();

        if ($container === null) {
            throw new \RuntimeException('Could not get the container');
        }

//        set_error_handler(function ($errno, $errstr, $errfile, $errline, $errcontext) {
//            var_dump($errno, $errstr, $errfile, $errline, $errcontext);
//        });
//
//        register_shutdown_function(function () {
//            var_dump(error_get_last());
//        });

        /** @var Console|null $console */
        $console = $container->get(Console::SERVICE_ID);

        return $console->run();
    }
@param bool $buildContainer

@return int