From a2271fda8d11f04b9fc8f8b5bc9221478ea53463 Mon Sep 17 00:00:00 2001 From: Binyamin Yawitz <316103+byawitz@users.noreply.github.com> Date: Thu, 8 Aug 2024 11:11:13 -0400 Subject: [PATCH] refactor: Making CLI non-breaking --- composer.json | 2 +- src/CLI/CLI.php | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 55c9c31..e1b5724 100755 --- a/composer.json +++ b/composer.json @@ -15,7 +15,7 @@ }, "require": { "php": ">=7.4", - "utopia-php/framework": "1.0.0-RC1", + "utopia-php/framework": "1.0.*", "utopia-php/di": "0.1.*" }, "require-dev": { diff --git a/src/CLI/CLI.php b/src/CLI/CLI.php index 3091599..c76a852 100644 --- a/src/CLI/CLI.php +++ b/src/CLI/CLI.php @@ -3,6 +3,7 @@ namespace Utopia\CLI; use Exception; +use Utopia\CLI\Adapters\Generic; use Utopia\DI\Container; use Utopia\DI\Dependency; use Utopia\Http\Hook; @@ -81,12 +82,12 @@ class CLI /** * CLI constructor. * - * @param Adapter $adapter + * @param Adapter|null $adapter * @param array $args * * @throws Exception */ - public function __construct(Adapter $adapter, array $args = []) + public function __construct(Adapter $adapter = null, array $args = []) { if (\php_sapi_name() !== 'cli') { throw new Exception('CLI tasks can only work from the command line'); @@ -96,7 +97,7 @@ public function __construct(Adapter $adapter, array $args = []) @\cli_set_process_title($this->command); - $this->adapter = $adapter; + $this->adapter = $adapter ?? new Generic(); $this->container = new Container(); }