@@ -910,7 +910,7 @@ public function updatePassword(string $errorUrl, string $username, string $hostn
910910 * @param string $hostname host name
911911 * @param string $itemType item type
912912 *
913- * @return mixed[] ($message, $sql_query)
913+ * @return array{Message, string} ($message, $sql_query)
914914 */
915915 public function getMessageAndSqlQueryForPrivilegesRevoke (
916916 string $ dbname ,
@@ -1124,7 +1124,7 @@ private function getSpecificPrivilege(array $row): array
11241124 return $ privilege ;
11251125 }
11261126
1127- /** @return mixed[] */
1127+ /** @return array<int, array<string|null>> */
11281128 private function getGlobalAndDatabasePrivileges (DatabaseName $ db ): array
11291129 {
11301130 $ listOfPrivileges = '`Select_priv`,
@@ -1185,7 +1185,7 @@ private function getGlobalAndDatabasePrivileges(DatabaseName $db): array
11851185 return $ result ->fetchAllAssoc ();
11861186 }
11871187
1188- /** @return mixed[] */
1188+ /** @return array<int, array<string|null>> */
11891189 private function getTablePrivileges (DatabaseName $ db , TableName $ table ): array
11901190 {
11911191 $ query = '
@@ -1207,7 +1207,7 @@ private function getTablePrivileges(DatabaseName $db, TableName $table): array
12071207 return $ result ->fetchAllAssoc ();
12081208 }
12091209
1210- /** @return mixed[] */
1210+ /** @return array<int, array<string|null>> */
12111211 private function getRoutinesPrivileges (DatabaseName $ db ): array
12121212 {
12131213 $ query = '
@@ -1930,7 +1930,7 @@ public function deleteUser(array $queries): array
19301930 /**
19311931 * Update the privileges and return the success or error message
19321932 *
1933- * @return mixed[] success message or error message for update
1933+ * @return array{string, Message} success message or error message for update
19341934 */
19351935 public function updatePrivileges (
19361936 string $ username ,
@@ -2309,21 +2309,19 @@ public function addUser(
23092309 if (empty ($ _POST ['change_copy ' ])) {
23102310 $ error = false ;
23112311
2312- if ($ createUserReal !== null ) {
2313- if (! $ this ->dbi ->tryQuery ($ createUserReal )) {
2314- $ error = true ;
2315- }
2312+ if (! $ this ->dbi ->tryQuery ($ createUserReal )) {
2313+ $ error = true ;
2314+ }
23162315
2317- if (isset ($ _POST ['authentication_plugin ' ]) && ! empty ($ passwordSetReal )) {
2318- $ this ->setProperPasswordHashing ($ _POST ['authentication_plugin ' ]);
2319- if ($ this ->dbi ->tryQuery ($ passwordSetReal )) {
2320- $ sqlQuery .= $ passwordSetShow ;
2321- }
2316+ if (isset ($ _POST ['authentication_plugin ' ]) && $ passwordSetReal !== '' ) {
2317+ $ this ->setProperPasswordHashing ($ _POST ['authentication_plugin ' ]);
2318+ if ($ this ->dbi ->tryQuery ($ passwordSetReal )) {
2319+ $ sqlQuery .= $ passwordSetShow ;
23222320 }
2323-
2324- $ sqlQuery = $ createUserShow . $ sqlQuery ;
23252321 }
23262322
2323+ $ sqlQuery = $ createUserShow . $ sqlQuery ;
2324+
23272325 [$ sqlQuery , $ message ] = $ this ->addUserAndCreateDatabase (
23282326 $ error ,
23292327 $ realSqlQuery ,
@@ -2354,13 +2352,10 @@ public function addUser(
23542352 $ oldUserGroup = $ _POST ['old_usergroup ' ] ?? '' ;
23552353 $ this ->setUserGroup ($ _POST ['username ' ], $ oldUserGroup );
23562354
2357- if ($ createUserReal !== null ) {
2358- $ queries [] = $ createUserReal ;
2359- }
2360-
2355+ $ queries [] = $ createUserReal ;
23612356 $ queries [] = $ realSqlQuery ;
23622357
2363- if (isset ($ _POST ['authentication_plugin ' ]) && ! empty ( $ passwordSetReal) ) {
2358+ if (isset ($ _POST ['authentication_plugin ' ]) && $ passwordSetReal !== '' ) {
23642359 $ this ->setProperPasswordHashing ($ _POST ['authentication_plugin ' ]);
23652360
23662361 $ queries [] = $ passwordSetReal ;
@@ -2370,11 +2365,9 @@ public function addUser(
23702365 // $queries_for_display, at the same position occupied
23712366 // by the real query in $queries
23722367 $ tmpCount = count ($ queries );
2373- if (isset ($ createUserReal )) {
2374- $ queriesForDisplay [$ tmpCount - 2 ] = $ createUserShow ;
2375- }
2368+ $ queriesForDisplay [$ tmpCount - 2 ] = $ createUserShow ;
23762369
2377- if (! empty ( $ passwordSetReal) ) {
2370+ if ($ passwordSetReal !== '' ) {
23782371 $ queriesForDisplay [$ tmpCount - 3 ] = $ createUserShow ;
23792372 $ queriesForDisplay [$ tmpCount - 2 ] = $ sqlQuery ;
23802373 $ queriesForDisplay [$ tmpCount - 1 ] = $ passwordSetShow ;
@@ -3017,8 +3010,7 @@ private function checkIfMariaDBPwdCheckPluginActive(): bool
30173010 * @param string $hostname host name
30183011 * @param string $password password
30193012 *
3020- * @return mixed[] ($create_user_real, $create_user_show, $real_sql_query, $sql_query
3021- * $password_set_real, $password_set_show, $alter_real_sql_query, $alter_sql_query)
3013+ * @return array{string, string, string, string, string, string, string, string}
30223014 */
30233015 public function getSqlQueriesForDisplayAndAddUser (string $ username , string $ hostname , string $ password ): array
30243016 {
@@ -3079,7 +3071,7 @@ public function getSqlQueriesForDisplayAndAddUser(string $username, string $host
30793071 (Compatibility::isMySqlOrPerconaDb () && $ serverVersion >= 50706 )
30803072 || (Compatibility::isMariaDb () && $ serverVersion >= 50200 )
30813073 ) {
3082- $ passwordSetReal = null ;
3074+ $ passwordSetReal = '' ;
30833075
30843076 // Required for binding '%' with '%s'
30853077 $ createUserStmt = str_replace ('% ' , '%% ' , $ createUserStmt );
@@ -3189,10 +3181,10 @@ public function getSqlQueriesForDisplayAndAddUser(string $username, string $host
31893181 || (Compatibility::isMariaDb ()
31903182 && $ serverVersion >= 50200 )
31913183 ) {
3192- $ passwordSetReal = null ;
3193- $ passwordSetShow = null ;
3184+ $ passwordSetReal = '' ;
3185+ $ passwordSetShow = '' ;
31943186 } else {
3195- if ($ passwordSetReal !== null ) {
3187+ if ($ passwordSetReal !== '' ) {
31963188 $ passwordSetReal .= '; ' ;
31973189 }
31983190
@@ -3239,7 +3231,7 @@ public function getRoutineType(string $dbname, string $routineName): string
32393231 * @param string $database Database name
32403232 * @param string $routine Routine name
32413233 *
3242- * @return mixed[]
3234+ * @return array<string, string>
32433235 */
32443236 private function getRoutinePrivileges (
32453237 string $ username ,
0 commit comments