Skip to content

Commit a0600be

Browse files
committed
docs: update/add PHPDoc types
1 parent 0226cc2 commit a0600be

File tree

7 files changed

+53
-11
lines changed

7 files changed

+53
-11
lines changed

system/BaseModel.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ abstract class BaseModel
9898
* An array of field names that are allowed
9999
* to be set by the user in inserts/updates.
100100
*
101-
* @var array
101+
* @var list<string>
102102
*/
103103
protected $allowedFields = [];
104104

@@ -177,15 +177,15 @@ abstract class BaseModel
177177
* The array must match the format of data passed to the Validation
178178
* library.
179179
*
180-
* @var array|string
180+
* @var list<string>|string
181181
*/
182182
protected $validationRules = [];
183183

184184
/**
185185
* Contains any custom error messages to be
186186
* used during data validation.
187187
*
188-
* @var array
188+
* @var array<string, array<string, string>>
189189
*/
190190
protected $validationMessages = [];
191191

system/Config/Routing.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ class Routing extends BaseConfig
2222
* found taking precedence.
2323
*
2424
* Default: APPPATH . 'Config/Routes.php'
25+
*
26+
* @var list<string>
2527
*/
2628
public array $routeFiles = [
2729
APPPATH . 'Config/Routes.php',
@@ -104,7 +106,7 @@ class Routing extends BaseConfig
104106
* 'blog' => 'Acme\Blog\Controllers',
105107
* ]
106108
*
107-
* @var array [ uri_segment => namespace ]
109+
* @var array<string, string> [ uri_segment => namespace ]
108110
*/
109111
public array $moduleRoutes = [];
110112
}

system/Controller.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111

1212
namespace CodeIgniter;
1313

14+
use CodeIgniter\HTTP\CLIRequest;
1415
use CodeIgniter\HTTP\Exceptions\HTTPException;
16+
use CodeIgniter\HTTP\IncomingRequest;
1517
use CodeIgniter\HTTP\RequestInterface;
1618
use CodeIgniter\HTTP\ResponseInterface;
1719
use CodeIgniter\Validation\Exceptions\ValidationException;
@@ -30,14 +32,14 @@ class Controller
3032
/**
3133
* Helpers that will be automatically loaded on class instantiation.
3234
*
33-
* @var array
35+
* @var list<string>
3436
*/
3537
protected $helpers = [];
3638

3739
/**
3840
* Instance of the main Request object.
3941
*
40-
* @var RequestInterface
42+
* @var CLIRequest|IncomingRequest
4143
*/
4244
protected $request;
4345

system/Database/Seeder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ public function setSilent(bool $silent)
181181
* Child classes must implement this method and take care
182182
* of inserting their data here.
183183
*
184-
* @return mixed
184+
* @return void
185185
*
186186
* @codeCoverageIgnore
187187
*/

system/HTTP/ContentSecurityPolicy.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ public function upgradeInsecureRequests(bool $value = true)
643643
/**
644644
* DRY method to add an string or array to a class property.
645645
*
646-
* @param array|string $options
646+
* @param list<string>|string $options
647647
*
648648
* @return void
649649
*/

system/Test/CIUnitTestCase.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ abstract class CIUnitTestCase extends TestCase
5050
* WARNING: Do not override unless you know exactly what you are doing.
5151
* This property may be deprecated in the future.
5252
*
53-
* @var array of methods
53+
* @var list<string> array of methods
5454
*/
5555
protected $setUpMethods = [
5656
'resetFactories',
@@ -64,7 +64,7 @@ abstract class CIUnitTestCase extends TestCase
6464
*
6565
* WARNING: This property may be deprecated in the future.
6666
*
67-
* @var array of methods
67+
* @var list<string> array of methods
6868
*/
6969
protected $tearDownMethods = [];
7070

@@ -109,7 +109,7 @@ abstract class CIUnitTestCase extends TestCase
109109
* The seed file(s) used for all tests within this test case.
110110
* Should be fully-namespaced or relative to $basePath
111111
*
112-
* @var array|string
112+
* @var class-string<Seeder>|list<class-string<Seeder>>
113113
*/
114114
protected $seed = '';
115115

system/Test/DatabaseTestTrait.php

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ trait DatabaseTestTrait
4848

4949
/**
5050
* Runs the trait set up methods.
51+
*
52+
* @return void
5153
*/
5254
protected function setUpDatabase()
5355
{
@@ -58,6 +60,8 @@ protected function setUpDatabase()
5860

5961
/**
6062
* Runs the trait set up methods.
63+
*
64+
* @return void
6165
*/
6266
protected function tearDownDatabase()
6367
{
@@ -66,6 +70,8 @@ protected function tearDownDatabase()
6670

6771
/**
6872
* Load any database test dependencies.
73+
*
74+
* @return void
6975
*/
7076
public function loadDependencies()
7177
{
@@ -95,6 +101,8 @@ public function loadDependencies()
95101

96102
/**
97103
* Migrate on setUp
104+
*
105+
* @return void
98106
*/
99107
protected function setUpMigrate()
100108
{
@@ -112,6 +120,8 @@ protected function setUpMigrate()
112120

113121
/**
114122
* Regress migrations as defined by the class
123+
*
124+
* @return void
115125
*/
116126
protected function regressDatabase()
117127
{
@@ -138,6 +148,8 @@ protected function regressDatabase()
138148

139149
/**
140150
* Run migrations as defined by the class
151+
*
152+
* @return void
141153
*/
142154
protected function migrateDatabase()
143155
{
@@ -169,6 +181,8 @@ protected function migrateDatabase()
169181

170182
/**
171183
* Seed on setUp
184+
*
185+
* @return void
172186
*/
173187
protected function setUpSeed()
174188
{
@@ -179,6 +193,8 @@ protected function setUpSeed()
179193

180194
/**
181195
* Run seeds as defined by the class
196+
*
197+
* @return void
182198
*/
183199
protected function runSeeds()
184200
{
@@ -199,6 +215,8 @@ protected function runSeeds()
199215

200216
/**
201217
* Seeds that database with a specific seeder.
218+
*
219+
* @return void
202220
*/
203221
public function seed(string $name)
204222
{
@@ -213,6 +231,8 @@ public function seed(string $name)
213231
* Reset $doneMigration and $doneSeed
214232
*
215233
* @afterClass
234+
*
235+
* @return void
216236
*/
217237
public static function resetMigrationSeedCount()
218238
{
@@ -222,6 +242,8 @@ public static function resetMigrationSeedCount()
222242

223243
/**
224244
* Removes any rows inserted via $this->hasInDatabase()
245+
*
246+
* @return void
225247
*/
226248
protected function clearInsertCache()
227249
{
@@ -248,6 +270,8 @@ public function loadBuilder(string $tableName)
248270
* Fetches a single column from a database row with criteria
249271
* matching $where.
250272
*
273+
* @param array<string, mixed> $where
274+
*
251275
* @return bool
252276
*
253277
* @throws DatabaseException
@@ -272,6 +296,10 @@ public function grabFromDatabase(string $table, string $column, array $where)
272296
* Asserts that records that match the conditions in $where DO
273297
* exist in the database.
274298
*
299+
* @param array<string, mixed> $where
300+
*
301+
* @return void
302+
*
275303
* @throws DatabaseException
276304
*/
277305
public function seeInDatabase(string $table, array $where)
@@ -283,6 +311,10 @@ public function seeInDatabase(string $table, array $where)
283311
/**
284312
* Asserts that records that match the conditions in $where do
285313
* not exist in the database.
314+
*
315+
* @param array<string, mixed> $where
316+
*
317+
* @return void
286318
*/
287319
public function dontSeeInDatabase(string $table, array $where)
288320
{
@@ -297,6 +329,8 @@ public function dontSeeInDatabase(string $table, array $where)
297329
* Inserts a row into to the database. This row will be removed
298330
* after the test has run.
299331
*
332+
* @param array<string, mixed> $data
333+
*
300334
* @return bool
301335
*/
302336
public function hasInDatabase(string $table, array $data)
@@ -313,6 +347,10 @@ public function hasInDatabase(string $table, array $data)
313347
* Asserts that the number of rows in the database that match $where
314348
* is equal to $expected.
315349
*
350+
* @param array<string, mixed> $where
351+
*
352+
* @return void
353+
*
316354
* @throws DatabaseException
317355
*/
318356
public function seeNumRecords(int $expected, string $table, array $where)

0 commit comments

Comments
 (0)