From b747b8448eb702d29342390c9d3e3a523c8a19c0 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sat, 19 Aug 2023 11:48:04 +0200 Subject: [PATCH] Update dependencies --- composer.json | 48 +++++++++---------- .../CLI/src/GeoLite/GeolocationDbUpdater.php | 2 +- .../CLI/test-cli/Command/ListApiKeysTest.php | 2 +- module/CLI/test/Util/CliTestUtils.php | 2 +- .../src/Importer/ImportedLinksProcessor.php | 2 +- .../Core/src/Importer/ShortUrlImporting.php | 2 +- module/Core/src/ShortUrl/Entity/ShortUrl.php | 4 +- .../Importer/ImportedLinksProcessorTest.php | 6 +-- .../test/ShortUrl/ShortUrlResolverTest.php | 6 +-- module/Rest/src/Entity/ApiKey.php | 2 +- .../test-api/Action/CreateShortUrlTest.php | 4 +- .../Rest/test-api/Action/EditShortUrlTest.php | 10 ++-- .../test-api/Action/NonOrphanVisitsTest.php | 2 +- .../test-api/Action/ResolveShortUrlTest.php | 4 +- .../Rest/test-api/Fixtures/ApiKeyFixture.php | 2 +- .../Rest/test/Service/ApiKeyServiceTest.php | 2 +- 16 files changed, 50 insertions(+), 50 deletions(-) diff --git a/composer.json b/composer.json index 9aa0ed98..134885d5 100644 --- a/composer.json +++ b/composer.json @@ -18,30 +18,30 @@ "ext-json": "*", "ext-pdo": "*", "akrabat/ip-address-middleware": "^2.1", - "cakephp/chronos": "^2.3", - "doctrine/migrations": "^3.5", - "doctrine/orm": "^2.14", - "endroid/qr-code": "^4.7", + "cakephp/chronos": "^2.4", + "doctrine/migrations": "^3.6", + "doctrine/orm": "^2.16", + "endroid/qr-code": "^4.8", + "friendsofphp/proxy-manager-lts": "^1.0", "geoip2/geoip2": "^2.13", "guzzlehttp/guzzle": "^7.5", "happyr/doctrine-specification": "^2.0", - "jaybizzle/crawler-detect": "^1.2.112", + "jaybizzle/crawler-detect": "^1.2.116", "laminas/laminas-config": "^3.8", "laminas/laminas-config-aggregator": "^1.13", - "laminas/laminas-diactoros": "^2.24", - "laminas/laminas-inputfilter": "^2.24", + "laminas/laminas-diactoros": "^2.25", + "laminas/laminas-inputfilter": "^2.27", "laminas/laminas-servicemanager": "^3.21", - "laminas/laminas-stdlib": "^3.16", + "laminas/laminas-stdlib": "^3.17", "league/uri": "^6.8", "lstrojny/functional-php": "^1.17", - "mezzio/mezzio": "^3.15", - "mezzio/mezzio-fastroute": "^3.8", - "mezzio/mezzio-problem-details": "^1.11", - "mezzio/mezzio-swoole": "^4.6", + "mezzio/mezzio": "^3.17", + "mezzio/mezzio-fastroute": "^3.10", + "mezzio/mezzio-problem-details": "^1.12", + "mezzio/mezzio-swoole": "^4.7", "mlocati/ip-lib": "^1.18", "mobiledetect/mobiledetectlib": "^3.74", - "ocramius/proxy-manager": "^2.14", - "pagerfanta/core": "^3.7", + "pagerfanta/core": "^3.8", "php-middleware/request-id": "^4.1", "pugx/shortid-php": "^1.1", "ramsey/uuid": "^4.7", @@ -52,15 +52,15 @@ "shlinkio/shlink-installer": "dev-develop#b393e6b as 8.5", "shlinkio/shlink-ip-geolocation": "^3.2", "shlinkio/shlink-json": "^1.0", - "spiral/roadrunner": "^2023.1", + "spiral/roadrunner": "^2023.2", "spiral/roadrunner-cli": "^2.5", - "spiral/roadrunner-http": "^3.0", + "spiral/roadrunner-http": "^3.1", "spiral/roadrunner-jobs": "^4.0", - "symfony/console": "^6.2", - "symfony/filesystem": "^6.2", - "symfony/lock": "^6.2", - "symfony/process": "^6.2", - "symfony/string": "^6.2" + "symfony/console": "^6.3", + "symfony/filesystem": "^6.3", + "symfony/lock": "^6.3", + "symfony/process": "^6.3", + "symfony/string": "^6.3" }, "require-dev": { "devizzent/cebe-php-openapi": "^1.0.1", @@ -71,12 +71,12 @@ "phpstan/phpstan-doctrine": "^1.3", "phpstan/phpstan-phpunit": "^1.3", "phpstan/phpstan-symfony": "^1.3", - "phpunit/php-code-coverage": "^10.0", - "phpunit/phpunit": "^10.2.0", + "phpunit/php-code-coverage": "^10.1", + "phpunit/phpunit": "^10.3", "roave/security-advisories": "dev-master", "shlinkio/php-coding-standard": "~2.3.0", "shlinkio/shlink-test-utils": "^3.7.1", - "symfony/var-dumper": "^6.2", + "symfony/var-dumper": "^6.3", "veewee/composer-run-parallel": "^1.2" }, "autoload": { diff --git a/module/CLI/src/GeoLite/GeolocationDbUpdater.php b/module/CLI/src/GeoLite/GeolocationDbUpdater.php index f33b8796..e8f93b19 100644 --- a/module/CLI/src/GeoLite/GeolocationDbUpdater.php +++ b/module/CLI/src/GeoLite/GeolocationDbUpdater.php @@ -70,7 +70,7 @@ class GeolocationDbUpdater implements GeolocationDbUpdaterInterface $buildTimestamp = $this->resolveBuildTimestamp($meta); $buildDate = Chronos::createFromTimestamp($buildTimestamp); - return Chronos::now()->gt($buildDate->addDays(35)); + return Chronos::now()->greaterThan($buildDate->addDays(35)); } private function resolveBuildTimestamp(Metadata $meta): int diff --git a/module/CLI/test-cli/Command/ListApiKeysTest.php b/module/CLI/test-cli/Command/ListApiKeysTest.php index 633cf819..46e3c135 100644 --- a/module/CLI/test-cli/Command/ListApiKeysTest.php +++ b/module/CLI/test-cli/Command/ListApiKeysTest.php @@ -24,7 +24,7 @@ class ListApiKeysTest extends CliTestCase public static function provideFlags(): iterable { - $expiredApiKeyDate = Chronos::now()->subDay()->startOfDay()->toAtomString(); + $expiredApiKeyDate = Chronos::now()->subDays(1)->startOfDay()->toAtomString(); $enabledOnlyOutput = <<getDate()->gte(normalizeDate($importedOrphanVisit->date))) { + if ($mostRecentOrphanVisit?->getDate()->greaterThanOrEquals(normalizeDate($importedOrphanVisit->date))) { continue; } diff --git a/module/Core/src/Importer/ShortUrlImporting.php b/module/Core/src/Importer/ShortUrlImporting.php index 28c22a24..f806f856 100644 --- a/module/Core/src/Importer/ShortUrlImporting.php +++ b/module/Core/src/Importer/ShortUrlImporting.php @@ -38,7 +38,7 @@ final class ShortUrlImporting $importedVisits = 0; foreach ($visits as $importedVisit) { // Skip visits which are older than the most recent already imported visit's date - if ($mostRecentImportedDate?->gte(normalizeDate($importedVisit->date))) { + if ($mostRecentImportedDate?->greaterThanOrEquals(normalizeDate($importedVisit->date))) { continue; } diff --git a/module/Core/src/ShortUrl/Entity/ShortUrl.php b/module/Core/src/ShortUrl/Entity/ShortUrl.php index e5646bd4..8fbec5ed 100644 --- a/module/Core/src/ShortUrl/Entity/ShortUrl.php +++ b/module/Core/src/ShortUrl/Entity/ShortUrl.php @@ -319,12 +319,12 @@ class ShortUrl extends AbstractEntity } $now = Chronos::now(); - $beforeValidSince = $this->validSince !== null && $this->validSince->gt($now); + $beforeValidSince = $this->validSince !== null && $this->validSince->greaterThan($now); if ($beforeValidSince) { return false; } - $afterValidUntil = $this->validUntil !== null && $this->validUntil->lt($now); + $afterValidUntil = $this->validUntil !== null && $this->validUntil->lessThan($now); if ($afterValidUntil) { return false; } diff --git a/module/Core/test/Importer/ImportedLinksProcessorTest.php b/module/Core/test/Importer/ImportedLinksProcessorTest.php index ff8eebc6..bf2896e2 100644 --- a/module/Core/test/Importer/ImportedLinksProcessorTest.php +++ b/module/Core/test/Importer/ImportedLinksProcessorTest.php @@ -307,9 +307,9 @@ class ImportedLinksProcessorTest extends TestCase yield 'existing orphan visit' => [true, [ new ImportedShlinkOrphanVisit('', '', Chronos::now()->subDays(3), '', '', null), new ImportedShlinkOrphanVisit('', '', Chronos::now()->subDays(2), '', '', null), - new ImportedShlinkOrphanVisit('', '', Chronos::now()->addDay(), '', '', null), - new ImportedShlinkOrphanVisit('', '', Chronos::now()->addDay(), '', '', null), - new ImportedShlinkOrphanVisit('', '', Chronos::now()->addDay(), '', '', null), + new ImportedShlinkOrphanVisit('', '', Chronos::now()->addDays(1), '', '', null), + new ImportedShlinkOrphanVisit('', '', Chronos::now()->addDays(1), '', '', null), + new ImportedShlinkOrphanVisit('', '', Chronos::now()->addDays(1), '', '', null), ], Visit::forBasePath(Visitor::botInstance()), 3]; } diff --git a/module/Core/test/ShortUrl/ShortUrlResolverTest.php b/module/Core/test/ShortUrl/ShortUrlResolverTest.php index 86aa56e7..4057691b 100644 --- a/module/Core/test/ShortUrl/ShortUrlResolverTest.php +++ b/module/Core/test/ShortUrl/ShortUrlResolverTest.php @@ -121,15 +121,15 @@ class ShortUrlResolverTest extends TestCase return $shortUrl; })()]; yield 'future validSince' => [ShortUrl::create(ShortUrlCreation::fromRawData( - ['validSince' => $now->addMonth()->toAtomString(), 'longUrl' => 'https://longUrl'], + ['validSince' => $now->addMonths(1)->toAtomString(), 'longUrl' => 'https://longUrl'], ))]; yield 'past validUntil' => [ShortUrl::create(ShortUrlCreation::fromRawData( - ['validUntil' => $now->subMonth()->toAtomString(), 'longUrl' => 'https://longUrl'], + ['validUntil' => $now->subMonths(1)->toAtomString(), 'longUrl' => 'https://longUrl'], ))]; yield 'mixed' => [(function () use ($now) { $shortUrl = ShortUrl::create(ShortUrlCreation::fromRawData([ 'maxVisits' => 3, - 'validUntil' => $now->subMonth()->toAtomString(), + 'validUntil' => $now->subMonths(1)->toAtomString(), 'longUrl' => 'https://longUrl', ])); $shortUrl->setVisits(new ArrayCollection(map( diff --git a/module/Rest/src/Entity/ApiKey.php b/module/Rest/src/Entity/ApiKey.php index 72977c86..bb2372f8 100644 --- a/module/Rest/src/Entity/ApiKey.php +++ b/module/Rest/src/Entity/ApiKey.php @@ -65,7 +65,7 @@ class ApiKey extends AbstractEntity public function isExpired(): bool { - return $this->expirationDate !== null && $this->expirationDate->lt(Chronos::now()); + return $this->expirationDate !== null && $this->expirationDate->lessThan(Chronos::now()); } public function name(): ?string diff --git a/module/Rest/test-api/Action/CreateShortUrlTest.php b/module/Rest/test-api/Action/CreateShortUrlTest.php index 5b22e79a..78f738a3 100644 --- a/module/Rest/test-api/Action/CreateShortUrlTest.php +++ b/module/Rest/test-api/Action/CreateShortUrlTest.php @@ -115,7 +115,7 @@ class CreateShortUrlTest extends ApiTestCase public function createsShortUrlWithValidSince(): void { [$statusCode, ['shortCode' => $shortCode]] = $this->createShortUrl([ - 'validSince' => Chronos::now()->addDay()->toAtomString(), + 'validSince' => Chronos::now()->addDays(1)->toAtomString(), ]); self::assertEquals(self::STATUS_OK, $statusCode); @@ -129,7 +129,7 @@ class CreateShortUrlTest extends ApiTestCase public function createsShortUrlWithValidUntil(): void { [$statusCode, ['shortCode' => $shortCode]] = $this->createShortUrl([ - 'validUntil' => Chronos::now()->subDay()->toAtomString(), + 'validUntil' => Chronos::now()->subDays(1)->toAtomString(), ]); self::assertEquals(self::STATUS_OK, $statusCode); diff --git a/module/Rest/test-api/Action/EditShortUrlTest.php b/module/Rest/test-api/Action/EditShortUrlTest.php index befb5131..a55fb066 100644 --- a/module/Rest/test-api/Action/EditShortUrlTest.php +++ b/module/Rest/test-api/Action/EditShortUrlTest.php @@ -55,13 +55,13 @@ class EditShortUrlTest extends ApiTestCase { $now = Chronos::now(); - yield [['validSince' => $now->addMonth()->toAtomString()]]; - yield [['validUntil' => $now->subMonth()->toAtomString()]]; + yield [['validSince' => $now->addMonths(1)->toAtomString()]]; + yield [['validUntil' => $now->subMonths(1)->toAtomString()]]; yield [['maxVisits' => 20]]; - yield [['validUntil' => $now->addYear()->toAtomString(), 'maxVisits' => 100]]; + yield [['validUntil' => $now->addYears(1)->toAtomString(), 'maxVisits' => 100]]; yield [[ - 'validSince' => $now->subYear()->toAtomString(), - 'validUntil' => $now->addYear()->toAtomString(), + 'validSince' => $now->subYears(1)->toAtomString(), + 'validUntil' => $now->addYears(1)->toAtomString(), 'maxVisits' => 100, ]]; } diff --git a/module/Rest/test-api/Action/NonOrphanVisitsTest.php b/module/Rest/test-api/Action/NonOrphanVisitsTest.php index f4f7601c..0e69db54 100644 --- a/module/Rest/test-api/Action/NonOrphanVisitsTest.php +++ b/module/Rest/test-api/Action/NonOrphanVisitsTest.php @@ -30,6 +30,6 @@ class NonOrphanVisitsTest extends ApiTestCase yield 'last page' => [['page' => 3, 'itemsPerPage' => 3], 7, 1]; yield 'bots excluded' => [['excludeBots' => 'true'], 6, 6]; yield 'bots excluded and pagination' => [['excludeBots' => 'true', 'page' => 1, 'itemsPerPage' => 4], 6, 4]; - yield 'date filter' => [['startDate' => Chronos::now()->addDay()->toAtomString()], 0, 0]; + yield 'date filter' => [['startDate' => Chronos::now()->addDays(1)->toAtomString()], 0, 0]; } } diff --git a/module/Rest/test-api/Action/ResolveShortUrlTest.php b/module/Rest/test-api/Action/ResolveShortUrlTest.php index b13de872..c10abc74 100644 --- a/module/Rest/test-api/Action/ResolveShortUrlTest.php +++ b/module/Rest/test-api/Action/ResolveShortUrlTest.php @@ -37,8 +37,8 @@ class ResolveShortUrlTest extends ApiTestCase { $now = Chronos::now(); - yield 'future validSince' => [['validSince' => $now->addMonth()->toAtomString()]]; - yield 'past validUntil' => [['validUntil' => $now->subMonth()->toAtomString()]]; + yield 'future validSince' => [['validSince' => $now->addMonths(1)->toAtomString()]]; + yield 'past validUntil' => [['validUntil' => $now->subMonths(1)->toAtomString()]]; yield 'maxVisits reached' => [['maxVisits' => 1]]; } diff --git a/module/Rest/test-api/Fixtures/ApiKeyFixture.php b/module/Rest/test-api/Fixtures/ApiKeyFixture.php index ef971d63..86d2cf2a 100644 --- a/module/Rest/test-api/Fixtures/ApiKeyFixture.php +++ b/module/Rest/test-api/Fixtures/ApiKeyFixture.php @@ -28,7 +28,7 @@ class ApiKeyFixture extends AbstractFixture implements DependentFixtureInterface $manager->persist($this->buildApiKey( 'expired_api_key', enabled: true, - expiresAt: Chronos::now()->subDay()->startOfDay(), + expiresAt: Chronos::now()->subDays(1)->startOfDay(), )); $authorApiKey = $this->buildApiKey('author_api_key', enabled: true); diff --git a/module/Rest/test/Service/ApiKeyServiceTest.php b/module/Rest/test/Service/ApiKeyServiceTest.php index 325713be..8fc0ea2c 100644 --- a/module/Rest/test/Service/ApiKeyServiceTest.php +++ b/module/Rest/test/Service/ApiKeyServiceTest.php @@ -81,7 +81,7 @@ class ApiKeyServiceTest extends TestCase { yield 'non-existent api key' => [null]; yield 'disabled api key' => [ApiKey::create()->disable()]; - yield 'expired api key' => [ApiKey::fromMeta(ApiKeyMeta::withExpirationDate(Chronos::now()->subDay()))]; + yield 'expired api key' => [ApiKey::fromMeta(ApiKeyMeta::withExpirationDate(Chronos::now()->subDays(1)))]; } #[Test]