@@ -241,18 +241,13 @@ public function createConnector(array $config)
241241 return $ this ->container ->make ($ key );
242242 }
243243
244- switch ($ config ['driver ' ]) {
245- case 'mysql ' :
246- return new MySqlConnector ;
247- case 'pgsql ' :
248- return new PostgresConnector ;
249- case 'sqlite ' :
250- return new SQLiteConnector ;
251- case 'sqlsrv ' :
252- return new SqlServerConnector ;
253- }
254-
255- throw new InvalidArgumentException ("Unsupported driver [ {$ config ['driver ' ]}]. " );
244+ return match ($ config ['driver ' ]) {
245+ 'mysql ' => new MySqlConnector ,
246+ 'pgsql ' => new PostgresConnector ,
247+ 'sqlite ' => new SQLiteConnector ,
248+ 'sqlsrv ' => new SqlServerConnector ,
249+ default => throw new InvalidArgumentException ("Unsupported driver [ {$ config ['driver ' ]}]. " ),
250+ };
256251 }
257252
258253 /**
@@ -273,17 +268,12 @@ protected function createConnection($driver, $connection, $database, $prefix = '
273268 return $ resolver ($ connection , $ database , $ prefix , $ config );
274269 }
275270
276- switch ($ driver ) {
277- case 'mysql ' :
278- return new MySqlConnection ($ connection , $ database , $ prefix , $ config );
279- case 'pgsql ' :
280- return new PostgresConnection ($ connection , $ database , $ prefix , $ config );
281- case 'sqlite ' :
282- return new SQLiteConnection ($ connection , $ database , $ prefix , $ config );
283- case 'sqlsrv ' :
284- return new SqlServerConnection ($ connection , $ database , $ prefix , $ config );
285- }
286-
287- throw new InvalidArgumentException ("Unsupported driver [ {$ driver }]. " );
271+ return match ($ driver ) {
272+ 'mysql ' => new MySqlConnection ($ connection , $ database , $ prefix , $ config ),
273+ 'pgsql ' => new PostgresConnection ($ connection , $ database , $ prefix , $ config ),
274+ 'sqlite ' => new SQLiteConnection ($ connection , $ database , $ prefix , $ config ),
275+ 'sqlsrv ' => new SqlServerConnection ($ connection , $ database , $ prefix , $ config ),
276+ default => throw new InvalidArgumentException ("Unsupported driver [ {$ driver }]. " ),
277+ };
288278 }
289279}
0 commit comments