Skip to content

Commit 73283d8

Browse files
committed
fix namespace case.
fix hmac invalidateAll() expires field.
1 parent e800d47 commit 73283d8

File tree

5 files changed

+11
-5
lines changed

5 files changed

+11
-5
lines changed

phpstan-baseline.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,13 @@
168168
$ignoreErrors[] = [
169169
'message' => '#^Cannot access property \\$id on array\\<string, string\\>\\|object\\.$#',
170170
'identifier' => 'property.nonObject',
171-
'count' => 7,
171+
'count' => 9,
172+
'path' => __DIR__ . '/src/Commands/Hmac.php',
173+
];
174+
$ignoreErrors[] = [
175+
'message' => '#^Cannot access property \\$expires on array\\<string, string\\>\\|object\\.$#',
176+
'identifier' => 'property.nonObject',
177+
'count' => 3,
172178
'path' => __DIR__ . '/src/Commands/Hmac.php',
173179
];
174180
$ignoreErrors[] = [

src/Commands/Hmac.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ static function ($identity) use ($uIdModelSub, $that): void {
224224
return;
225225
}
226226

227-
$identity->expires = $timeNow->format('Y-m-d h:i:s');
227+
$identity->expires = $timeNow;
228228
$uIdModelSub->save($identity);
229229

230230
$that->write('Hmac Key/Token ID: ' . $identity->id . ', set as expired.');

tests/Authentication/HasAccessTokensTest.php

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

1414
namespace Tests\Authentication;
1515

16-
use Codeigniter\I18n\Time;
16+
use CodeIgniter\I18n\Time;
1717
use CodeIgniter\Shield\Entities\AccessToken;
1818
use CodeIgniter\Shield\Entities\User;
1919
use CodeIgniter\Shield\Models\UserIdentityModel;

tests/Authentication/HasHmacTokensTest.php

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

1414
namespace Tests\Authentication;
1515

16-
use Codeigniter\I18n\Time;
16+
use CodeIgniter\I18n\Time;
1717
use CodeIgniter\Shield\Entities\AccessToken;
1818
use CodeIgniter\Shield\Entities\User;
1919
use CodeIgniter\Shield\Models\UserIdentityModel;

tests/Commands/HmacTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,9 @@ public function testBadCommand(): void
147147
*/
148148
public function testExpireAll(): void
149149
{
150-
/** @var User $user */
151150
$tokenExpiration = Time::parse('2024-11-03 12:00:00');
152151

152+
/** @var User $user */
153153
$user = fake(UserModel::class);
154154
$user->generateHmacToken('foo', ['*'], $tokenExpiration);
155155
$user->generateHmacToken('bar');

0 commit comments

Comments
 (0)