@@ -168,13 +168,13 @@ public function __construct(DbiExtension $ext)
168168 * runs a query
169169 *
170170 * @param string $query SQL query to execute
171- * @param mixed $link optional database link to use
171+ * @param int $link optional database link to use
172172 * @param int $options optional query options
173173 * @param bool $cacheAffectedRows whether to cache affected rows
174174 */
175175 public function query (
176176 string $ query ,
177- $ link = self ::CONNECT_USER ,
177+ int $ link = self ::CONNECT_USER ,
178178 int $ options = self ::QUERY_BUFFERED ,
179179 bool $ cacheAffectedRows = true
180180 ): ResultInterface {
@@ -199,7 +199,7 @@ public function getCache(): Cache
199199 * runs a query and returns the result
200200 *
201201 * @param string $query query to run
202- * @param mixed $link link type
202+ * @param int $link link type
203203 * @param int $options if DatabaseInterface::QUERY_UNBUFFERED
204204 * is provided, it will instruct the extension
205205 * to use unbuffered mode
@@ -209,7 +209,7 @@ public function getCache(): Cache
209209 */
210210 public function tryQuery (
211211 string $ query ,
212- $ link = self ::CONNECT_USER ,
212+ int $ link = self ::CONNECT_USER ,
213213 int $ options = self ::QUERY_BUFFERED ,
214214 bool $ cacheAffectedRows = true
215215 ) {
@@ -271,17 +271,17 @@ public function tryQuery(
271271 * Send multiple SQL queries to the database server and execute the first one
272272 *
273273 * @param string $multiQuery multi query statement to execute
274- * @param int $linkIndex index of the opened database link
274+ * @param int $link index of the opened database link
275275 */
276276 public function tryMultiQuery (
277277 string $ multiQuery = '' ,
278- $ linkIndex = self ::CONNECT_USER
278+ int $ link = self ::CONNECT_USER
279279 ): bool {
280- if (! isset ($ this ->links [$ linkIndex ])) {
280+ if (! isset ($ this ->links [$ link ])) {
281281 return false ;
282282 }
283283
284- return $ this ->extension ->realMultiQuery ($ this ->links [$ linkIndex ], $ multiQuery );
284+ return $ this ->extension ->realMultiQuery ($ this ->links [$ link ], $ multiQuery );
285285 }
286286
287287 /**
@@ -322,11 +322,11 @@ public function tryQueryAsControlUser(string $sql)
322322 * returns array with table names for given db
323323 *
324324 * @param string $database name of database
325- * @param mixed $link mysql link resource|object
325+ * @param int $link mysql link resource|object
326326 *
327327 * @return array tables names
328328 */
329- public function getTables (string $ database , $ link = self ::CONNECT_USER ): array
329+ public function getTables (string $ database , int $ link = self ::CONNECT_USER ): array
330330 {
331331 if ($ database === '' ) {
332332 return [];
@@ -367,7 +367,7 @@ public function getTables(string $database, $link = self::CONNECT_USER): array
367367 * @param string $sortBy table attribute to sort by
368368 * @param string $sortOrder direction to sort (ASC or DESC)
369369 * @param string|null $tableType whether table or view
370- * @param mixed $link link type
370+ * @param int $link link type
371371 *
372372 * @return array list of tables in given db(s)
373373 *
@@ -382,7 +382,7 @@ public function getTablesFull(
382382 string $ sortBy = 'Name ' ,
383383 string $ sortOrder = 'ASC ' ,
384384 ?string $ tableType = null ,
385- $ link = self ::CONNECT_USER
385+ int $ link = self ::CONNECT_USER
386386 ): array {
387387 if ($ limitCount === true ) {
388388 $ limitCount = $ GLOBALS ['cfg ' ]['MaxTableList ' ];
@@ -652,7 +652,7 @@ public function getVirtualTables(string $db): array
652652 public function getDatabasesFull (
653653 ?string $ database = null ,
654654 bool $ forceStats = false ,
655- $ link = self ::CONNECT_USER ,
655+ int $ link = self ::CONNECT_USER ,
656656 string $ sortBy = 'SCHEMA_NAME ' ,
657657 string $ sortOrder = 'ASC ' ,
658658 int $ limitOffset = 0 ,
@@ -826,15 +826,15 @@ public function getColumnMapFromSql(string $sqlQuery, array $viewColumns = []):
826826 * @param string|null $database name of database
827827 * @param string|null $table name of table to retrieve columns from
828828 * @param string|null $column name of specific column
829- * @param mixed $link mysql link resource
829+ * @param int $link mysql link resource
830830 *
831831 * @return array
832832 */
833833 public function getColumnsFull (
834834 ?string $ database = null ,
835835 ?string $ table = null ,
836836 ?string $ column = null ,
837- $ link = self ::CONNECT_USER
837+ int $ link = self ::CONNECT_USER
838838 ): array {
839839 if (! $ GLOBALS ['cfg ' ]['Server ' ]['DisableIS ' ]) {
840840 $ sql = QueryGenerator::getInformationSchemaColumnsFullRequest (
@@ -898,7 +898,7 @@ public function getColumn(
898898 string $ table ,
899899 string $ column ,
900900 bool $ full = false ,
901- $ link = self ::CONNECT_USER
901+ int $ link = self ::CONNECT_USER
902902 ): array {
903903 $ sql = QueryGenerator::getColumnsSql (
904904 $ database ,
@@ -928,7 +928,7 @@ public function getColumns(
928928 string $ database ,
929929 string $ table ,
930930 bool $ full = false ,
931- $ link = self ::CONNECT_USER
931+ int $ link = self ::CONNECT_USER
932932 ): array {
933933 $ sql = QueryGenerator::getColumnsSql (
934934 $ database ,
@@ -993,14 +993,14 @@ private function attachIndexInfoToColumns(
993993 *
994994 * @param string $database name of database
995995 * @param string $table name of table to retrieve columns from
996- * @param mixed $link mysql link resource
996+ * @param int $link mysql link resource
997997 *
998998 * @return string[]
999999 */
10001000 public function getColumnNames (
10011001 string $ database ,
10021002 string $ table ,
1003- $ link = self ::CONNECT_USER
1003+ int $ link = self ::CONNECT_USER
10041004 ): array {
10051005 $ sql = QueryGenerator::getColumnsSql ($ database , $ table );
10061006
@@ -1013,7 +1013,7 @@ public function getColumnNames(
10131013 *
10141014 * @param string $database name of database
10151015 * @param string $table name of the table whose indexes are to be retrieved
1016- * @param mixed $link mysql link resource
1016+ * @param int $link mysql link resource
10171017 *
10181018 * @return array<int, array<string, string|null>>
10191019 * @psalm-return array<int, array{
@@ -1038,7 +1038,7 @@ public function getColumnNames(
10381038 public function getTableIndexes (
10391039 string $ database ,
10401040 string $ table ,
1041- $ link = self ::CONNECT_USER
1041+ int $ link = self ::CONNECT_USER
10421042 ): array {
10431043 $ sql = QueryGenerator::getTableIndexesSql ($ database , $ table );
10441044
@@ -1058,7 +1058,7 @@ public function getTableIndexes(
10581058 public function getVariable (
10591059 string $ var ,
10601060 int $ type = self ::GETVAR_SESSION ,
1061- $ link = self ::CONNECT_USER
1061+ int $ link = self ::CONNECT_USER
10621062 ) {
10631063 switch ($ type ) {
10641064 case self ::GETVAR_SESSION :
@@ -1084,7 +1084,7 @@ public function getVariable(
10841084 public function setVariable (
10851085 string $ var ,
10861086 string $ value ,
1087- $ link = self ::CONNECT_USER
1087+ int $ link = self ::CONNECT_USER
10881088 ): bool {
10891089 $ currentValue = $ this ->getVariable ($ var , self ::GETVAR_SESSION , $ link );
10901090 if ($ currentValue == $ value ) {
@@ -1224,7 +1224,7 @@ public function postConnectControl(Relation $relation): void
12241224 public function fetchValue (
12251225 string $ query ,
12261226 $ field = 0 ,
1227- $ link = self ::CONNECT_USER
1227+ int $ link = self ::CONNECT_USER
12281228 ) {
12291229 $ result = $ this ->tryQuery ($ query , $ link , self ::QUERY_BUFFERED , false );
12301230 if ($ result === false ) {
@@ -1253,7 +1253,7 @@ public function fetchValue(
12531253 public function fetchSingleRow (
12541254 string $ query ,
12551255 string $ type = DbalInterface::FETCH_ASSOC ,
1256- $ link = self ::CONNECT_USER
1256+ int $ link = self ::CONNECT_USER
12571257 ): ?array {
12581258 $ result = $ this ->tryQuery ($ query , $ link , self ::QUERY_BUFFERED , false );
12591259 if ($ result === false ) {
@@ -1348,7 +1348,7 @@ public function fetchResult(
13481348 string $ query ,
13491349 $ key = null ,
13501350 $ value = null ,
1351- $ link = self ::CONNECT_USER
1351+ int $ link = self ::CONNECT_USER
13521352 ): array {
13531353 $ resultRows = [];
13541354
@@ -1433,7 +1433,7 @@ public function getCompatibilities(): array
14331433 *
14341434 * @return Warning[] warnings
14351435 */
1436- public function getWarnings ($ link = self ::CONNECT_USER ): array
1436+ public function getWarnings (int $ link = self ::CONNECT_USER ): array
14371437 {
14381438 $ result = $ this ->tryQuery ('SHOW WARNINGS ' , $ link , 0 , false );
14391439 if ($ result === false ) {
@@ -1690,7 +1690,7 @@ public function connect(int $mode, ?array $server = null, ?int $target = null)
16901690 * @param string|DatabaseName $dbname database name to select
16911691 * @param int $link link type
16921692 */
1693- public function selectDb ($ dbname , $ link = self ::CONNECT_USER ): bool
1693+ public function selectDb ($ dbname , int $ link = self ::CONNECT_USER ): bool
16941694 {
16951695 if (! isset ($ this ->links [$ link ])) {
16961696 return false ;
@@ -1704,7 +1704,7 @@ public function selectDb($dbname, $link = self::CONNECT_USER): bool
17041704 *
17051705 * @param int $link link type
17061706 */
1707- public function moreResults ($ link = self ::CONNECT_USER ): bool
1707+ public function moreResults (int $ link = self ::CONNECT_USER ): bool
17081708 {
17091709 if (! isset ($ this ->links [$ link ])) {
17101710 return false ;
@@ -1718,7 +1718,7 @@ public function moreResults($link = self::CONNECT_USER): bool
17181718 *
17191719 * @param int $link link type
17201720 */
1721- public function nextResult ($ link = self ::CONNECT_USER ): bool
1721+ public function nextResult (int $ link = self ::CONNECT_USER ): bool
17221722 {
17231723 if (! isset ($ this ->links [$ link ])) {
17241724 return false ;
@@ -1734,7 +1734,7 @@ public function nextResult($link = self::CONNECT_USER): bool
17341734 *
17351735 * @return ResultInterface|false false when empty results / result set when not empty
17361736 */
1737- public function storeResult ($ link = self ::CONNECT_USER )
1737+ public function storeResult (int $ link = self ::CONNECT_USER )
17381738 {
17391739 if (! isset ($ this ->links [$ link ])) {
17401740 return false ;
@@ -1750,7 +1750,7 @@ public function storeResult($link = self::CONNECT_USER)
17501750 *
17511751 * @return string|bool type of connection used
17521752 */
1753- public function getHostInfo ($ link = self ::CONNECT_USER )
1753+ public function getHostInfo (int $ link = self ::CONNECT_USER )
17541754 {
17551755 if (! isset ($ this ->links [$ link ])) {
17561756 return false ;
@@ -1766,7 +1766,7 @@ public function getHostInfo($link = self::CONNECT_USER)
17661766 *
17671767 * @return int|bool version of the MySQL protocol used
17681768 */
1769- public function getProtoInfo ($ link = self ::CONNECT_USER )
1769+ public function getProtoInfo (int $ link = self ::CONNECT_USER )
17701770 {
17711771 if (! isset ($ this ->links [$ link ])) {
17721772 return false ;
@@ -1790,7 +1790,7 @@ public function getClientInfo(): string
17901790 *
17911791 * @param int $link link type
17921792 */
1793- public function getError ($ link = self ::CONNECT_USER ): string
1793+ public function getError (int $ link = self ::CONNECT_USER ): string
17941794 {
17951795 if (! isset ($ this ->links [$ link ])) {
17961796 return '' ;
@@ -1825,7 +1825,7 @@ public function queryAndGetNumRows(string $query)
18251825 *
18261826 * @param int $link link type
18271827 */
1828- public function insertId ($ link = self ::CONNECT_USER ): int
1828+ public function insertId (int $ link = self ::CONNECT_USER ): int
18291829 {
18301830 // If the primary key is BIGINT we get an incorrect result
18311831 // (sometimes negative, sometimes positive)
@@ -1848,7 +1848,7 @@ public function insertId($link = self::CONNECT_USER): int
18481848 * @psalm-return int|numeric-string
18491849 */
18501850 public function affectedRows (
1851- $ link = self ::CONNECT_USER ,
1851+ int $ link = self ::CONNECT_USER ,
18521852 bool $ getFromCache = true
18531853 ) {
18541854 if (! isset ($ this ->links [$ link ])) {
@@ -1900,13 +1900,13 @@ public function getFieldsMeta(ResultInterface $result): array
19001900 * Returns properly quoted string for use in MySQL queries.
19011901 *
19021902 * @param string $str string to be quoted
1903- * @param mixed $link optional database link to use
1903+ * @param int $link optional database link to use
19041904 *
19051905 * @psalm-return non-empty-string
19061906 *
19071907 * @psalm-taint-escape sql
19081908 */
1909- public function quoteString (string $ str , $ link = self ::CONNECT_USER ): string
1909+ public function quoteString (string $ str , int $ link = self ::CONNECT_USER ): string
19101910 {
19111911 return "' " . $ this ->extension ->escapeString ($ this ->links [$ link ], $ str ) . "' " ;
19121912 }
@@ -1917,11 +1917,11 @@ public function quoteString(string $str, $link = self::CONNECT_USER): string
19171917 * @deprecated Use {@see quoteString()} instead.
19181918 *
19191919 * @param string $str string to be escaped
1920- * @param mixed $link optional database link to use
1920+ * @param int $link optional database link to use
19211921 *
19221922 * @return string a MySQL escaped string
19231923 */
1924- public function escapeString (string $ str , $ link = self ::CONNECT_USER ): string
1924+ public function escapeString (string $ str , int $ link = self ::CONNECT_USER ): string
19251925 {
19261926 if (isset ($ this ->links [$ link ])) {
19271927 return $ this ->extension ->escapeString ($ this ->links [$ link ], $ str );
@@ -2114,7 +2114,7 @@ public static function load(?DbiExtension $extension = null): self
21142114 *
21152115 * @return object|false A statement object or false.
21162116 */
2117- public function prepare (string $ query , $ link = self ::CONNECT_USER )
2117+ public function prepare (string $ query , int $ link = self ::CONNECT_USER )
21182118 {
21192119 return $ this ->extension ->prepare ($ this ->links [$ link ], $ query );
21202120 }
0 commit comments