diff --git a/phpstan-baseline.php b/phpstan-baseline.php index e7d630cd2..3ab25cf31 100644 --- a/phpstan-baseline.php +++ b/phpstan-baseline.php @@ -168,7 +168,13 @@ $ignoreErrors[] = [ 'message' => '#^Cannot access property \\$id on array\\\\|object\\.$#', 'identifier' => 'property.nonObject', - 'count' => 7, + 'count' => 9, + 'path' => __DIR__ . '/src/Commands/Hmac.php', +]; +$ignoreErrors[] = [ + 'message' => '#^Cannot access property \\$expires on array\\\\|object\\.$#', + 'identifier' => 'property.nonObject', + 'count' => 3, 'path' => __DIR__ . '/src/Commands/Hmac.php', ]; $ignoreErrors[] = [ diff --git a/src/Commands/Hmac.php b/src/Commands/Hmac.php index 7e07f71f1..ba1c2fa10 100644 --- a/src/Commands/Hmac.php +++ b/src/Commands/Hmac.php @@ -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.'); diff --git a/tests/Authentication/HasAccessTokensTest.php b/tests/Authentication/HasAccessTokensTest.php index 25d68f5ec..c33564b4d 100644 --- a/tests/Authentication/HasAccessTokensTest.php +++ b/tests/Authentication/HasAccessTokensTest.php @@ -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; diff --git a/tests/Authentication/HasHmacTokensTest.php b/tests/Authentication/HasHmacTokensTest.php index 9c71be405..38015366f 100644 --- a/tests/Authentication/HasHmacTokensTest.php +++ b/tests/Authentication/HasHmacTokensTest.php @@ -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; diff --git a/tests/Commands/HmacTest.php b/tests/Commands/HmacTest.php index 6134723ce..9439324f8 100644 --- a/tests/Commands/HmacTest.php +++ b/tests/Commands/HmacTest.php @@ -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');