@@ -212,7 +212,7 @@ public function initialize()
212212 * @param bool|array|string $no_quote_fields See fullQuoteArray()
213213 * @return bool|\mysqli_result|object MySQLi result object / DBAL object
214214 */
215- public function exec_INSERTquery ($ table , $ fields_values , $ no_quote_fields = false )
215+ public function exec_INSERTquery ($ table , $ fields_values , array | bool | string $ no_quote_fields = false ): bool | \ mysqli_result | object
216216 {
217217 $ this ->logDeprecation ();
218218 $ res = $ this ->query ($ this ->INSERTquery ($ table , $ fields_values , $ no_quote_fields ));
@@ -235,7 +235,7 @@ public function exec_INSERTquery($table, $fields_values, $no_quote_fields = fals
235235 * @param bool|array|string $no_quote_fields See fullQuoteArray()
236236 * @return bool|\mysqli_result|object MySQLi result object / DBAL object
237237 */
238- public function exec_INSERTmultipleRows ($ table , array $ fields , array $ rows , $ no_quote_fields = false )
238+ public function exec_INSERTmultipleRows ($ table , array $ fields , array $ rows , array | bool | string $ no_quote_fields = false ): bool | \ mysqli_result | object
239239 {
240240 $ this ->logDeprecation ();
241241 $ res = $ this ->query ($ this ->INSERTmultipleRows ($ table , $ fields , $ rows , $ no_quote_fields ));
@@ -259,7 +259,7 @@ public function exec_INSERTmultipleRows($table, array $fields, array $rows, $no_
259259 * @param bool|array|string $no_quote_fields See fullQuoteArray()
260260 * @return bool|\mysqli_result|object MySQLi result object / DBAL object
261261 */
262- public function exec_UPDATEquery ($ table , $ where , $ fields_values , $ no_quote_fields = false )
262+ public function exec_UPDATEquery ($ table , $ where , $ fields_values , array | bool | string $ no_quote_fields = false ): bool | \ mysqli_result | object
263263 {
264264 $ this ->logDeprecation ();
265265 $ res = $ this ->query ($ this ->UPDATEquery ($ table , $ where , $ fields_values , $ no_quote_fields ));
@@ -280,7 +280,7 @@ public function exec_UPDATEquery($table, $where, $fields_values, $no_quote_field
280280 * @param string $where WHERE clause, eg. "uid=1". NOTICE: You must escape values in this argument with $this->fullQuoteStr() yourself!
281281 * @return bool|\mysqli_result|object MySQLi result object / DBAL object
282282 */
283- public function exec_DELETEquery ($ table , $ where )
283+ public function exec_DELETEquery ($ table , $ where ): bool | \ mysqli_result | object
284284 {
285285 $ this ->logDeprecation ();
286286 $ res = $ this ->query ($ this ->DELETEquery ($ table , $ where ));
@@ -306,7 +306,7 @@ public function exec_DELETEquery($table, $where)
306306 * @param string $limit Optional LIMIT value ([begin,]max), if none, supply blank string.
307307 * @return bool|\mysqli_result|object MySQLi result object / DBAL object
308308 */
309- public function exec_SELECTquery ($ select_fields , $ from_table , $ where_clause , $ groupBy = '' , $ orderBy = '' , $ limit = '' )
309+ public function exec_SELECTquery ($ select_fields , $ from_table , $ where_clause , $ groupBy = '' , $ orderBy = '' , $ limit = '' ): bool | \ mysqli_result | object
310310 {
311311 $ this ->logDeprecation ();
312312 $ query = $ this ->SELECTquery ($ select_fields , $ from_table , $ where_clause , $ groupBy , $ orderBy , $ limit );
@@ -341,7 +341,7 @@ public function exec_SELECTquery($select_fields, $from_table, $where_clause, $gr
341341 * @return bool|\mysqli_result|object MySQLi result object / DBAL object
342342 * @see exec_SELECTquery()
343343 */
344- public function exec_SELECT_mm_query ($ select , $ local_table , $ mm_table , $ foreign_table , $ whereClause = '' , $ groupBy = '' , $ orderBy = '' , $ limit = '' )
344+ public function exec_SELECT_mm_query ($ select , $ local_table , $ mm_table , $ foreign_table , $ whereClause = '' , $ groupBy = '' , $ orderBy = '' , $ limit = '' ): bool | \ mysqli_result | object
345345 {
346346 $ this ->logDeprecation ();
347347 $ queryParts = $ this ->getSelectMmQueryParts ($ select , $ local_table , $ mm_table , $ foreign_table , $ whereClause , $ groupBy , $ orderBy , $ limit );
@@ -355,7 +355,7 @@ public function exec_SELECT_mm_query($select, $local_table, $mm_table, $foreign_
355355 * @return bool|\mysqli_result|object MySQLi result object / DBAL object
356356 * @see exec_SELECTquery()
357357 */
358- public function exec_SELECT_queryArray ($ queryParts )
358+ public function exec_SELECT_queryArray ($ queryParts ): bool | \ mysqli_result | object
359359 {
360360 $ this ->logDeprecation ();
361361 return $ this ->exec_SELECTquery ($ queryParts ['SELECT ' ], $ queryParts ['FROM ' ], $ queryParts ['WHERE ' ], $ queryParts ['GROUPBY ' ], $ queryParts ['ORDERBY ' ], $ queryParts ['LIMIT ' ]);
@@ -476,9 +476,8 @@ public function exec_TRUNCATEquery($table)
476476 * Use this to execute database queries instead of directly calling $this->link->query()
477477 *
478478 * @param string $query The query to send to the database
479- * @return bool|\mysqli_result
480479 */
481- protected function query ($ query )
480+ protected function query ($ query ): bool | \ mysqli_result
482481 {
483482 $ this ->logDeprecation ();
484483 if (!$ this ->isConnected ) {
@@ -500,7 +499,7 @@ protected function query($query)
500499 * @param bool|array|string $no_quote_fields See fullQuoteArray()
501500 * @return string|NULL Full SQL query for INSERT, NULL if $fields_values is empty
502501 */
503- public function INSERTquery ($ table , $ fields_values , $ no_quote_fields = false )
502+ public function INSERTquery ($ table , $ fields_values , array | bool | string $ no_quote_fields = false )
504503 {
505504 $ this ->logDeprecation ();
506505 // Table and fieldnames should be "SQL-injection-safe" when supplied to this
@@ -531,7 +530,7 @@ public function INSERTquery($table, $fields_values, $no_quote_fields = false)
531530 * @param bool|array|string $no_quote_fields See fullQuoteArray()
532531 * @return string|NULL Full SQL query for INSERT, NULL if $rows is empty
533532 */
534- public function INSERTmultipleRows ($ table , array $ fields , array $ rows , $ no_quote_fields = false )
533+ public function INSERTmultipleRows ($ table , array $ fields , array $ rows , array | bool | string $ no_quote_fields = false )
535534 {
536535 $ this ->logDeprecation ();
537536 // Table and fieldnames should be "SQL-injection-safe" when supplied to this
@@ -570,7 +569,7 @@ public function INSERTmultipleRows($table, array $fields, array $rows, $no_quote
570569 * @throws \InvalidArgumentException
571570 * @return string Full SQL query for UPDATE
572571 */
573- public function UPDATEquery ($ table , $ where , $ fields_values , $ no_quote_fields = false )
572+ public function UPDATEquery ($ table , $ where , $ fields_values , array | bool | string $ no_quote_fields = false )
574573 {
575574 $ this ->logDeprecation ();
576575 // Table and fieldnames should be "SQL-injection-safe" when supplied to this
@@ -748,7 +747,7 @@ public function listQuery($field, $value, $table)
748747 {
749748 $ this ->logDeprecation ();
750749 $ value = (string )$ value ;
751- if (strpos ($ value , ', ' ) !== false ) {
750+ if (str_contains ($ value , ', ' )) {
752751 throw new \InvalidArgumentException ('$value must not contain a comma (,) in $this->listQuery() ! ' , 1294585862 );
753752 }
754753 $ pattern = $ this ->quoteStr ($ value , $ table );
@@ -768,13 +767,10 @@ public function listQuery($field, $value, $table)
768767 public function searchQuery ($ searchWords , $ fields , $ table , $ constraint = self ::AND_Constraint)
769768 {
770769 $ this ->logDeprecation ();
771- switch ($ constraint ) {
772- case self ::OR_Constraint:
773- $ constraint = 'OR ' ;
774- break ;
775- default :
776- $ constraint = 'AND ' ;
777- }
770+ $ constraint = match ($ constraint ) {
771+ self ::OR_Constraint => 'OR ' ,
772+ default => 'AND ' ,
773+ };
778774
779775 $ queryParts = [];
780776 foreach ($ searchWords as $ sw ) {
@@ -838,7 +834,7 @@ public function prepare_SELECTqueryArray(array $queryParts, array $input_paramet
838834 * @return \mysqli_stmt|object MySQLi statement / DBAL object
839835 * @internal This method may only be called by \TYPO3\CMS\Typo3DbLegacy\Database\PreparedStatement
840836 */
841- public function prepare_PREPAREDquery ($ query , array $ queryComponents )
837+ public function prepare_PREPAREDquery ($ query , array $ queryComponents ): \ mysqli_stmt | object
842838 {
843839 $ this ->logDeprecation ();
844840 if (!$ this ->isConnected ) {
@@ -897,7 +893,7 @@ public function fullQuoteStr($str, $table, $allowNull = false)
897893 * @return array The input array with the values quoted
898894 * @see cleanIntArray()
899895 */
900- public function fullQuoteArray ($ arr , $ table , $ noQuote = false , $ allowNull = false )
896+ public function fullQuoteArray ($ arr , $ table , array | bool | string $ noQuote = false , $ allowNull = false )
901897 {
902898 $ this ->logDeprecation ();
903899 if (is_string ($ noQuote )) {
@@ -1070,7 +1066,7 @@ protected function getSelectMmQueryParts($select, $local_table, $mm_table, $fore
10701066 * @param string $query Query to execute
10711067 * @return bool|\mysqli_result|object MySQLi result object / DBAL object
10721068 */
1073- public function sql_query ($ query )
1069+ public function sql_query ($ query ): bool | \ mysqli_result | object
10741070 {
10751071 $ this ->logDeprecation ();
10761072 $ res = $ this ->query ($ query );
@@ -1125,7 +1121,7 @@ public function sql_num_rows($res)
11251121 * @param bool|\mysqli_result|object $res MySQLi result object / DBAL object
11261122 * @return array|bool Associative array of result row.
11271123 */
1128- public function sql_fetch_assoc ($ res )
1124+ public function sql_fetch_assoc ($ res ): array | bool
11291125 {
11301126 $ this ->logDeprecation ();
11311127 if ($ this ->debug_check_recordset ($ res )) {
@@ -1148,7 +1144,7 @@ public function sql_fetch_assoc($res)
11481144 * @param bool|\mysqli_result|object $res MySQLi result object / DBAL object
11491145 * @return array|bool Array with result rows.
11501146 */
1151- public function sql_fetch_row ($ res )
1147+ public function sql_fetch_row ($ res ): array | bool
11521148 {
11531149 $ this ->logDeprecation ();
11541150 if ($ this ->debug_check_recordset ($ res )) {
@@ -1304,7 +1300,7 @@ public function sql_pconnect()
13041300 /** @var \Doctrine\DBAL\Driver\Mysqli\MysqliConnection $mysqliConnection */
13051301 $ mysqliConnection = $ connection ->getWrappedConnection ();
13061302 $ this ->link = $ mysqliConnection ->getWrappedResourceHandle ();
1307- } catch (\Doctrine \DBAL \Exception \ConnectionException $ exception ) {
1303+ } catch (\Doctrine \DBAL \Exception \ConnectionException ) {
13081304 return false ;
13091305 }
13101306
@@ -1380,7 +1376,7 @@ public function admin_get_dbs()
13801376 if ($ this ->sql_select_db ()) {
13811377 $ dbArr [] = $ row ->SCHEMA_NAME ;
13821378 }
1383- } catch (\RuntimeException $ exception ) {
1379+ } catch (\RuntimeException ) {
13841380 // The exception happens if we cannot connect to the database
13851381 // (usually due to missing permissions). This is ok here.
13861382 // We catch the exception, skip the database and continue.
@@ -1489,7 +1485,7 @@ public function admin_get_charsets()
14891485 * @param string $query Query to execute
14901486 * @return bool|\mysqli_result|object MySQLi result object / DBAL object
14911487 */
1492- public function admin_query ($ query )
1488+ public function admin_query ($ query ): bool | \ mysqli_result | object
14931489 {
14941490 $ this ->logDeprecation ();
14951491 $ res = $ this ->query ($ query );
0 commit comments