Skip to content

Commit 7ee090b

Browse files
committed
fixed arguments (empty/required)
1 parent bf3e8dc commit 7ee090b

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
}
1717
],
1818
"require": {
19+
"php": ">=7.1",
1920
"mikehaertl/php-shellcommand": "1.*",
2021
"yiisoft/yii2": "2.*",
2122
"schmunk42/retry" : "*"

db/helper/CliHelper.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@
77
* file that was distributed with this source code.
88
*/
99

10-
1110
namespace dmstr\db\helper;
1211

13-
1412
use mikehaertl\shellcommand\Command;
13+
use yii\base\Exception;
1514
use yii\db\Connection;
1615

1716
/**
@@ -24,9 +23,12 @@
2423
*/
2524
class CliHelper
2625
{
26+
public static function getMysqlCommand($mysqlExecutable = 'mysql', ?Connection $db = null)
27+
{
28+
if ($db === null) {
29+
throw new Exception('Invalid database config');
30+
}
2731

28-
29-
public static function getMysqlCommand($mysqlExecutable = 'mysql', $db){
3032
$dsnOpts = CliHelper::getMysqlOptsFromDsn($db);
3133

3234
$command = new Command($mysqlExecutable);
@@ -54,7 +56,7 @@ public static function getMysqlOptsFromDsn(Connection $db)
5456

5557
$cliArgs = [
5658
'host' => null,
57-
'db' => null,
59+
'db' => null,
5860
'port' => 3306,
5961
];
6062

@@ -101,4 +103,4 @@ public static function getMysqlCliArgsFromPdo(Connection $db)
101103
return $cliArgs;
102104
}
103105

104-
}
106+
}

0 commit comments

Comments
 (0)