Skip to content

Commit 66a8970

Browse files
michalsnchristianberkman
authored andcommitted
chore: fix PHPStan, Rector and tests (#1310)
* fix PHPStan and apply Rector rules * fix tests * test with PHP 8.5 * update workflows * make test executable fo lower CI versions * update rector config
1 parent 4302890 commit 66a8970

File tree

16 files changed

+48
-60
lines changed

16 files changed

+48
-60
lines changed

.github/workflows/deptrac.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ on:
2020

2121
jobs:
2222
deptrac:
23-
uses: codeigniter4/.github/.github/workflows/deptrac.yml@CI46
23+
uses: codeigniter4/.github/.github/workflows/deptrac.yml@CI47

.github/workflows/phpcpd.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ on:
1616

1717
jobs:
1818
phpcpd:
19-
uses: codeigniter4/.github/.github/workflows/phpcpd.yml@CI46
19+
uses: codeigniter4/.github/.github/workflows/phpcpd.yml@CI47
2020
with:
2121
dirs: "src/ tests/"
2222
options: "--exclude src/Database/Migrations/2020-12-28-223112_create_auth_tables.php --exclude src/Authentication/Authenticators/HmacSha256.php --exclude tests/Authentication/Authenticators/AccessTokenAuthenticatorTest.php"

.github/workflows/phpcsfixer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ on:
1616

1717
jobs:
1818
phpcsfixer:
19-
uses: codeigniter4/.github/.github/workflows/phpcsfixer.yml@CI46
19+
uses: codeigniter4/.github/.github/workflows/phpcsfixer.yml@CI47

.github/workflows/phpstan.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ on:
2020

2121
jobs:
2222
phpstan:
23-
uses: codeigniter4/.github/.github/workflows/phpstan.yml@CI46
23+
uses: codeigniter4/.github/.github/workflows/phpstan.yml@CI47

.github/workflows/phpunit-lowest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ on:
2020

2121
jobs:
2222
phpunit:
23-
uses: codeigniter4/.github/.github/workflows/phpunit-lowest.yml@CI46
23+
uses: codeigniter4/.github/.github/workflows/phpunit-lowest.yml@CI47

.github/workflows/phpunit.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
phpunit:
2323
strategy:
2424
matrix:
25-
php-version: ['8.1', '8.2', '8.3', '8.4']
25+
php-version: ['8.2', '8.3', '8.4', '8.5']
2626
db-platform: ['MySQLi', 'SQLite3']
2727
mysql-version: ['8.0']
2828
dependencies: ['highest']
@@ -44,7 +44,7 @@ jobs:
4444
db-platform: OCI8
4545
mysql-version: '8.0'
4646

47-
uses: codeigniter4/.github/.github/workflows/phpunit.yml@CI46
47+
uses: codeigniter4/.github/.github/workflows/phpunit.yml@CI47
4848
with:
4949
php-version: ${{ matrix.php-version }}
5050
db-platform: ${{ matrix.db-platform }}

.github/workflows/psalm.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ on:
2020

2121
jobs:
2222
psalm:
23-
uses: codeigniter4/.github/.github/workflows/psalm.yml@CI46
23+
uses: codeigniter4/.github/.github/workflows/psalm.yml@CI47

.github/workflows/rector.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ on:
2020

2121
jobs:
2222
rector:
23-
uses: codeigniter4/.github/.github/workflows/rector.yml@CI46
23+
uses: codeigniter4/.github/.github/workflows/rector.yml@CI47

.github/workflows/unused.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ on:
1818

1919
jobs:
2020
unused:
21-
uses: codeigniter4/.github/.github/workflows/unused.yml@CI46
21+
uses: codeigniter4/.github/.github/workflows/unused.yml@CI47

phpstan-baseline.php

Lines changed: 18 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
<?php declare(strict_types = 1);
22

33
$ignoreErrors = [];
4-
$ignoreErrors[] = [
5-
'rawMessage' => 'Call to deprecated function random_string():
6-
The type \'basic\', \'md5\', and \'sha1\' are deprecated. They are not cryptographically secure.',
7-
'identifier' => 'function.deprecated',
8-
'count' => 1,
9-
'path' => __DIR__ . '/src/Authentication/Actions/Email2FA.php',
10-
];
114
$ignoreErrors[] = [
125
'rawMessage' => 'Call to function model with CodeIgniter\\Shield\\Models\\UserIdentityModel::class is discouraged.',
136
'identifier' => 'codeigniter.factoriesClassConstFetch',
@@ -20,13 +13,6 @@
2013
'count' => 1,
2114
'path' => __DIR__ . '/src/Authentication/Actions/Email2FA.php',
2215
];
23-
$ignoreErrors[] = [
24-
'rawMessage' => 'Call to deprecated function random_string():
25-
The type \'basic\', \'md5\', and \'sha1\' are deprecated. They are not cryptographically secure.',
26-
'identifier' => 'function.deprecated',
27-
'count' => 1,
28-
'path' => __DIR__ . '/src/Authentication/Actions/EmailActivator.php',
29-
];
3016
$ignoreErrors[] = [
3117
'rawMessage' => 'Call to function model with CodeIgniter\\Shield\\Models\\UserIdentityModel::class is discouraged.',
3218
'identifier' => 'codeigniter.factoriesClassConstFetch',
@@ -141,12 +127,6 @@
141127
'count' => 4,
142128
'path' => __DIR__ . '/src/Authentication/Passwords/NothingPersonalValidator.php',
143129
];
144-
$ignoreErrors[] = [
145-
'rawMessage' => 'PHPDoc tag @var with type string is not subtype of type uppercase-string.',
146-
'identifier' => 'varTag.type',
147-
'count' => 1,
148-
'path' => __DIR__ . '/src/Authentication/Passwords/PwnedValidator.php',
149-
];
150130
$ignoreErrors[] = [
151131
'rawMessage' => 'Only booleans are allowed in &&, CodeIgniter\\Shield\\Entities\\User|null given on the right side.',
152132
'identifier' => 'booleanAnd.rightNotBoolean',
@@ -195,13 +175,6 @@
195175
'count' => 9,
196176
'path' => __DIR__ . '/src/Commands/User.php',
197177
];
198-
$ignoreErrors[] = [
199-
'rawMessage' => 'Call to deprecated function random_string():
200-
The type \'basic\', \'md5\', and \'sha1\' are deprecated. They are not cryptographically secure.',
201-
'identifier' => 'function.deprecated',
202-
'count' => 1,
203-
'path' => __DIR__ . '/src/Controllers/MagicLinkController.php',
204-
];
205178
$ignoreErrors[] = [
206179
'rawMessage' => 'Call to function model with CodeIgniter\\Shield\\Models\\LoginModel::class is discouraged.',
207180
'identifier' => 'codeigniter.factoriesClassConstFetch',
@@ -388,20 +361,6 @@
388361
'count' => 1,
389362
'path' => __DIR__ . '/src/Filters/TokenAuth.php',
390363
];
391-
$ignoreErrors[] = [
392-
'rawMessage' => 'Call to deprecated function random_string():
393-
The type \'basic\', \'md5\', and \'sha1\' are deprecated. They are not cryptographically secure.',
394-
'identifier' => 'function.deprecated',
395-
'count' => 1,
396-
'path' => __DIR__ . '/src/Models/TokenLoginModel.php',
397-
];
398-
$ignoreErrors[] = [
399-
'rawMessage' => 'Call to deprecated function random_string():
400-
The type \'basic\', \'md5\', and \'sha1\' are deprecated. They are not cryptographically secure.',
401-
'identifier' => 'function.deprecated',
402-
'count' => 1,
403-
'path' => __DIR__ . '/src/Models/UserIdentityModel.php',
404-
];
405364
$ignoreErrors[] = [
406365
'rawMessage' => 'Call to function model with CodeIgniter\\Shield\\Models\\GroupModel::class is discouraged.',
407366
'identifier' => 'codeigniter.factoriesClassConstFetch',
@@ -462,6 +421,24 @@
462421
'count' => 8,
463422
'path' => __DIR__ . '/tests/Authentication/Authenticators/SessionAuthenticatorTest.php',
464423
];
424+
$ignoreErrors[] = [
425+
'rawMessage' => 'Call to method setCookie() of internal class CodeIgniter\\Superglobals from outside its root namespace CodeIgniter.',
426+
'identifier' => 'method.internalClass',
427+
'count' => 1,
428+
'path' => __DIR__ . '/tests/Authentication/Authenticators/SessionAuthenticatorTest.php',
429+
];
430+
$ignoreErrors[] = [
431+
'rawMessage' => 'Parameter #1 $headers of method Tests\\Authentication\\Filters\\AbstractFilterTestCase::withHeaders() expects array<string, CodeIgniter\\HTTP\\Header|list<CodeIgniter\\HTTP\\Header>>, array{Authorization: non-falsy-string} given.',
432+
'identifier' => 'argument.type',
433+
'count' => 7,
434+
'path' => __DIR__ . '/tests/Authentication/Filters/HmacFilterTest.php',
435+
];
436+
$ignoreErrors[] = [
437+
'rawMessage' => 'Parameter #1 $headers of method Tests\\Authentication\\Filters\\JWTFilterTest::withHeaders() expects array<string, CodeIgniter\\HTTP\\Header|list<CodeIgniter\\HTTP\\Header>>, array{Authorization: non-falsy-string} given.',
438+
'identifier' => 'argument.type',
439+
'count' => 1,
440+
'path' => __DIR__ . '/tests/Authentication/Filters/JWTFilterTest.php',
441+
];
465442
$ignoreErrors[] = [
466443
'rawMessage' => 'Implicit array creation is not allowed - variable $users might not exist.',
467444
'identifier' => 'variable.implicitArray',

0 commit comments

Comments
 (0)