From 3167fb4e3514e4e1b7f8d52b78e19b8924d366c1 Mon Sep 17 00:00:00 2001 From: Eugene Borovov Date: Wed, 10 Sep 2025 12:46:33 +0700 Subject: [PATCH] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=20=D0=B7=D0=B0=D0=B2=D0=B8=D1=81=D0=B8=D0=BC=D0=BE=D1=81?= =?UTF-8?q?=D1=82=D0=B8=20lcobucci/clock?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 1 - src/AmoCRM/OAuth/AmoCRMOAuth.php | 16 +++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index 764c3373..e0551eb3 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,6 @@ "amocrm/oauth2-amocrm": "^3.0", "fig/http-message-util": "1.*", "guzzlehttp/guzzle": "6.* || 7.*", - "lcobucci/clock": "1.1.0 ||^2.0.0", "lcobucci/jwt": "^3.4.6 || ^4.0.4 || ^5.0", "nesbot/carbon": "^2.72.6 || ^3.8.4", "ramsey/uuid": "^3 || ^4", diff --git a/src/AmoCRM/OAuth/AmoCRMOAuth.php b/src/AmoCRM/OAuth/AmoCRMOAuth.php index d5a52c6a..64c60343 100755 --- a/src/AmoCRM/OAuth/AmoCRMOAuth.php +++ b/src/AmoCRM/OAuth/AmoCRMOAuth.php @@ -17,6 +17,8 @@ use AmoCRM\Exceptions\AmoCRMoAuthApiException; use AmoCRM\Exceptions\BadTypeException; use AmoCRM\OAuth2\Client\Provider\AmoCRM; +use DateTimeImmutable; +use DateTimeZone; use Exception; use Fig\Http\Message\StatusCodeInterface; use GuzzleHttp\ClientInterface; @@ -24,8 +26,6 @@ use GuzzleHttp\Exception\GuzzleException; use GuzzleHttp\Exception\TooManyRedirectsException; use GuzzleHttp\Psr7\Uri; -use Lcobucci\Clock\FrozenClock; -use Lcobucci\Clock\SystemClock; use Lcobucci\JWT\Configuration; use Lcobucci\JWT\Signer\Hmac\Sha256; use Lcobucci\JWT\Signer\Hmac\Sha512; @@ -40,6 +40,7 @@ use League\OAuth2\Client\Provider\ResourceOwnerInterface; use League\OAuth2\Client\Token\AccessToken; use League\OAuth2\Client\Token\AccessTokenInterface; +use Psr\Clock\ClockInterface; use RuntimeException; use Throwable; use Lcobucci\JWT\Validation\Constraint\StrictValidAt; @@ -717,11 +718,12 @@ private function createValidAtConstraint(): Constraint foreach ($availableConstraints as $constraintClass) { if (class_exists($constraintClass)) { - $clockClass = class_exists(FrozenClock::class) - ? FrozenClock::class - : SystemClock::class; - - return new $constraintClass($clockClass::fromUTC()); + return new $constraintClass(new class implements ClockInterface { + public function now(): DateTimeImmutable + { + return new DateTimeImmutable('now', new DateTimeZone('UTC')); + } + }); } }