Skip to content

Commit b38a949

Browse files
authored
Merge pull request #7433 from ping-yee/replace-mixed-db-connection
docs: fix PHPDoc types in Database Connection.
2 parents 3897361 + 5ef5579 commit b38a949

File tree

4 files changed

+13
-12
lines changed

4 files changed

+13
-12
lines changed

system/Database/BaseConnection.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,8 @@ abstract protected function _close();
456456
/**
457457
* Create a persistent database connection.
458458
*
459-
* @return mixed
459+
* @return false|object|resource
460+
* @phpstan-return false|TConnection
460461
*/
461462
public function persistentConnect()
462463
{
@@ -558,7 +559,7 @@ abstract protected function execute(string $sql);
558559
* Should automatically handle different connections for read/write
559560
* queries if needed.
560561
*
561-
* @param mixed ...$binds
562+
* @param array|string|null $binds
562563
*
563564
* @return BaseResult|bool|Query BaseResult when “read” type query, bool when “write” type query, Query when prepared query
564565
* @phpstan-return BaseResult<TConnection, TResult>|bool|Query
@@ -1747,7 +1748,7 @@ protected function _enableForeignKeyChecks()
17471748
/**
17481749
* Accessor for properties if they exist.
17491750
*
1750-
* @return mixed
1751+
* @return array|bool|float|int|object|resource|string|null
17511752
*/
17521753
public function __get(string $key)
17531754
{

system/Database/ConnectionInterface.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function getConnection(?string $alias = null);
6262
/**
6363
* Select a specific database table to use.
6464
*
65-
* @return mixed
65+
* @return bool
6666
*/
6767
public function setDatabase(string $databaseName);
6868

@@ -98,7 +98,7 @@ public function getVersion(): string;
9898
* Should automatically handle different connections for read/write
9999
* queries if needed.
100100
*
101-
* @param mixed ...$binds
101+
* @param array|string|null $binds
102102
*
103103
* @return BaseResult|bool|Query
104104
* @phpstan-return BaseResult<TConnection, TResult>|bool|Query
@@ -127,7 +127,7 @@ public function table($tableName);
127127
/**
128128
* Returns the last query's statement object.
129129
*
130-
* @return mixed
130+
* @return Query
131131
*/
132132
public function getLastQuery();
133133

@@ -150,7 +150,7 @@ public function escape($str);
150150
*
151151
* @param array ...$params
152152
*
153-
* @return mixed
153+
* @return array|bool|float|int|object|resource|string|null
154154
*/
155155
public function callFunction(string $functionName, ...$params);
156156

system/Database/Postgre/Connection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ protected function _transRollback(): bool
533533
*
534534
* Overrides BaseConnection::isWriteType, adding additional read query types.
535535
*
536-
* @param mixed $sql
536+
* @param string $sql
537537
*/
538538
public function isWriteType($sql): bool
539539
{

system/Database/SQLSRV/Connection.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class Connection extends BaseConnection
4444
* FALSE or SQLSRV_CURSOR_FORWARD would increase performance,
4545
* but would disable num_rows() (and possibly insert_id())
4646
*
47-
* @var mixed
47+
* @var false|string
4848
*/
4949
public $scrollable;
5050

@@ -436,7 +436,7 @@ public function affectedRows(): int
436436
/**
437437
* Select a specific database table to use.
438438
*
439-
* @return mixed
439+
* @return bool
440440
*/
441441
public function setDatabase(?string $databaseName = null)
442442
{
@@ -485,7 +485,7 @@ protected function execute(string $sql)
485485
/**
486486
* Returns the last error encountered by this connection.
487487
*
488-
* @return mixed
488+
* @return array<string, int|string>
489489
*
490490
* @deprecated Use `error()` instead.
491491
*/
@@ -546,7 +546,7 @@ public function getVersion(): string
546546
*
547547
* Overrides BaseConnection::isWriteType, adding additional read query types.
548548
*
549-
* @param mixed $sql
549+
* @param string $sql
550550
*/
551551
public function isWriteType($sql): bool
552552
{

0 commit comments

Comments
 (0)