Skip to content

Commit 72476b3

Browse files
authored
refactor: replace type mixed with more specific types (#10345)
* refactor: replace narrowable mixed PHPDocs with specific types * refactor: collapse long form `mixed` to just `mixed`
1 parent fa140b5 commit 72476b3

38 files changed

Lines changed: 146 additions & 666 deletions

system/Common.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -403,9 +403,9 @@ function db_connect($db = null, bool $getShared = true)
403403
* retrieving values set from the .env file for
404404
* use in config files.
405405
*
406-
* @param array<int|string, mixed>|bool|float|int|object|string|null $default
406+
* @param mixed $default
407407
*
408-
* @return array<int|string, mixed>|bool|float|int|object|string|null
408+
* @return mixed
409409
*/
410410
function env(string $key, $default = null)
411411
{
@@ -1080,7 +1080,7 @@ function session(?string $val = null)
10801080
* - $timer = service('timer')
10811081
* - $timer = \CodeIgniter\Config\Services::timer();
10821082
*
1083-
* @param array|bool|float|int|object|string|null ...$params
1083+
* @param mixed ...$params
10841084
*/
10851085
function service(string $name, ...$params): ?object
10861086
{
@@ -1096,7 +1096,7 @@ function service(string $name, ...$params): ?object
10961096
/**
10971097
* Always returns a new instance of the class.
10981098
*
1099-
* @param array|bool|float|int|object|string|null ...$params
1099+
* @param mixed ...$params
11001100
*/
11011101
function single_service(string $name, ...$params): ?object
11021102
{

system/Config/BaseConfig.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ protected function parseEncryptionKey(string $key): string
166166
/**
167167
* Initialization an environment-specific configuration setting
168168
*
169-
* @param array|bool|float|int|string|null $property
169+
* @param array<int|string, mixed>|bool|float|int|string|null $property
170170
*
171171
* @return void
172172
*/

system/Config/BaseService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ public static function override(string $key, object $value): void
244244
*
245245
* $key must be a name matching a service.
246246
*
247-
* @param array|bool|float|int|object|string|null ...$params
247+
* @param mixed ...$params
248248
*
249249
* @return object
250250
*/

system/Database/BaseBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2817,7 +2817,7 @@ public function getCompiledDelete(bool $reset = true): string
28172817
/**
28182818
* Compiles a delete string and runs the query
28192819
*
2820-
* @param array|RawSql|string $where
2820+
* @param array<int|string, mixed>|RawSql|string $where
28212821
*
28222822
* @return bool|string Returns a SQL string if in test mode.
28232823
*
@@ -3075,7 +3075,7 @@ protected function trackAliases($table)
30753075
* Generates a query string based on which functions were used.
30763076
* Should not be called directly.
30773077
*
3078-
* @param mixed $selectOverride
3078+
* @param false|string $selectOverride
30793079
*/
30803080
protected function compileSelect($selectOverride = false): string
30813081
{

system/Database/BaseConnection.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,7 @@ abstract protected function execute(string $sql);
781781
* Should automatically handle different connections for read/write
782782
* queries if needed.
783783
*
784-
* @param array|string|null $binds
784+
* @param array<int|string, mixed>|string|null $binds
785785
*
786786
* @return BaseResult<TConnection, TResult>|bool|Query
787787
*
@@ -1533,7 +1533,7 @@ abstract public function affectedRows(): int;
15331533
* Escapes data based on type.
15341534
* Sets boolean and null types
15351535
*
1536-
* @param array|bool|float|int|object|string|null $str
1536+
* @param mixed $str
15371537
*
15381538
* @return ($str is array ? array : float|int|string)
15391539
*/
@@ -2059,7 +2059,7 @@ protected function _enableForeignKeyChecks()
20592059
/**
20602060
* Accessor for properties if they exist.
20612061
*
2062-
* @return array|bool|float|int|object|resource|string|null
2062+
* @return mixed
20632063
*/
20642064
public function __get(string $key)
20652065
{

system/Database/BaseUtils.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public function optimizeTable(string $tableName)
125125
/**
126126
* Optimize Database
127127
*
128-
* @return mixed
128+
* @return array<string, mixed>|bool
129129
*
130130
* @throws DatabaseException
131131
*/
@@ -170,7 +170,7 @@ public function optimizeDatabase()
170170
/**
171171
* Repair Table
172172
*
173-
* @return mixed
173+
* @return array<string, mixed>|bool
174174
*
175175
* @throws DatabaseException
176176
*/

system/Database/ConnectionInterface.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public function getVersion(): string;
100100
* Should automatically handle different connections for read/write
101101
* queries if needed.
102102
*
103-
* @param array|string|null $binds
103+
* @param array<int|string, mixed>|string|null $binds
104104
*
105105
* @return BaseResult<TConnection, TResult>|bool|Query
106106
*/
@@ -137,7 +137,7 @@ public function getLastQuery();
137137
* Escapes data based on type.
138138
* Sets boolean and null types.
139139
*
140-
* @param array|bool|float|int|object|string|null $str
140+
* @param mixed $str
141141
*
142142
* @return ($str is array ? array : float|int|string)
143143
*/
@@ -149,7 +149,7 @@ public function escape($str);
149149
*
150150
* @param array ...$params
151151
*
152-
* @return array|bool|float|int|object|resource|string|null
152+
* @return mixed
153153
*/
154154
public function callFunction(string $functionName, ...$params);
155155

system/Database/OCI8/Builder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ protected function _truncate(string $table): string
150150
/**
151151
* Compiles a delete string and runs the query
152152
*
153-
* @param mixed $where
153+
* @param array<int|string, mixed>|RawSql|string $where
154154
*
155155
* @return bool|string
156156
*

system/Database/Postgre/Builder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ protected function _insertBatch(string $table, array $keys, array $values): stri
225225
/**
226226
* Compiles a delete string and runs the query
227227
*
228-
* @param mixed $where
228+
* @param array<int|string, mixed>|RawSql|string $where
229229
*
230230
* @return bool|string
231231
*

system/Database/Postgre/Connection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ public function affectedRows(): int
241241
*
242242
* Escapes data based on type
243243
*
244-
* @param array|bool|float|int|object|string|null $str
244+
* @param mixed $str
245245
*
246246
* @return ($str is array ? array : float|int|string)
247247
*/

0 commit comments

Comments
 (0)