Skip to content

Commit 2c829f3

Browse files
authored
Merge pull request #8645 from kenjis/fix-phpstan-errors-in-app-and-tests
docs: fix phpstan ignored errors in app/ and admin/starter/tests/
2 parents 1c1aefd + 02b0ac8 commit 2c829f3

23 files changed

+92
-347
lines changed

admin/starter/tests/_support/Database/Migrations/2020-02-22-222222_example_migration.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class ExampleMigration extends Migration
88
{
99
protected $DBGroup = 'tests';
1010

11-
public function up()
11+
public function up(): void
1212
{
1313
$this->forge->addField('id');
1414
$this->forge->addField([
@@ -30,7 +30,7 @@ public function up()
3030
$this->forge->createTable('factories');
3131
}
3232

33-
public function down()
33+
public function down(): void
3434
{
3535
$this->forge->dropTable('factories');
3636
}

admin/starter/tests/_support/Database/Seeds/ExampleSeeder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
class ExampleSeeder extends Seeder
88
{
9-
public function run()
9+
public function run(): void
1010
{
1111
$factories = [
1212
[

admin/starter/tests/database/ExampleDatabaseTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ final class ExampleDatabaseTest extends CIUnitTestCase
1414

1515
protected $seed = ExampleSeeder::class;
1616

17-
public function testModelFindAll()
17+
public function testModelFindAll(): void
1818
{
1919
$model = new ExampleModel();
2020

@@ -25,7 +25,7 @@ public function testModelFindAll()
2525
$this->assertCount(3, $objects);
2626
}
2727

28-
public function testSoftDeleteLeavesRow()
28+
public function testSoftDeleteLeavesRow(): void
2929
{
3030
$model = new ExampleModel();
3131
$this->setPrivateProperty($model, 'useSoftDeletes', true);

admin/starter/tests/session/ExampleSessionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*/
99
final class ExampleSessionTest extends CIUnitTestCase
1010
{
11-
public function testSessionSimple()
11+
public function testSessionSimple(): void
1212
{
1313
$session = Services::session();
1414

admin/starter/tests/unit/HealthTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
*/
1111
final class HealthTest extends CIUnitTestCase
1212
{
13-
public function testIsDefinedAppPath()
13+
public function testIsDefinedAppPath(): void
1414
{
1515
$this->assertTrue(defined('APPPATH'));
1616
}
1717

18-
public function testBaseUrlHasBeenSet()
18+
public function testBaseUrlHasBeenSet(): void
1919
{
2020
$validation = Services::validation();
2121

app/Config/ContentSecurityPolicy.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ class ContentSecurityPolicy extends BaseConfig
122122
* The frame-src directive restricts the URLs which may
123123
* be loaded into nested browsing contexts.
124124
*
125-
* @var array|string|null
125+
* @var list<string>|string|null
126126
*/
127127
public $frameSrc;
128128

app/Config/Database.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ class Database extends Config
2323

2424
/**
2525
* The default database connection.
26+
*
27+
* @var array<string, mixed>
2628
*/
2729
public array $default = [
2830
'DSN' => '',
@@ -48,6 +50,8 @@ class Database extends Config
4850
/**
4951
* This database connection is used when
5052
* running PHPUnit database tests.
53+
*
54+
* @var array<string, mixed>
5155
*/
5256
public array $tests = [
5357
'DSN' => '',

app/Config/Exceptions.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ class Exceptions extends BaseConfig
3030
* --------------------------------------------------------------------------
3131
* Any status codes here will NOT be logged if logging is turned on.
3232
* By default, only 404 (Page Not Found) exceptions are ignored.
33+
*
34+
* @var list<int>
3335
*/
3436
public array $ignoreCodes = [404];
3537

@@ -51,6 +53,8 @@ class Exceptions extends BaseConfig
5153
* Any data that you would like to hide from the debug trace.
5254
* In order to specify 2 levels, use "/" to separate.
5355
* ex. ['server', 'setup/password', 'secret_token']
56+
*
57+
* @var list<string>
5458
*/
5559
public array $sensitiveDataInTrace = [];
5660

app/Config/Filters.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ class Filters extends BaseConfig
5555
* If you use this, you should disable auto-routing because auto-routing
5656
* permits any HTTP method to access a controller. Accessing the controller
5757
* with a method you don't expect could bypass the filter.
58+
*
59+
* @var array<string, list<string>>
5860
*/
5961
public array $methods = [];
6062

@@ -64,6 +66,8 @@ class Filters extends BaseConfig
6466
*
6567
* Example:
6668
* 'isLoggedIn' => ['before' => ['account/*', 'profiles/*']]
69+
*
70+
* @var array<string, array<string, list<string>>>
6771
*/
6872
public array $filters = [];
6973
}

app/Config/Logger.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class Logger extends BaseConfig
3636
* For a live site you'll usually enable Critical or higher (3) to be logged otherwise
3737
* your log files will fill up very fast.
3838
*
39-
* @var array|int
39+
* @var int|list<int>
4040
*/
4141
public $threshold = (ENVIRONMENT === 'production') ? 4 : 9;
4242

@@ -72,6 +72,8 @@ class Logger extends BaseConfig
7272
*
7373
* Handlers are executed in the order defined in this array, starting with
7474
* the handler on top and continuing down.
75+
*
76+
* @var array<class-string, array<string, int|list<string>|string>>
7577
*/
7678
public array $handlers = [
7779
/*

0 commit comments

Comments
 (0)