Skip to content

Commit 05d4abc

Browse files
authored
Merge pull request #1004 from datamweb/fix-phpstan-errors
chore: fix phpstan errors
2 parents e57ad87 + fc0948a commit 05d4abc

File tree

6 files changed

+12
-37
lines changed

6 files changed

+12
-37
lines changed

phpstan-baseline.php

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -158,16 +158,6 @@
158158
'count' => 1,
159159
'path' => __DIR__ . '/src/Collectors/Auth.php',
160160
];
161-
$ignoreErrors[] = [
162-
'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\\.$#',
163-
'count' => 1,
164-
'path' => __DIR__ . '/src/Commands/Generators/UserModelGenerator.php',
165-
];
166-
$ignoreErrors[] = [
167-
'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\\.$#',
168-
'count' => 1,
169-
'path' => __DIR__ . '/src/Commands/Generators/UserModelGenerator.php',
170-
];
171161
$ignoreErrors[] = [
172162
'message' => '#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#',
173163
'count' => 1,
@@ -317,28 +307,13 @@
317307
'path' => __DIR__ . '/src/Models/UserModel.php',
318308
];
319309
$ignoreErrors[] = [
320-
'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\\(\\)$#',
321-
'count' => 1,
322-
'path' => __DIR__ . '/src/Models/UserModel.php',
323-
];
324-
$ignoreErrors[] = [
325-
'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\\(\\)$#',
326-
'count' => 1,
327-
'path' => __DIR__ . '/src/Models/UserModel.php',
328-
];
329-
$ignoreErrors[] = [
330-
'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\\(\\)$#',
331-
'count' => 1,
332-
'path' => __DIR__ . '/src/Models/UserModel.php',
333-
];
334-
$ignoreErrors[] = [
335-
'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\\(\\)$#',
310+
'message' => '#^Call to function model with CodeIgniter\\\\Shield\\\\Models\\\\UserIdentityModel\\:\\:class is discouraged\\.$#',
336311
'count' => 1,
337312
'path' => __DIR__ . '/src/Models/UserModel.php',
338313
];
339314
$ignoreErrors[] = [
340-
'message' => '#^Call to function model with CodeIgniter\\\\Shield\\\\Models\\\\UserIdentityModel\\:\\:class is discouraged\\.$#',
341-
'count' => 1,
315+
'message' => '#^Return type \\(int|string|true\\) of method CodeIgniter\\\\Shield\\\\Models\\\\UserModel\\:\\:insert\\(\\) should be covariant with return type \\(\\(\\$returnID is true \\? int|string|false \\: bool\\) of method CodeIgniter\\\\Model\\:\\:insert\\(\\)\\$#',
316+
'count' => 4,
342317
'path' => __DIR__ . '/src/Models/UserModel.php',
343318
];
344319
$ignoreErrors[] = [

src/Commands/Hmac.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class Hmac extends BaseCommand
5454
/**
5555
* the Command's Arguments
5656
*
57-
* @var array
57+
* @var array<string, string>
5858
*/
5959
protected $arguments = [
6060
'action' => <<<'EOL'
@@ -72,7 +72,7 @@ class Hmac extends BaseCommand
7272
/**
7373
* the Command's Options
7474
*
75-
* @var array
75+
* @var array<string, string>
7676
*/
7777
protected $options = [];
7878

src/Commands/Setup.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ class Setup extends BaseCommand
4747
/**
4848
* the Command's Arguments
4949
*
50-
* @var array
50+
* @var array<string, string>
5151
*/
5252
protected $arguments = [];
5353

5454
/**
5555
* the Command's Options
5656
*
57-
* @var array
57+
* @var array<string, string>
5858
*/
5959
protected $options = [
6060
'-f' => 'Force overwrite ALL existing files in destination.',

src/Commands/User.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class User extends BaseCommand
8686
/**
8787
* Command's Arguments
8888
*
89-
* @var array
89+
* @var array<string, string>
9090
*/
9191
protected $arguments = [
9292
'action' => <<<'EOL'
@@ -107,7 +107,7 @@ class User extends BaseCommand
107107
/**
108108
* Command's Options
109109
*
110-
* @var array
110+
* @var array<string, string>
111111
*/
112112
protected $options = [
113113
'-i' => 'User id',

tests/Authentication/MagicLinkTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public function testMagicLinkVerifyExpired(): void
114114
'user_id' => $user->id,
115115
'type' => Session::ID_TYPE_MAGIC_LINK,
116116
'secret' => 'abasdasdf',
117-
'expires' => Time::now()->subDays(5),
117+
'expires' => Time::now()->subDays(5)->format('Y-m-d H:i:s'),
118118
]);
119119

120120
$result = $this->get(route_to('verify-magic-link') . '?token=abasdasdf');
@@ -136,7 +136,7 @@ public function testMagicLinkVerifySuccess(): void
136136
'user_id' => $user->id,
137137
'type' => Session::ID_TYPE_MAGIC_LINK,
138138
'secret' => 'abasdasdf',
139-
'expires' => Time::now()->addMinutes(60),
139+
'expires' => Time::now()->addMinutes(60)->format('Y-m-d H:i:s'),
140140
]);
141141

142142
$result = $this->get(route_to('verify-magic-link') . '?token=abasdasdf');

tests/Controllers/MagicLinkTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public function testMagicLinkVerifyPendingRegistrationActivation(): void
103103
'user_id' => $user->id,
104104
'type' => Session::ID_TYPE_MAGIC_LINK,
105105
'secret' => 'abasdasdf',
106-
'expires' => Time::now()->addMinutes(60),
106+
'expires' => Time::now()->addMinutes(60)->format('Y-m-d H:i:s'),
107107
]);
108108

109109
$result = $this->get(route_to('verify-magic-link') . '?token=abasdasdf');

0 commit comments

Comments
 (0)