Skip to content

Commit 32f9287

Browse files
committed
use array_combine
1 parent 1e18f03 commit 32f9287

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/Context/FeatureContext.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,8 +1084,9 @@ private function set_cache_dir(): void {
10841084
* @param string $sql_cmd Command to run.
10851085
* @param array<string, string> $assoc_args Optional. Associative array of options. Default empty.
10861086
* @param bool $add_database Optional. Whether to add dbname to the $sql_cmd. Default false.
1087+
* @return array{stdout: string, stderr: string, exit_code: int}
10871088
*/
1088-
private static function run_sql( $sql_cmd, $assoc_args = [], $add_database = false ): void {
1089+
private static function run_sql( $sql_cmd, $assoc_args = [], $add_database = false ) {
10891090
$default_assoc_args = [
10901091
'host' => self::$db_settings['dbhost'],
10911092
'user' => self::$db_settings['dbuser'],
@@ -1105,11 +1106,8 @@ private static function run_sql( $sql_cmd, $assoc_args = [], $add_database = fal
11051106
if ( self::$log_run_times ) {
11061107
self::log_proc_method_run_time( 'run_sql ' . $sql_cmd, $start_time );
11071108
}
1108-
return [
1109-
'stdout' => $result[0],
1110-
'stderr' => $result[1],
1111-
'exit_code' => $result[2],
1112-
];
1109+
1110+
return array_combine( [ 'stdout', 'stderr', 'exit_code' ], $result );
11131111
}
11141112

11151113
public function create_db(): void {
@@ -1124,7 +1122,7 @@ public function create_db(): void {
11241122
/**
11251123
* Test if the database connection is working.
11261124
*/
1127-
public function test_connection() {
1125+
public function test_connection(): void {
11281126
$sql_result = self::run_sql(
11291127
'mysql --no-defaults',
11301128
[

0 commit comments

Comments
 (0)