From a2ecbd25939763940fe12f45494b3022a11a3b32 Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 30 Aug 2022 16:56:17 +0900 Subject: [PATCH 1/3] docs: fix types in doc comments --- system/Database/BaseConnection.php | 4 ++-- system/Database/ConnectionInterface.php | 4 ++-- system/Database/Postgre/Connection.php | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/system/Database/BaseConnection.php b/system/Database/BaseConnection.php index 11e54ea72aaa..405c59f6ee95 100644 --- a/system/Database/BaseConnection.php +++ b/system/Database/BaseConnection.php @@ -1231,9 +1231,9 @@ abstract public function affectedRows(): int; * Escapes data based on type. * Sets boolean and null types * - * @param mixed $str + * @param array|bool|float|int|object|string|null $str * - * @return mixed + * @return array|float|int|string */ public function escape($str) { diff --git a/system/Database/ConnectionInterface.php b/system/Database/ConnectionInterface.php index a937800b3a2f..d71eaf57c7bf 100644 --- a/system/Database/ConnectionInterface.php +++ b/system/Database/ConnectionInterface.php @@ -131,9 +131,9 @@ public function getLastQuery(); * Escapes data based on type. * Sets boolean and null types. * - * @param mixed $str + * @param array|bool|float|int|object|string|null $str * - * @return mixed + * @return array|float|int|string */ public function escape($str); diff --git a/system/Database/Postgre/Connection.php b/system/Database/Postgre/Connection.php index 4452eae3a5a9..b03ce13a5f76 100644 --- a/system/Database/Postgre/Connection.php +++ b/system/Database/Postgre/Connection.php @@ -169,9 +169,9 @@ public function affectedRows(): int * * Escapes data based on type * - * @param mixed $str + * @param array|bool|float|int|object|string|null $str * - * @return mixed + * @return array|float|int|string */ public function escape($str) { From 555b7ca6479401dd0ee5be44eb6e209b8d38ed55 Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 7 Sep 2022 09:57:39 +0900 Subject: [PATCH 2/3] docs: fix types in doc comments --- system/Database/BaseConnection.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/system/Database/BaseConnection.php b/system/Database/BaseConnection.php index 405c59f6ee95..a46838a66f7b 100644 --- a/system/Database/BaseConnection.php +++ b/system/Database/BaseConnection.php @@ -33,7 +33,7 @@ * @property mixed $encrypt * @property array $failover * @property string $hostname - * @property mixed $lastQuery + * @property Query $lastQuery * @property string $password * @property bool $pConnect * @property int|string $port @@ -154,7 +154,7 @@ abstract class BaseConnection implements ConnectionInterface /** * Encryption flag/data * - * @var mixed + * @var array|bool */ protected $encrypt = false; @@ -185,7 +185,7 @@ abstract class BaseConnection implements ConnectionInterface * The last query object that was executed * on this connection. * - * @var mixed + * @var Query */ protected $lastQuery; @@ -932,7 +932,7 @@ public function prepare(Closure $func, array $options = []) /** * Returns the last query's statement object. * - * @return mixed + * @return Query */ public function getLastQuery() { @@ -1149,9 +1149,10 @@ private function protectDotItem(string $item, string $alias, bool $protectIdenti * * This function escapes column and table names * - * @param mixed $item + * @param array|string $item * - * @return mixed + * @return array|string + * @phpstan-return ($item is array ? array : string) */ public function escapeIdentifiers($item) { From b45760f670e9669b25f4ed0b0aec5fd99fc629bc Mon Sep 17 00:00:00 2001 From: kenjis Date: Wed, 7 Sep 2022 10:06:08 +0900 Subject: [PATCH 3/3] docs: add @phpstan-return --- system/Database/BaseConnection.php | 1 + system/Database/ConnectionInterface.php | 1 + system/Database/Postgre/Connection.php | 1 + 3 files changed, 3 insertions(+) diff --git a/system/Database/BaseConnection.php b/system/Database/BaseConnection.php index a46838a66f7b..9ec6cb1493a0 100644 --- a/system/Database/BaseConnection.php +++ b/system/Database/BaseConnection.php @@ -1235,6 +1235,7 @@ abstract public function affectedRows(): int; * @param array|bool|float|int|object|string|null $str * * @return array|float|int|string + * @phpstan-return ($str is array ? array : float|int|string) */ public function escape($str) { diff --git a/system/Database/ConnectionInterface.php b/system/Database/ConnectionInterface.php index d71eaf57c7bf..c1650759b908 100644 --- a/system/Database/ConnectionInterface.php +++ b/system/Database/ConnectionInterface.php @@ -134,6 +134,7 @@ public function getLastQuery(); * @param array|bool|float|int|object|string|null $str * * @return array|float|int|string + * @phpstan-return ($str is array ? array : float|int|string) */ public function escape($str); diff --git a/system/Database/Postgre/Connection.php b/system/Database/Postgre/Connection.php index b03ce13a5f76..688e11bfa72a 100644 --- a/system/Database/Postgre/Connection.php +++ b/system/Database/Postgre/Connection.php @@ -172,6 +172,7 @@ public function affectedRows(): int * @param array|bool|float|int|object|string|null $str * * @return array|float|int|string + * @phpstan-return ($str is array ? array : float|int|string) */ public function escape($str) {