Skip to content

Commit df8c1d4

Browse files
authored
Merge pull request #836 from kenjis/add-phpstan-strict-rules
chore: add phpstan-strict-rules
2 parents 4f1e1a0 + 3aaca03 commit df8c1d4

File tree

4 files changed

+284
-1
lines changed

4 files changed

+284
-1
lines changed

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
"firebase/php-jwt": "^6.4",
3030
"rector/rector": "0.18.3",
3131
"codeigniter/phpstan-codeigniter": "^1.1",
32-
"phpstan/extension-installer": "^1.3"
32+
"phpstan/extension-installer": "^1.3",
33+
"phpstan/phpstan-strict-rules": "^1.5"
3334
},
3435
"provide": {
3536
"codeigniter4/authentication-implementation": "1.0"

phpstan-baseline.php

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

33
$ignoreErrors = [];
4+
$ignoreErrors[] = [
5+
'message' => '#^Call to function property_exists\\(\\) with CodeIgniter\\\\Shield\\\\Config\\\\Auth and \'userProvider\' will always evaluate to true\\.$#',
6+
'count' => 1,
7+
'path' => __DIR__ . '/src/Auth.php',
8+
];
9+
$ignoreErrors[] = [
10+
'message' => '#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#',
11+
'count' => 1,
12+
'path' => __DIR__ . '/src/Auth.php',
13+
];
14+
$ignoreErrors[] = [
15+
'message' => '#^Only booleans are allowed in a ternary operator condition, CodeIgniter\\\\Shield\\\\Entities\\\\User\\|null given\\.$#',
16+
'count' => 1,
17+
'path' => __DIR__ . '/src/Auth.php',
18+
];
419
$ignoreErrors[] = [
520
'message' => '#^Call to deprecated function random_string\\(\\)\\:
621
The type \'basic\', \'md5\', and \'sha1\' are deprecated\\. They are not cryptographically secure\\.$#',
722
'count' => 1,
823
'path' => __DIR__ . '/src/Authentication/Actions/Email2FA.php',
924
];
25+
$ignoreErrors[] = [
26+
'message' => '#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#',
27+
'count' => 2,
28+
'path' => __DIR__ . '/src/Authentication/Actions/Email2FA.php',
29+
];
1030
$ignoreErrors[] = [
1131
'message' => '#^Call to deprecated function random_string\\(\\)\\:
1232
The type \'basic\', \'md5\', and \'sha1\' are deprecated\\. They are not cryptographically secure\\.$#',
1333
'count' => 1,
1434
'path' => __DIR__ . '/src/Authentication/Actions/EmailActivator.php',
1535
];
36+
$ignoreErrors[] = [
37+
'message' => '#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#',
38+
'count' => 1,
39+
'path' => __DIR__ . '/src/Authentication/Authentication.php',
40+
];
41+
$ignoreErrors[] = [
42+
'message' => '#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#',
43+
'count' => 4,
44+
'path' => __DIR__ . '/src/Authentication/Authenticators/AccessTokens.php',
45+
];
46+
$ignoreErrors[] = [
47+
'message' => '#^Only booleans are allowed in &&, CodeIgniter\\\\I18n\\\\Time\\|null given on the left side\\.$#',
48+
'count' => 1,
49+
'path' => __DIR__ . '/src/Authentication/Authenticators/AccessTokens.php',
50+
];
51+
$ignoreErrors[] = [
52+
'message' => '#^Parameter \\#1 \\$credentials \\(array\\{token\\?\\: string\\}\\) of method CodeIgniter\\\\Shield\\\\Authentication\\\\Authenticators\\\\JWT\\:\\:attempt\\(\\) should be contravariant with parameter \\$credentials \\(array\\) of method CodeIgniter\\\\Shield\\\\Authentication\\\\AuthenticatorInterface\\:\\:attempt\\(\\)$#',
53+
'count' => 1,
54+
'path' => __DIR__ . '/src/Authentication/Authenticators/JWT.php',
55+
];
56+
$ignoreErrors[] = [
57+
'message' => '#^Parameter \\#1 \\$credentials \\(array\\{token\\?\\: string\\}\\) of method CodeIgniter\\\\Shield\\\\Authentication\\\\Authenticators\\\\JWT\\:\\:check\\(\\) should be contravariant with parameter \\$credentials \\(array\\) of method CodeIgniter\\\\Shield\\\\Authentication\\\\AuthenticatorInterface\\:\\:check\\(\\)$#',
58+
'count' => 1,
59+
'path' => __DIR__ . '/src/Authentication/Authenticators/JWT.php',
60+
];
61+
$ignoreErrors[] = [
62+
'message' => '#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#',
63+
'count' => 3,
64+
'path' => __DIR__ . '/src/Authentication/Authenticators/Session.php',
65+
];
66+
$ignoreErrors[] = [
67+
'message' => '#^Only booleans are allowed in an elseif condition, string\\|null given\\.$#',
68+
'count' => 1,
69+
'path' => __DIR__ . '/src/Authentication/Authenticators/Session.php',
70+
];
71+
$ignoreErrors[] = [
72+
'message' => '#^Only booleans are allowed in an if condition, CodeIgniter\\\\Shield\\\\Entities\\\\UserIdentity\\|null given\\.$#',
73+
'count' => 1,
74+
'path' => __DIR__ . '/src/Authentication/Authenticators/Session.php',
75+
];
76+
$ignoreErrors[] = [
77+
'message' => '#^Only booleans are allowed in an if condition, int\\|string\\|null given\\.$#',
78+
'count' => 3,
79+
'path' => __DIR__ . '/src/Authentication/Authenticators/Session.php',
80+
];
81+
$ignoreErrors[] = [
82+
'message' => '#^Parameter \\#1 \\$credentials \\(array\\{email\\?\\: string, username\\?\\: string, password\\?\\: string\\}\\) of method CodeIgniter\\\\Shield\\\\Authentication\\\\Authenticators\\\\Session\\:\\:attempt\\(\\) should be contravariant with parameter \\$credentials \\(array\\) of method CodeIgniter\\\\Shield\\\\Authentication\\\\AuthenticatorInterface\\:\\:attempt\\(\\)$#',
83+
'count' => 1,
84+
'path' => __DIR__ . '/src/Authentication/Authenticators/Session.php',
85+
];
86+
$ignoreErrors[] = [
87+
'message' => '#^Parameter \\#1 \\$credentials \\(array\\{email\\?\\: string, username\\?\\: string, password\\?\\: string\\}\\) of method CodeIgniter\\\\Shield\\\\Authentication\\\\Authenticators\\\\Session\\:\\:check\\(\\) should be contravariant with parameter \\$credentials \\(array\\) of method CodeIgniter\\\\Shield\\\\Authentication\\\\AuthenticatorInterface\\:\\:check\\(\\)$#',
88+
'count' => 1,
89+
'path' => __DIR__ . '/src/Authentication/Authenticators/Session.php',
90+
];
91+
$ignoreErrors[] = [
92+
'message' => '#^Call to method CodeIgniter\\\\Shield\\\\Result\\:\\:isOK\\(\\) with incorrect case\\: isOk$#',
93+
'count' => 1,
94+
'path' => __DIR__ . '/src/Authentication/Passwords.php',
95+
];
96+
$ignoreErrors[] = [
97+
'message' => '#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#',
98+
'count' => 1,
99+
'path' => __DIR__ . '/src/Authentication/Passwords.php',
100+
];
101+
$ignoreErrors[] = [
102+
'message' => '#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#',
103+
'count' => 1,
104+
'path' => __DIR__ . '/src/Authentication/Passwords/CompositionValidator.php',
105+
];
106+
$ignoreErrors[] = [
107+
'message' => '#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#',
108+
'count' => 5,
109+
'path' => __DIR__ . '/src/Authentication/Passwords/NothingPersonalValidator.php',
110+
];
111+
$ignoreErrors[] = [
112+
'message' => '#^Call to method CodeIgniter\\\\Shield\\\\Result\\:\\:isOK\\(\\) with incorrect case\\: isOk$#',
113+
'count' => 2,
114+
'path' => __DIR__ . '/src/Authentication/Passwords/ValidationRules.php',
115+
];
116+
$ignoreErrors[] = [
117+
'message' => '#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#',
118+
'count' => 1,
119+
'path' => __DIR__ . '/src/Authentication/Passwords/ValidationRules.php',
120+
];
121+
$ignoreErrors[] = [
122+
'message' => '#^Only booleans are allowed in &&, CodeIgniter\\\\Shield\\\\Entities\\\\User\\|null given on the right side\\.$#',
123+
'count' => 1,
124+
'path' => __DIR__ . '/src/Authentication/Passwords/ValidationRules.php',
125+
];
126+
$ignoreErrors[] = [
127+
'message' => '#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#',
128+
'count' => 3,
129+
'path' => __DIR__ . '/src/Authorization/Groups.php',
130+
];
131+
$ignoreErrors[] = [
132+
'message' => '#^Return type \\(int\\|string\\|null\\) of method CodeIgniter\\\\Shield\\\\Collectors\\\\Auth\\:\\:getBadgeValue\\(\\) should be covariant with return type \\(int\\|null\\) of method CodeIgniter\\\\Debug\\\\Toolbar\\\\Collectors\\\\BaseCollector\\:\\:getBadgeValue\\(\\)$#',
133+
'count' => 1,
134+
'path' => __DIR__ . '/src/Collectors/Auth.php',
135+
];
136+
$ignoreErrors[] = [
137+
'message' => '#^PHPDoc type array\\<string, string\\> of property CodeIgniter\\\\Shield\\\\Commands\\\\Generators\\\\UserModelGenerator\\:\\:\\$arguments is not the same as PHPDoc type array of overridden property CodeIgniter\\\\CLI\\\\BaseCommand\\:\\:\\$arguments\\.$#',
138+
'count' => 1,
139+
'path' => __DIR__ . '/src/Commands/Generators/UserModelGenerator.php',
140+
];
141+
$ignoreErrors[] = [
142+
'message' => '#^PHPDoc type array\\<string, string\\> of property CodeIgniter\\\\Shield\\\\Commands\\\\Generators\\\\UserModelGenerator\\:\\:\\$options is not the same as PHPDoc type array of overridden property CodeIgniter\\\\CLI\\\\BaseCommand\\:\\:\\$options\\.$#',
143+
'count' => 1,
144+
'path' => __DIR__ . '/src/Commands/Generators/UserModelGenerator.php',
145+
];
146+
$ignoreErrors[] = [
147+
'message' => '#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#',
148+
'count' => 1,
149+
'path' => __DIR__ . '/src/Controllers/ActionController.php',
150+
];
151+
$ignoreErrors[] = [
152+
'message' => '#^Instanceof between CodeIgniter\\\\Shield\\\\Authentication\\\\Actions\\\\ActionInterface and CodeIgniter\\\\Shield\\\\Authentication\\\\Actions\\\\ActionInterface will always evaluate to true\\.$#',
153+
'count' => 1,
154+
'path' => __DIR__ . '/src/Controllers/ActionController.php',
155+
];
16156
$ignoreErrors[] = [
17157
'message' => '#^Call to deprecated function random_string\\(\\)\\:
18158
The type \'basic\', \'md5\', and \'sha1\' are deprecated\\. They are not cryptographically secure\\.$#',
@@ -44,11 +184,66 @@
44184
'count' => 1,
45185
'path' => __DIR__ . '/src/Database/Migrations/2020-12-28-223112_create_auth_tables.php',
46186
];
187+
$ignoreErrors[] = [
188+
'message' => '#^Parameter \\#1 \\$value \\(bool\\|int\\|string\\) of method CodeIgniter\\\\Shield\\\\Entities\\\\Cast\\\\IntBoolCast\\:\\:set\\(\\) should be contravariant with parameter \\$value \\(array\\|bool\\|float\\|int\\|object\\|string\\|null\\) of method CodeIgniter\\\\Entity\\\\Cast\\\\BaseCast\\:\\:set\\(\\)$#',
189+
'count' => 1,
190+
'path' => __DIR__ . '/src/Entities/Cast/IntBoolCast.php',
191+
];
192+
$ignoreErrors[] = [
193+
'message' => '#^Parameter \\#1 \\$value \\(bool\\|int\\|string\\) of method CodeIgniter\\\\Shield\\\\Entities\\\\Cast\\\\IntBoolCast\\:\\:set\\(\\) should be contravariant with parameter \\$value \\(array\\|bool\\|float\\|int\\|object\\|string\\|null\\) of method CodeIgniter\\\\Entity\\\\Cast\\\\CastInterface\\:\\:set\\(\\)$#',
194+
'count' => 1,
195+
'path' => __DIR__ . '/src/Entities/Cast/IntBoolCast.php',
196+
];
197+
$ignoreErrors[] = [
198+
'message' => '#^Parameter \\#1 \\$value \\(int\\) of method CodeIgniter\\\\Shield\\\\Entities\\\\Cast\\\\IntBoolCast\\:\\:get\\(\\) should be contravariant with parameter \\$value \\(array\\|bool\\|float\\|int\\|object\\|string\\|null\\) of method CodeIgniter\\\\Entity\\\\Cast\\\\BaseCast\\:\\:get\\(\\)$#',
199+
'count' => 1,
200+
'path' => __DIR__ . '/src/Entities/Cast/IntBoolCast.php',
201+
];
202+
$ignoreErrors[] = [
203+
'message' => '#^Parameter \\#1 \\$value \\(int\\) of method CodeIgniter\\\\Shield\\\\Entities\\\\Cast\\\\IntBoolCast\\:\\:get\\(\\) should be contravariant with parameter \\$value \\(array\\|bool\\|float\\|int\\|object\\|string\\|null\\) of method CodeIgniter\\\\Entity\\\\Cast\\\\CastInterface\\:\\:get\\(\\)$#',
204+
'count' => 1,
205+
'path' => __DIR__ . '/src/Entities/Cast/IntBoolCast.php',
206+
];
207+
$ignoreErrors[] = [
208+
'message' => '#^PHPDoc type array\\<string, class\\-string\\> of property CodeIgniter\\\\Shield\\\\Entities\\\\Entity\\:\\:\\$castHandlers is not the same as PHPDoc type array\\<string, string\\> of overridden property CodeIgniter\\\\Entity\\\\Entity\\:\\:\\$castHandlers\\.$#',
209+
'count' => 1,
210+
'path' => __DIR__ . '/src/Entities/Entity.php',
211+
];
212+
$ignoreErrors[] = [
213+
'message' => '#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#',
214+
'count' => 2,
215+
'path' => __DIR__ . '/src/Entities/Group.php',
216+
];
217+
$ignoreErrors[] = [
218+
'message' => '#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#',
219+
'count' => 8,
220+
'path' => __DIR__ . '/src/Entities/User.php',
221+
];
222+
$ignoreErrors[] = [
223+
'message' => '#^Only booleans are allowed in a ternary operator condition, int\\<0, max\\> given\\.$#',
224+
'count' => 1,
225+
'path' => __DIR__ . '/src/Entities/User.php',
226+
];
227+
$ignoreErrors[] = [
228+
'message' => '#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#',
229+
'count' => 1,
230+
'path' => __DIR__ . '/src/Filters/AbstractAuthFilter.php',
231+
];
47232
$ignoreErrors[] = [
48233
'message' => '#^Method CodeIgniter\\\\Shield\\\\Filters\\\\AuthRates\\:\\:before\\(\\) should return CodeIgniter\\\\HTTP\\\\RedirectResponse\\|void but returns CodeIgniter\\\\HTTP\\\\ResponseInterface\\.$#',
49234
'count' => 1,
50235
'path' => __DIR__ . '/src/Filters/AuthRates.php',
51236
];
237+
$ignoreErrors[] = [
238+
'message' => '#^Call to method CodeIgniter\\\\HTTP\\\\ResponseInterface\\:\\:setJSON\\(\\) with incorrect case\\: setJson$#',
239+
'count' => 2,
240+
'path' => __DIR__ . '/src/Filters/TokenAuth.php',
241+
];
242+
$ignoreErrors[] = [
243+
'message' => '#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#',
244+
'count' => 1,
245+
'path' => __DIR__ . '/src/Filters/TokenAuth.php',
246+
];
52247
$ignoreErrors[] = [
53248
'message' => '#^Method CodeIgniter\\\\Shield\\\\Filters\\\\TokenAuth\\:\\:before\\(\\) should return CodeIgniter\\\\HTTP\\\\RedirectResponse\\|void but returns CodeIgniter\\\\HTTP\\\\ResponseInterface\\.$#',
54249
'count' => 2,
@@ -76,21 +271,81 @@
76271
'count' => 1,
77272
'path' => __DIR__ . '/src/Models/UserIdentityModel.php',
78273
];
274+
$ignoreErrors[] = [
275+
'message' => '#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#',
276+
'count' => 2,
277+
'path' => __DIR__ . '/src/Models/UserModel.php',
278+
];
279+
$ignoreErrors[] = [
280+
'message' => '#^Parameter \\#1 \\$data \\(array\\|CodeIgniter\\\\Shield\\\\Entities\\\\User\\) of method CodeIgniter\\\\Shield\\\\Models\\\\UserModel\\:\\:insert\\(\\) should be contravariant with parameter \\$data \\(array\\|object\\|null\\) of method CodeIgniter\\\\Model\\:\\:insert\\(\\)$#',
281+
'count' => 1,
282+
'path' => __DIR__ . '/src/Models/UserModel.php',
283+
];
284+
$ignoreErrors[] = [
285+
'message' => '#^Parameter \\#1 \\$data \\(array\\|CodeIgniter\\\\Shield\\\\Entities\\\\User\\) of method CodeIgniter\\\\Shield\\\\Models\\\\UserModel\\:\\:save\\(\\) should be contravariant with parameter \\$data \\(array\\|object\\) of method CodeIgniter\\\\BaseModel\\:\\:save\\(\\)$#',
286+
'count' => 1,
287+
'path' => __DIR__ . '/src/Models/UserModel.php',
288+
];
289+
$ignoreErrors[] = [
290+
'message' => '#^Parameter \\#2 \\$data \\(array\\|CodeIgniter\\\\Shield\\\\Entities\\\\User\\) of method CodeIgniter\\\\Shield\\\\Models\\\\UserModel\\:\\:update\\(\\) should be contravariant with parameter \\$data \\(array\\|object\\|null\\) of method CodeIgniter\\\\Model\\:\\:update\\(\\)$#',
291+
'count' => 1,
292+
'path' => __DIR__ . '/src/Models/UserModel.php',
293+
];
294+
$ignoreErrors[] = [
295+
'message' => '#^Return type \\(int\\|string\\|true\\) of method CodeIgniter\\\\Shield\\\\Models\\\\UserModel\\:\\:insert\\(\\) should be covariant with return type \\(int\\|object\\|string\\|false\\) of method CodeIgniter\\\\Model\\:\\:insert\\(\\)$#',
296+
'count' => 1,
297+
'path' => __DIR__ . '/src/Models/UserModel.php',
298+
];
79299
$ignoreErrors[] = [
80300
'message' => '#^Cannot access property \\$id on array\\|object\\.$#',
81301
'count' => 2,
82302
'path' => __DIR__ . '/tests/Authentication/AuthHelperTest.php',
83303
];
304+
$ignoreErrors[] = [
305+
'message' => '#^Call to method PHPUnit\\\\Framework\\\\Assert\\:\\:assertInstanceOf\\(\\) with \'CodeIgniter\\\\\\\\Shield\\\\\\\\Result\' and CodeIgniter\\\\Shield\\\\Result will always evaluate to true\\.$#',
306+
'count' => 2,
307+
'path' => __DIR__ . '/tests/Authentication/Authenticators/AccessTokenAuthenticatorTest.php',
308+
];
84309
$ignoreErrors[] = [
85310
'message' => '#^Cannot access property \\$id on array\\|object\\.$#',
86311
'count' => 2,
87312
'path' => __DIR__ . '/tests/Authentication/Authenticators/AccessTokenAuthenticatorTest.php',
88313
];
314+
$ignoreErrors[] = [
315+
'message' => '#^Call to method PHPUnit\\\\Framework\\\\Assert\\:\\:assertInstanceOf\\(\\) with \'CodeIgniter\\\\\\\\Shield\\\\\\\\Result\' and CodeIgniter\\\\Shield\\\\Result will always evaluate to true\\.$#',
316+
'count' => 3,
317+
'path' => __DIR__ . '/tests/Authentication/Authenticators/JWTAuthenticatorTest.php',
318+
];
319+
$ignoreErrors[] = [
320+
'message' => '#^Call to method PHPUnit\\\\Framework\\\\Assert\\:\\:assertInstanceOf\\(\\) with \'CodeIgniter\\\\\\\\Shield\\\\\\\\Result\' and CodeIgniter\\\\Shield\\\\Result will always evaluate to true\\.$#',
321+
'count' => 9,
322+
'path' => __DIR__ . '/tests/Authentication/Authenticators/SessionAuthenticatorTest.php',
323+
];
324+
$ignoreErrors[] = [
325+
'message' => '#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#',
326+
'count' => 1,
327+
'path' => __DIR__ . '/tests/Authentication/Filters/AbstractFilterTestCase.php',
328+
];
89329
$ignoreErrors[] = [
90330
'message' => '#^Cannot access property \\$id on array\\|object\\.$#',
91331
'count' => 6,
92332
'path' => __DIR__ . '/tests/Authentication/Filters/SessionFilterTest.php',
93333
];
334+
$ignoreErrors[] = [
335+
'message' => '#^Implicit array creation is not allowed \\- variable \\$users might not exist\\.$#',
336+
'count' => 1,
337+
'path' => __DIR__ . '/tests/Authentication/ForcePasswordResetTest.php',
338+
];
339+
$ignoreErrors[] = [
340+
'message' => '#^Variable \\$users might not be defined\\.$#',
341+
'count' => 1,
342+
'path' => __DIR__ . '/tests/Authentication/ForcePasswordResetTest.php',
343+
];
344+
$ignoreErrors[] = [
345+
'message' => '#^Call to method PHPUnit\\\\Framework\\\\Assert\\:\\:assertInstanceOf\\(\\) with \'CodeIgniter\\\\\\\\Shield\\\\\\\\Entities\\\\\\\\AccessToken\' and CodeIgniter\\\\Shield\\\\Entities\\\\AccessToken will always evaluate to true\\.$#',
346+
'count' => 1,
347+
'path' => __DIR__ . '/tests/Authentication/HasAccessTokensTest.php',
348+
];
94349
$ignoreErrors[] = [
95350
'message' => '#^Cannot access property \\$id on array\\|object\\.$#',
96351
'count' => 2,
@@ -101,6 +356,16 @@
101356
'count' => 4,
102357
'path' => __DIR__ . '/tests/Authorization/AuthorizableTest.php',
103358
];
359+
$ignoreErrors[] = [
360+
'message' => '#^Only booleans are allowed in a ternary operator condition, string\\|null given\\.$#',
361+
'count' => 2,
362+
'path' => __DIR__ . '/tests/Language/AbstractTranslationTestCase.php',
363+
];
364+
$ignoreErrors[] = [
365+
'message' => '#^Call to method PHPUnit\\\\Framework\\\\Assert\\:\\:assertIsString\\(\\) with string will always evaluate to true\\.$#',
366+
'count' => 6,
367+
'path' => __DIR__ . '/tests/Unit/Authentication/JWT/JWTManagerTest.php',
368+
];
104369
$ignoreErrors[] = [
105370
'message' => '#^Cannot access property \\$id on array\\|object\\.$#',
106371
'count' => 1,
@@ -111,6 +376,11 @@
111376
'count' => 1,
112377
'path' => __DIR__ . '/tests/Unit/UserTest.php',
113378
];
379+
$ignoreErrors[] = [
380+
'message' => '#^Call to method PHPUnit\\\\Framework\\\\Assert\\:\\:assertInstanceOf\\(\\) with \'CodeIgniter\\\\\\\\Shield\\\\\\\\Entities\\\\\\\\UserIdentity\' and CodeIgniter\\\\Shield\\\\Entities\\\\UserIdentity will always evaluate to true\\.$#',
381+
'count' => 1,
382+
'path' => __DIR__ . '/tests/Unit/UserTest.php',
383+
];
114384
$ignoreErrors[] = [
115385
'message' => '#^Cannot access property \\$active on array\\|object\\.$#',
116386
'count' => 2,
@@ -131,5 +401,10 @@
131401
'count' => 1,
132402
'path' => __DIR__ . '/tests/Unit/UserTest.php',
133403
];
404+
$ignoreErrors[] = [
405+
'message' => '#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#',
406+
'count' => 1,
407+
'path' => __DIR__ . '/tests/_support/Config/Registrar.php',
408+
];
134409

135410
return ['parameters' => ['ignoreErrors' => $ignoreErrors]];

phpstan.neon.dist

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,9 @@ parameters:
2424
- CodeIgniter\Shield\Config
2525
additionalServices:
2626
- CodeIgniter\Shield\Config\Services
27+
strictRules:
28+
allRules: false
29+
disallowedLooseComparison: true
30+
booleansInConditions: true
31+
disallowedConstructs: true
32+
matchingInheritedMethodNames: true

rector.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
$rectorConfig->phpstanConfigs([
6868
__DIR__ . '/phpstan.neon.dist',
6969
__DIR__ . '/vendor/codeigniter/phpstan-codeigniter/extension.neon',
70+
__DIR__ . '/vendor/phpstan/phpstan-strict-rules/rules.neon',
7071
]);
7172

7273
// Set the target version for refactoring

0 commit comments

Comments
 (0)