Skip to content

Commit a2271fd

Browse files
committed
refactor: Making CLI non-breaking
1 parent 7edc16d commit a2271fd

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
},
1616
"require": {
1717
"php": ">=7.4",
18-
"utopia-php/framework": "1.0.0-RC1",
18+
"utopia-php/framework": "1.0.*",
1919
"utopia-php/di": "0.1.*"
2020
},
2121
"require-dev": {

src/CLI/CLI.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Utopia\CLI;
44

55
use Exception;
6+
use Utopia\CLI\Adapters\Generic;
67
use Utopia\DI\Container;
78
use Utopia\DI\Dependency;
89
use Utopia\Http\Hook;
@@ -81,12 +82,12 @@ class CLI
8182
/**
8283
* CLI constructor.
8384
*
84-
* @param Adapter $adapter
85+
* @param Adapter|null $adapter
8586
* @param array $args
8687
*
8788
* @throws Exception
8889
*/
89-
public function __construct(Adapter $adapter, array $args = [])
90+
public function __construct(Adapter $adapter = null, array $args = [])
9091
{
9192
if (\php_sapi_name() !== 'cli') {
9293
throw new Exception('CLI tasks can only work from the command line');
@@ -96,7 +97,7 @@ public function __construct(Adapter $adapter, array $args = [])
9697

9798
@\cli_set_process_title($this->command);
9899

99-
$this->adapter = $adapter;
100+
$this->adapter = $adapter ?? new Generic();
100101
$this->container = new Container();
101102
}
102103

0 commit comments

Comments
 (0)