Skip to content

Commit

Permalink
fix namespace case.
Browse files Browse the repository at this point in the history
fix hmac invalidateAll() expires field.
  • Loading branch information
CosDiabos committed Feb 14, 2025
1 parent e800d47 commit 73283d8
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
8 changes: 7 additions & 1 deletion phpstan-baseline.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,13 @@
$ignoreErrors[] = [
'message' => '#^Cannot access property \\$id on array\\<string, string\\>\\|object\\.$#',
'identifier' => 'property.nonObject',
'count' => 7,
'count' => 9,
'path' => __DIR__ . '/src/Commands/Hmac.php',
];
$ignoreErrors[] = [
'message' => '#^Cannot access property \\$expires on array\\<string, string\\>\\|object\\.$#',
'identifier' => 'property.nonObject',
'count' => 3,
'path' => __DIR__ . '/src/Commands/Hmac.php',
];
$ignoreErrors[] = [
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/Hmac.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ static function ($identity) use ($uIdModelSub, $that): void {
return;
}

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

$that->write('Hmac Key/Token ID: ' . $identity->id . ', set as expired.');
Expand Down
2 changes: 1 addition & 1 deletion tests/Authentication/HasAccessTokensTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

namespace Tests\Authentication;

use Codeigniter\I18n\Time;
use CodeIgniter\I18n\Time;
use CodeIgniter\Shield\Entities\AccessToken;
use CodeIgniter\Shield\Entities\User;
use CodeIgniter\Shield\Models\UserIdentityModel;
Expand Down
2 changes: 1 addition & 1 deletion tests/Authentication/HasHmacTokensTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

namespace Tests\Authentication;

use Codeigniter\I18n\Time;
use CodeIgniter\I18n\Time;
use CodeIgniter\Shield\Entities\AccessToken;
use CodeIgniter\Shield\Entities\User;
use CodeIgniter\Shield\Models\UserIdentityModel;
Expand Down
2 changes: 1 addition & 1 deletion tests/Commands/HmacTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,9 @@ public function testBadCommand(): void
*/
public function testExpireAll(): void
{
/** @var User $user */
$tokenExpiration = Time::parse('2024-11-03 12:00:00');

/** @var User $user */
$user = fake(UserModel::class);
$user->generateHmacToken('foo', ['*'], $tokenExpiration);
$user->generateHmacToken('bar');
Expand Down

0 comments on commit 73283d8

Please sign in to comment.