From e29c0208de0bc11fa23cd9be267b644fdb2be8e5 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Mon, 2 Dec 2024 09:13:20 +0100 Subject: [PATCH] Drop support for PHP 8.2 --- .github/workflows/ci-db-tests.yml | 2 +- .github/workflows/ci-tests.yml | 2 +- .github/workflows/publish-release.yml | 2 +- .github/workflows/publish-swagger-spec.yml | 2 +- CHANGELOG.md | 2 +- README.md | 2 +- composer.json | 2 +- .../CLI/src/Command/Api/DisableKeyCommand.php | 2 +- .../src/Command/Api/GenerateKeyCommand.php | 2 +- .../src/Command/Api/InitialApiKeyCommand.php | 2 +- .../CLI/src/Command/Api/ListKeysCommand.php | 8 +++--- .../src/Command/Api/RenameApiKeyCommand.php | 2 +- .../src/Command/Config/ReadEnvVarCommand.php | 2 +- .../src/Command/Db/CreateDatabaseCommand.php | 6 ++-- .../src/Command/Db/MigrateDatabaseCommand.php | 6 ++-- .../Command/Domain/DomainRedirectsCommand.php | 2 +- .../Command/Domain/GetDomainVisitsCommand.php | 2 +- .../src/Command/Domain/ListDomainsCommand.php | 2 +- .../Integration/MatomoSendVisitsCommand.php | 2 +- .../ManageRedirectRulesCommand.php | 2 +- .../ShortUrl/CreateShortUrlCommand.php | 2 +- .../DeleteExpiredShortUrlsCommand.php | 2 +- .../ShortUrl/DeleteShortUrlCommand.php | 2 +- .../ShortUrl/DeleteShortUrlVisitsCommand.php | 2 +- .../Command/ShortUrl/EditShortUrlCommand.php | 2 +- .../ShortUrl/GetShortUrlVisitsCommand.php | 2 +- .../Command/ShortUrl/ListShortUrlsCommand.php | 2 +- .../Command/ShortUrl/ResolveUrlCommand.php | 2 +- .../CLI/src/Command/Tag/DeleteTagsCommand.php | 4 +-- .../src/Command/Tag/GetTagVisitsCommand.php | 2 +- .../CLI/src/Command/Tag/ListTagsCommand.php | 2 +- .../CLI/src/Command/Tag/RenameTagCommand.php | 2 +- .../src/Command/Util/LockedCommandConfig.php | 2 +- .../Visit/DeleteOrphanVisitsCommand.php | 2 +- .../Visit/DownloadGeoLiteDbCommand.php | 2 +- .../Visit/GetNonOrphanVisitsCommand.php | 2 +- .../Command/Visit/GetOrphanVisitsCommand.php | 2 +- .../src/Command/Visit/LocateVisitsCommand.php | 2 +- .../CLI/src/GeoLite/GeolocationDbUpdater.php | 2 +- module/CLI/src/Util/ExitCode.php | 6 ++-- module/CLI/src/Util/ShlinkTable.php | 4 +-- .../Core/migrations/Version20230211171904.php | 2 +- .../Core/migrations/Version20230303164233.php | 2 +- .../Core/migrations/Version20240220214031.php | 8 ++++-- .../Core/migrations/Version20241124112257.php | 2 +- module/Core/src/Action/Model/QrCodeParams.php | 6 ++-- .../src/Config/NotFoundRedirectResolver.php | 4 +-- .../Config/PostProcessor/BasePathPrefixer.php | 2 +- .../MultiSegmentSlugProcessor.php | 4 +-- module/Core/src/Domain/Entity/Domain.php | 2 +- .../Validation/DomainRedirectsInputFilter.php | 8 +++--- .../ErrorHandler/NotFoundTemplateHandler.php | 6 ++-- .../src/Exception/DeleteShortUrlException.php | 4 +-- .../src/Exception/DomainNotFoundException.php | 4 +-- .../ForbiddenTagOperationException.php | 4 +-- .../src/Exception/NonUniqueSlugException.php | 4 +-- .../Exception/ShortUrlNotFoundException.php | 4 +-- .../src/Exception/TagConflictException.php | 4 +-- .../src/Exception/TagNotFoundException.php | 4 +-- .../src/Exception/ValidationException.php | 4 +-- .../Core/src/Matomo/MatomoTrackerBuilder.php | 2 +- module/Core/src/Model/Ordering.php | 6 ++-- .../Validation/RedirectRulesInputFilter.php | 12 ++++---- .../Helper/ShortUrlTitleResolutionHelper.php | 8 +++--- .../TrimTrailingSlashMiddleware.php | 2 +- .../Model/Validation/CustomSlugValidator.php | 4 +-- .../Model/Validation/ShortUrlInputFilter.php | 28 +++++++++---------- .../Validation/ShortUrlsParamsInputFilter.php | 22 +++++++-------- module/Core/src/Visit/Model/Visitor.php | 10 +++---- .../VisitIterationRepositoryInterface.php | 2 +- module/Core/test/Action/QrCodeActionTest.php | 4 +-- .../Core/test/Action/RedirectActionTest.php | 2 +- .../ShortUrlTitleResolutionHelperTest.php | 2 +- module/Core/test/Visit/RequestTrackerTest.php | 2 +- module/Rest/src/Action/AbstractRestAction.php | 4 +-- .../Action/Domain/DomainRedirectsAction.php | 6 ++-- .../src/Action/Domain/ListDomainsAction.php | 10 ++++--- module/Rest/src/Action/HealthAction.php | 12 ++++---- module/Rest/src/Action/MercureInfoAction.php | 10 ++++--- .../RedirectRule/ListRedirectRulesAction.php | 4 +-- .../RedirectRule/SetRedirectRulesAction.php | 4 +-- .../Action/ShortUrl/CreateShortUrlAction.php | 4 +-- .../Action/ShortUrl/DeleteShortUrlAction.php | 4 +-- .../ShortUrl/DeleteShortUrlVisitsAction.php | 4 +-- .../Action/ShortUrl/EditShortUrlAction.php | 4 +-- .../Action/ShortUrl/ListShortUrlsAction.php | 4 +-- .../Action/ShortUrl/ResolveShortUrlAction.php | 4 +-- .../SingleStepCreateShortUrlAction.php | 4 +-- .../Rest/src/Action/Tag/DeleteTagsAction.php | 6 ++-- module/Rest/src/Action/Tag/ListTagsAction.php | 4 +-- .../Rest/src/Action/Tag/TagsStatsAction.php | 4 +-- .../Action/Visit/AbstractListVisitsAction.php | 2 +- .../Action/Visit/DeleteOrphanVisitsAction.php | 4 +-- .../src/Action/Visit/DomainVisitsAction.php | 2 +- .../src/Action/Visit/GlobalVisitsAction.php | 6 ++-- .../Action/Visit/NonOrphanVisitsAction.php | 2 +- .../src/Action/Visit/OrphanVisitsAction.php | 2 +- .../src/Action/Visit/ShortUrlVisitsAction.php | 2 +- .../Rest/src/Action/Visit/TagVisitsAction.php | 2 +- module/Rest/src/ConfigProvider.php | 6 ++-- .../Rest/src/Exception/MercureException.php | 4 +-- .../MissingAuthenticationException.php | 4 +-- .../VerifyAuthenticationException.php | 2 +- .../Middleware/AuthenticationMiddleware.php | 2 +- ...teShortUrlContentNegotiationMiddleware.php | 4 +-- .../test-api/Action/ListRedirectRulesTest.php | 4 +-- .../test-api/Action/ListShortUrlsTest.php | 12 ++++---- .../Rest/test-api/Action/OrphanVisitsTest.php | 6 ++-- .../test-api/Action/SetRedirectRulesTest.php | 4 +-- 109 files changed, 229 insertions(+), 221 deletions(-) diff --git a/.github/workflows/ci-db-tests.yml b/.github/workflows/ci-db-tests.yml index 010c635f8..cb7638bec 100644 --- a/.github/workflows/ci-db-tests.yml +++ b/.github/workflows/ci-db-tests.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-24.04 strategy: matrix: - php-version: ['8.2', '8.3', '8.4'] + php-version: ['8.3', '8.4'] env: LC_ALL: C steps: diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml index c26aaaca4..f0b7d8470 100644 --- a/.github/workflows/ci-tests.yml +++ b/.github/workflows/ci-tests.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-24.04 strategy: matrix: - php-version: ['8.2', '8.3', '8.4'] + php-version: ['8.3', '8.4'] env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # rr get-binary picks this env automatically steps: diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 443d34a9f..a2783f97e 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-24.04 strategy: matrix: - php-version: ['8.2', '8.3', '8.4'] + php-version: ['8.3', '8.4'] steps: - uses: actions/checkout@v4 - uses: './.github/actions/ci-setup' diff --git a/.github/workflows/publish-swagger-spec.yml b/.github/workflows/publish-swagger-spec.yml index 9607206ae..95692294c 100644 --- a/.github/workflows/publish-swagger-spec.yml +++ b/.github/workflows/publish-swagger-spec.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-24.04 strategy: matrix: - php-version: ['8.2'] + php-version: ['8.3'] steps: - uses: actions/checkout@v4 - name: Determine version diff --git a/CHANGELOG.md b/CHANGELOG.md index fd63464d7..12b5aae40 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,7 +21,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), and this * *Nothing* ### Removed -* *Nothing* +* * [#2247](https://github.com/shlinkio/shlink/issues/2247) Drop support for PHP 8.2 ### Fixed * *Nothing* diff --git a/README.md b/README.md index 681a9495c..e061467d5 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ The idea is that you can just generate a container using the image and provide t First, make sure the host where you are going to run shlink fulfills these requirements: -* PHP 8.2 or 8.3 +* PHP 8.3 or 8.4 * The next PHP extensions: json, curl, pdo, intl, gd and gmp/bcmath. * apcu extension is recommended if you don't plan to use RoadRunner. * xml extension is required if you want to generate QR codes in svg format. diff --git a/composer.json b/composer.json index f6cfb17bf..bc81820e2 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ } ], "require": { - "php": "^8.2", + "php": "^8.3", "ext-curl": "*", "ext-gd": "*", "ext-json": "*", diff --git a/module/CLI/src/Command/Api/DisableKeyCommand.php b/module/CLI/src/Command/Api/DisableKeyCommand.php index c2ed41738..93178bb52 100644 --- a/module/CLI/src/Command/Api/DisableKeyCommand.php +++ b/module/CLI/src/Command/Api/DisableKeyCommand.php @@ -20,7 +20,7 @@ class DisableKeyCommand extends Command { - public const NAME = 'api-key:disable'; + public const string NAME = 'api-key:disable'; public function __construct(private readonly ApiKeyServiceInterface $apiKeyService) { diff --git a/module/CLI/src/Command/Api/GenerateKeyCommand.php b/module/CLI/src/Command/Api/GenerateKeyCommand.php index 9fc0bb1d9..2790fa8c6 100644 --- a/module/CLI/src/Command/Api/GenerateKeyCommand.php +++ b/module/CLI/src/Command/Api/GenerateKeyCommand.php @@ -23,7 +23,7 @@ class GenerateKeyCommand extends Command { - public const NAME = 'api-key:generate'; + public const string NAME = 'api-key:generate'; public function __construct( private readonly ApiKeyServiceInterface $apiKeyService, diff --git a/module/CLI/src/Command/Api/InitialApiKeyCommand.php b/module/CLI/src/Command/Api/InitialApiKeyCommand.php index 0f4945a96..e6515bc37 100644 --- a/module/CLI/src/Command/Api/InitialApiKeyCommand.php +++ b/module/CLI/src/Command/Api/InitialApiKeyCommand.php @@ -13,7 +13,7 @@ class InitialApiKeyCommand extends Command { - public const NAME = 'api-key:initial'; + public const string NAME = 'api-key:initial'; public function __construct(private readonly ApiKeyServiceInterface $apiKeyService) { diff --git a/module/CLI/src/Command/Api/ListKeysCommand.php b/module/CLI/src/Command/Api/ListKeysCommand.php index d341389d1..69870a9bf 100644 --- a/module/CLI/src/Command/Api/ListKeysCommand.php +++ b/module/CLI/src/Command/Api/ListKeysCommand.php @@ -21,11 +21,11 @@ class ListKeysCommand extends Command { - private const ERROR_STRING_PATTERN = '%s'; - private const SUCCESS_STRING_PATTERN = '%s'; - private const WARNING_STRING_PATTERN = '%s'; + private const string ERROR_STRING_PATTERN = '%s'; + private const string SUCCESS_STRING_PATTERN = '%s'; + private const string WARNING_STRING_PATTERN = '%s'; - public const NAME = 'api-key:list'; + public const string NAME = 'api-key:list'; public function __construct(private readonly ApiKeyServiceInterface $apiKeyService) { diff --git a/module/CLI/src/Command/Api/RenameApiKeyCommand.php b/module/CLI/src/Command/Api/RenameApiKeyCommand.php index f7e24992b..eb6625390 100644 --- a/module/CLI/src/Command/Api/RenameApiKeyCommand.php +++ b/module/CLI/src/Command/Api/RenameApiKeyCommand.php @@ -19,7 +19,7 @@ class RenameApiKeyCommand extends Command { - public const NAME = 'api-key:rename'; + public const string NAME = 'api-key:rename'; public function __construct(private readonly ApiKeyServiceInterface $apiKeyService) { diff --git a/module/CLI/src/Command/Config/ReadEnvVarCommand.php b/module/CLI/src/Command/Config/ReadEnvVarCommand.php index 76ec36aee..72e07f97f 100644 --- a/module/CLI/src/Command/Config/ReadEnvVarCommand.php +++ b/module/CLI/src/Command/Config/ReadEnvVarCommand.php @@ -21,7 +21,7 @@ class ReadEnvVarCommand extends Command { - public const NAME = 'env-var:read'; + public const string NAME = 'env-var:read'; /** @var Closure(string $envVar): mixed */ private readonly Closure $loadEnvVar; diff --git a/module/CLI/src/Command/Db/CreateDatabaseCommand.php b/module/CLI/src/Command/Db/CreateDatabaseCommand.php index 53b854d1d..b2a2fa185 100644 --- a/module/CLI/src/Command/Db/CreateDatabaseCommand.php +++ b/module/CLI/src/Command/Db/CreateDatabaseCommand.php @@ -24,9 +24,9 @@ class CreateDatabaseCommand extends AbstractDatabaseCommand { private readonly Connection $regularConn; - public const NAME = 'db:create'; - public const DOCTRINE_SCRIPT = 'bin/doctrine'; - public const DOCTRINE_CREATE_SCHEMA_COMMAND = 'orm:schema-tool:create'; + public const string NAME = 'db:create'; + public const string DOCTRINE_SCRIPT = 'bin/doctrine'; + public const string DOCTRINE_CREATE_SCHEMA_COMMAND = 'orm:schema-tool:create'; public function __construct( LockFactory $locker, diff --git a/module/CLI/src/Command/Db/MigrateDatabaseCommand.php b/module/CLI/src/Command/Db/MigrateDatabaseCommand.php index a912cf242..2e280a062 100644 --- a/module/CLI/src/Command/Db/MigrateDatabaseCommand.php +++ b/module/CLI/src/Command/Db/MigrateDatabaseCommand.php @@ -11,9 +11,9 @@ class MigrateDatabaseCommand extends AbstractDatabaseCommand { - public const NAME = 'db:migrate'; - public const DOCTRINE_MIGRATIONS_SCRIPT = 'vendor/doctrine/migrations/bin/doctrine-migrations.php'; - public const DOCTRINE_MIGRATE_COMMAND = 'migrations:migrate'; + public const string NAME = 'db:migrate'; + public const string DOCTRINE_MIGRATIONS_SCRIPT = 'vendor/doctrine/migrations/bin/doctrine-migrations.php'; + public const string DOCTRINE_MIGRATE_COMMAND = 'migrations:migrate'; protected function configure(): void { diff --git a/module/CLI/src/Command/Domain/DomainRedirectsCommand.php b/module/CLI/src/Command/Domain/DomainRedirectsCommand.php index 61e4a93b8..105c10e30 100644 --- a/module/CLI/src/Command/Domain/DomainRedirectsCommand.php +++ b/module/CLI/src/Command/Domain/DomainRedirectsCommand.php @@ -21,7 +21,7 @@ class DomainRedirectsCommand extends Command { - public const NAME = 'domain:redirects'; + public const string NAME = 'domain:redirects'; public function __construct(private readonly DomainServiceInterface $domainService) { diff --git a/module/CLI/src/Command/Domain/GetDomainVisitsCommand.php b/module/CLI/src/Command/Domain/GetDomainVisitsCommand.php index 6477539eb..2891c44fe 100644 --- a/module/CLI/src/Command/Domain/GetDomainVisitsCommand.php +++ b/module/CLI/src/Command/Domain/GetDomainVisitsCommand.php @@ -16,7 +16,7 @@ class GetDomainVisitsCommand extends AbstractVisitsListCommand { - public const NAME = 'domain:visits'; + public const string NAME = 'domain:visits'; public function __construct( VisitsStatsHelperInterface $visitsHelper, diff --git a/module/CLI/src/Command/Domain/ListDomainsCommand.php b/module/CLI/src/Command/Domain/ListDomainsCommand.php index 7e6b8cc30..79c181f75 100644 --- a/module/CLI/src/Command/Domain/ListDomainsCommand.php +++ b/module/CLI/src/Command/Domain/ListDomainsCommand.php @@ -18,7 +18,7 @@ class ListDomainsCommand extends Command { - public const NAME = 'domain:list'; + public const string NAME = 'domain:list'; public function __construct(private readonly DomainServiceInterface $domainService) { diff --git a/module/CLI/src/Command/Integration/MatomoSendVisitsCommand.php b/module/CLI/src/Command/Integration/MatomoSendVisitsCommand.php index ba9a794e6..9a41cc05e 100644 --- a/module/CLI/src/Command/Integration/MatomoSendVisitsCommand.php +++ b/module/CLI/src/Command/Integration/MatomoSendVisitsCommand.php @@ -22,7 +22,7 @@ class MatomoSendVisitsCommand extends Command implements VisitSendingProgressTrackerInterface { - public const NAME = 'integration:matomo:send-visits'; + public const string NAME = 'integration:matomo:send-visits'; private readonly bool $matomoEnabled; private SymfonyStyle $io; diff --git a/module/CLI/src/Command/RedirectRule/ManageRedirectRulesCommand.php b/module/CLI/src/Command/RedirectRule/ManageRedirectRulesCommand.php index 13b6d1cc9..646b9d77b 100644 --- a/module/CLI/src/Command/RedirectRule/ManageRedirectRulesCommand.php +++ b/module/CLI/src/Command/RedirectRule/ManageRedirectRulesCommand.php @@ -19,7 +19,7 @@ class ManageRedirectRulesCommand extends Command { - public const NAME = 'short-url:manage-rules'; + public const string NAME = 'short-url:manage-rules'; private readonly ShortUrlIdentifierInput $shortUrlIdentifierInput; diff --git a/module/CLI/src/Command/ShortUrl/CreateShortUrlCommand.php b/module/CLI/src/Command/ShortUrl/CreateShortUrlCommand.php index e3a9b180a..df341c965 100644 --- a/module/CLI/src/Command/ShortUrl/CreateShortUrlCommand.php +++ b/module/CLI/src/Command/ShortUrl/CreateShortUrlCommand.php @@ -20,7 +20,7 @@ class CreateShortUrlCommand extends Command { - public const NAME = 'short-url:create'; + public const string NAME = 'short-url:create'; private SymfonyStyle $io; private readonly ShortUrlDataInput $shortUrlDataInput; diff --git a/module/CLI/src/Command/ShortUrl/DeleteExpiredShortUrlsCommand.php b/module/CLI/src/Command/ShortUrl/DeleteExpiredShortUrlsCommand.php index 109beff78..1fc9dc384 100644 --- a/module/CLI/src/Command/ShortUrl/DeleteExpiredShortUrlsCommand.php +++ b/module/CLI/src/Command/ShortUrl/DeleteExpiredShortUrlsCommand.php @@ -17,7 +17,7 @@ class DeleteExpiredShortUrlsCommand extends Command { - public const NAME = 'short-url:delete-expired'; + public const string NAME = 'short-url:delete-expired'; public function __construct(private readonly DeleteShortUrlServiceInterface $deleteShortUrlService) { diff --git a/module/CLI/src/Command/ShortUrl/DeleteShortUrlCommand.php b/module/CLI/src/Command/ShortUrl/DeleteShortUrlCommand.php index 63e9dab58..edda1b296 100644 --- a/module/CLI/src/Command/ShortUrl/DeleteShortUrlCommand.php +++ b/module/CLI/src/Command/ShortUrl/DeleteShortUrlCommand.php @@ -19,7 +19,7 @@ class DeleteShortUrlCommand extends Command { - public const NAME = 'short-url:delete'; + public const string NAME = 'short-url:delete'; private readonly ShortUrlIdentifierInput $shortUrlIdentifierInput; diff --git a/module/CLI/src/Command/ShortUrl/DeleteShortUrlVisitsCommand.php b/module/CLI/src/Command/ShortUrl/DeleteShortUrlVisitsCommand.php index a720e12dd..a9a709a10 100644 --- a/module/CLI/src/Command/ShortUrl/DeleteShortUrlVisitsCommand.php +++ b/module/CLI/src/Command/ShortUrl/DeleteShortUrlVisitsCommand.php @@ -16,7 +16,7 @@ class DeleteShortUrlVisitsCommand extends AbstractDeleteVisitsCommand { - public const NAME = 'short-url:visits-delete'; + public const string NAME = 'short-url:visits-delete'; private readonly ShortUrlIdentifierInput $shortUrlIdentifierInput; diff --git a/module/CLI/src/Command/ShortUrl/EditShortUrlCommand.php b/module/CLI/src/Command/ShortUrl/EditShortUrlCommand.php index 048b3934b..ad9aaf703 100644 --- a/module/CLI/src/Command/ShortUrl/EditShortUrlCommand.php +++ b/module/CLI/src/Command/ShortUrl/EditShortUrlCommand.php @@ -19,7 +19,7 @@ class EditShortUrlCommand extends Command { - public const NAME = 'short-url:edit'; + public const string NAME = 'short-url:edit'; private readonly ShortUrlDataInput $shortUrlDataInput; private readonly ShortUrlIdentifierInput $shortUrlIdentifierInput; diff --git a/module/CLI/src/Command/ShortUrl/GetShortUrlVisitsCommand.php b/module/CLI/src/Command/ShortUrl/GetShortUrlVisitsCommand.php index 8583a242e..8507b9ca1 100644 --- a/module/CLI/src/Command/ShortUrl/GetShortUrlVisitsCommand.php +++ b/module/CLI/src/Command/ShortUrl/GetShortUrlVisitsCommand.php @@ -16,7 +16,7 @@ class GetShortUrlVisitsCommand extends AbstractVisitsListCommand { - public const NAME = 'short-url:visits'; + public const string NAME = 'short-url:visits'; private ShortUrlIdentifierInput $shortUrlIdentifierInput; diff --git a/module/CLI/src/Command/ShortUrl/ListShortUrlsCommand.php b/module/CLI/src/Command/ShortUrl/ListShortUrlsCommand.php index fffeb1f61..72222a08f 100644 --- a/module/CLI/src/Command/ShortUrl/ListShortUrlsCommand.php +++ b/module/CLI/src/Command/ShortUrl/ListShortUrlsCommand.php @@ -33,7 +33,7 @@ class ListShortUrlsCommand extends Command { - public const NAME = 'short-url:list'; + public const string NAME = 'short-url:list'; private readonly StartDateOption $startDateOption; private readonly EndDateOption $endDateOption; diff --git a/module/CLI/src/Command/ShortUrl/ResolveUrlCommand.php b/module/CLI/src/Command/ShortUrl/ResolveUrlCommand.php index 0a207b685..7935df6d1 100644 --- a/module/CLI/src/Command/ShortUrl/ResolveUrlCommand.php +++ b/module/CLI/src/Command/ShortUrl/ResolveUrlCommand.php @@ -17,7 +17,7 @@ class ResolveUrlCommand extends Command { - public const NAME = 'short-url:parse'; + public const string NAME = 'short-url:parse'; private readonly ShortUrlIdentifierInput $shortUrlIdentifierInput; diff --git a/module/CLI/src/Command/Tag/DeleteTagsCommand.php b/module/CLI/src/Command/Tag/DeleteTagsCommand.php index cf05f1b5f..2f13e7759 100644 --- a/module/CLI/src/Command/Tag/DeleteTagsCommand.php +++ b/module/CLI/src/Command/Tag/DeleteTagsCommand.php @@ -14,9 +14,9 @@ class DeleteTagsCommand extends Command { - public const NAME = 'tag:delete'; + public const string NAME = 'tag:delete'; - public function __construct(private TagServiceInterface $tagService) + public function __construct(private readonly TagServiceInterface $tagService) { parent::__construct(); } diff --git a/module/CLI/src/Command/Tag/GetTagVisitsCommand.php b/module/CLI/src/Command/Tag/GetTagVisitsCommand.php index 18da41fbf..b3c083bc7 100644 --- a/module/CLI/src/Command/Tag/GetTagVisitsCommand.php +++ b/module/CLI/src/Command/Tag/GetTagVisitsCommand.php @@ -16,7 +16,7 @@ class GetTagVisitsCommand extends AbstractVisitsListCommand { - public const NAME = 'tag:visits'; + public const string NAME = 'tag:visits'; public function __construct( VisitsStatsHelperInterface $visitsHelper, diff --git a/module/CLI/src/Command/Tag/ListTagsCommand.php b/module/CLI/src/Command/Tag/ListTagsCommand.php index 2efeac5cf..8333b82e7 100644 --- a/module/CLI/src/Command/Tag/ListTagsCommand.php +++ b/module/CLI/src/Command/Tag/ListTagsCommand.php @@ -17,7 +17,7 @@ class ListTagsCommand extends Command { - public const NAME = 'tag:list'; + public const string NAME = 'tag:list'; public function __construct(private readonly TagServiceInterface $tagService) { diff --git a/module/CLI/src/Command/Tag/RenameTagCommand.php b/module/CLI/src/Command/Tag/RenameTagCommand.php index 5830858eb..42092d047 100644 --- a/module/CLI/src/Command/Tag/RenameTagCommand.php +++ b/module/CLI/src/Command/Tag/RenameTagCommand.php @@ -17,7 +17,7 @@ class RenameTagCommand extends Command { - public const NAME = 'tag:rename'; + public const string NAME = 'tag:rename'; public function __construct(private readonly TagServiceInterface $tagService) { diff --git a/module/CLI/src/Command/Util/LockedCommandConfig.php b/module/CLI/src/Command/Util/LockedCommandConfig.php index 8e3573294..a8834d92f 100644 --- a/module/CLI/src/Command/Util/LockedCommandConfig.php +++ b/module/CLI/src/Command/Util/LockedCommandConfig.php @@ -6,7 +6,7 @@ final class LockedCommandConfig { - public const DEFAULT_TTL = 600.0; // 10 minutes + public const float DEFAULT_TTL = 600.0; // 10 minutes private function __construct( public readonly string $lockName, diff --git a/module/CLI/src/Command/Visit/DeleteOrphanVisitsCommand.php b/module/CLI/src/Command/Visit/DeleteOrphanVisitsCommand.php index 2b34ae52e..056a9c603 100644 --- a/module/CLI/src/Command/Visit/DeleteOrphanVisitsCommand.php +++ b/module/CLI/src/Command/Visit/DeleteOrphanVisitsCommand.php @@ -13,7 +13,7 @@ class DeleteOrphanVisitsCommand extends AbstractDeleteVisitsCommand { - public const NAME = 'visit:orphan-delete'; + public const string NAME = 'visit:orphan-delete'; public function __construct(private readonly VisitsDeleterInterface $deleter) { diff --git a/module/CLI/src/Command/Visit/DownloadGeoLiteDbCommand.php b/module/CLI/src/Command/Visit/DownloadGeoLiteDbCommand.php index 41674a79b..0fdd8ae38 100644 --- a/module/CLI/src/Command/Visit/DownloadGeoLiteDbCommand.php +++ b/module/CLI/src/Command/Visit/DownloadGeoLiteDbCommand.php @@ -18,7 +18,7 @@ class DownloadGeoLiteDbCommand extends Command { - public const NAME = 'visit:download-db'; + public const string NAME = 'visit:download-db'; private ProgressBar|null $progressBar = null; diff --git a/module/CLI/src/Command/Visit/GetNonOrphanVisitsCommand.php b/module/CLI/src/Command/Visit/GetNonOrphanVisitsCommand.php index 580355095..445bd36fa 100644 --- a/module/CLI/src/Command/Visit/GetNonOrphanVisitsCommand.php +++ b/module/CLI/src/Command/Visit/GetNonOrphanVisitsCommand.php @@ -14,7 +14,7 @@ class GetNonOrphanVisitsCommand extends AbstractVisitsListCommand { - public const NAME = 'visit:non-orphan'; + public const string NAME = 'visit:non-orphan'; public function __construct( VisitsStatsHelperInterface $visitsHelper, diff --git a/module/CLI/src/Command/Visit/GetOrphanVisitsCommand.php b/module/CLI/src/Command/Visit/GetOrphanVisitsCommand.php index ea5c0fe2d..d282d3105 100644 --- a/module/CLI/src/Command/Visit/GetOrphanVisitsCommand.php +++ b/module/CLI/src/Command/Visit/GetOrphanVisitsCommand.php @@ -17,7 +17,7 @@ class GetOrphanVisitsCommand extends AbstractVisitsListCommand { - public const NAME = 'visit:orphan'; + public const string NAME = 'visit:orphan'; protected function configure(): void { diff --git a/module/CLI/src/Command/Visit/LocateVisitsCommand.php b/module/CLI/src/Command/Visit/LocateVisitsCommand.php index 596b287e9..66e33a787 100644 --- a/module/CLI/src/Command/Visit/LocateVisitsCommand.php +++ b/module/CLI/src/Command/Visit/LocateVisitsCommand.php @@ -29,7 +29,7 @@ class LocateVisitsCommand extends AbstractLockedCommand implements VisitGeolocationHelperInterface { - public const NAME = 'visit:locate'; + public const string NAME = 'visit:locate'; private SymfonyStyle $io; diff --git a/module/CLI/src/GeoLite/GeolocationDbUpdater.php b/module/CLI/src/GeoLite/GeolocationDbUpdater.php index 2a0fda3bb..7bdf8150e 100644 --- a/module/CLI/src/GeoLite/GeolocationDbUpdater.php +++ b/module/CLI/src/GeoLite/GeolocationDbUpdater.php @@ -20,7 +20,7 @@ class GeolocationDbUpdater implements GeolocationDbUpdaterInterface { - private const LOCK_NAME = 'geolocation-db-update'; + private const string LOCK_NAME = 'geolocation-db-update'; /** @var Closure(): Reader */ private readonly Closure $geoLiteDbReaderFactory; diff --git a/module/CLI/src/Util/ExitCode.php b/module/CLI/src/Util/ExitCode.php index 128b9f529..f2ffa16bd 100644 --- a/module/CLI/src/Util/ExitCode.php +++ b/module/CLI/src/Util/ExitCode.php @@ -6,7 +6,7 @@ final class ExitCode { - public const EXIT_SUCCESS = 0; - public const EXIT_FAILURE = -1; - public const EXIT_WARNING = 1; + public const int EXIT_SUCCESS = 0; + public const int EXIT_FAILURE = -1; + public const int EXIT_WARNING = 1; } diff --git a/module/CLI/src/Util/ShlinkTable.php b/module/CLI/src/Util/ShlinkTable.php index 108237344..ec0f768f8 100644 --- a/module/CLI/src/Util/ShlinkTable.php +++ b/module/CLI/src/Util/ShlinkTable.php @@ -12,8 +12,8 @@ final class ShlinkTable { - private const DEFAULT_STYLE_NAME = 'default'; - private const TABLE_TITLE_STYLE = ' %s '; + private const string DEFAULT_STYLE_NAME = 'default'; + private const string TABLE_TITLE_STYLE = ' %s '; private function __construct(private readonly Table $baseTable, private readonly bool $withRowSeparators = false) { diff --git a/module/Core/migrations/Version20230211171904.php b/module/Core/migrations/Version20230211171904.php index 1d1acbf77..ff275a8ea 100644 --- a/module/Core/migrations/Version20230211171904.php +++ b/module/Core/migrations/Version20230211171904.php @@ -10,7 +10,7 @@ final class Version20230211171904 extends AbstractMigration { - private const INDEX_NAME = 'IDX_visits_potential_bot'; + private const string INDEX_NAME = 'IDX_visits_potential_bot'; public function up(Schema $schema): void { diff --git a/module/Core/migrations/Version20230303164233.php b/module/Core/migrations/Version20230303164233.php index 3e64c03c0..ae9e7839f 100644 --- a/module/Core/migrations/Version20230303164233.php +++ b/module/Core/migrations/Version20230303164233.php @@ -10,7 +10,7 @@ final class Version20230303164233 extends AbstractMigration { - private const INDEX_NAME = 'visits_potential_bot_IDX'; + private const string INDEX_NAME = 'visits_potential_bot_IDX'; public function up(Schema $schema): void { diff --git a/module/Core/migrations/Version20240220214031.php b/module/Core/migrations/Version20240220214031.php index 3af587efa..b19176ef8 100644 --- a/module/Core/migrations/Version20240220214031.php +++ b/module/Core/migrations/Version20240220214031.php @@ -17,8 +17,12 @@ */ final class Version20240220214031 extends AbstractMigration { - private const DOMAINS_COLUMNS = ['base_url_redirect', 'regular_not_found_redirect', 'invalid_short_url_redirect']; - private const TEXT_COLUMNS = [ + private const array DOMAINS_COLUMNS = [ + 'base_url_redirect', + 'regular_not_found_redirect', + 'invalid_short_url_redirect', + ]; + private const array TEXT_COLUMNS = [ 'domains' => self::DOMAINS_COLUMNS, 'short_urls' => ['original_url'], ]; diff --git a/module/Core/migrations/Version20241124112257.php b/module/Core/migrations/Version20241124112257.php index c11cbe2bd..33807d0d7 100644 --- a/module/Core/migrations/Version20241124112257.php +++ b/module/Core/migrations/Version20241124112257.php @@ -11,7 +11,7 @@ final class Version20241124112257 extends AbstractMigration { - private const COLUMN_NAME = 'redirect_url'; + private const string COLUMN_NAME = 'redirect_url'; public function up(Schema $schema): void { diff --git a/module/Core/src/Action/Model/QrCodeParams.php b/module/Core/src/Action/Model/QrCodeParams.php index 3be9097e6..8bc5b317e 100644 --- a/module/Core/src/Action/Model/QrCodeParams.php +++ b/module/Core/src/Action/Model/QrCodeParams.php @@ -30,9 +30,9 @@ final class QrCodeParams { - private const MIN_SIZE = 50; - private const MAX_SIZE = 1000; - private const SUPPORTED_FORMATS = ['png', 'svg']; + private const int MIN_SIZE = 50; + private const int MAX_SIZE = 1000; + private const array SUPPORTED_FORMATS = ['png', 'svg']; private function __construct( public readonly int $size, diff --git a/module/Core/src/Config/NotFoundRedirectResolver.php b/module/Core/src/Config/NotFoundRedirectResolver.php index 657336c1b..dbdf81515 100644 --- a/module/Core/src/Config/NotFoundRedirectResolver.php +++ b/module/Core/src/Config/NotFoundRedirectResolver.php @@ -17,8 +17,8 @@ class NotFoundRedirectResolver implements NotFoundRedirectResolverInterface { - private const DOMAIN_PLACEHOLDER = '{DOMAIN}'; - private const ORIGINAL_PATH_PLACEHOLDER = '{ORIGINAL_PATH}'; + private const string DOMAIN_PLACEHOLDER = '{DOMAIN}'; + private const string ORIGINAL_PATH_PLACEHOLDER = '{ORIGINAL_PATH}'; public function __construct( private readonly RedirectResponseHelperInterface $redirectResponseHelper, diff --git a/module/Core/src/Config/PostProcessor/BasePathPrefixer.php b/module/Core/src/Config/PostProcessor/BasePathPrefixer.php index 616759f18..b8ed510c4 100644 --- a/module/Core/src/Config/PostProcessor/BasePathPrefixer.php +++ b/module/Core/src/Config/PostProcessor/BasePathPrefixer.php @@ -8,7 +8,7 @@ class BasePathPrefixer { - private const ELEMENTS_WITH_PATH = ['routes', 'middleware_pipeline']; + private const array ELEMENTS_WITH_PATH = ['routes', 'middleware_pipeline']; public function __invoke(array $config): array { diff --git a/module/Core/src/Config/PostProcessor/MultiSegmentSlugProcessor.php b/module/Core/src/Config/PostProcessor/MultiSegmentSlugProcessor.php index c4078890b..aa9eac06f 100644 --- a/module/Core/src/Config/PostProcessor/MultiSegmentSlugProcessor.php +++ b/module/Core/src/Config/PostProcessor/MultiSegmentSlugProcessor.php @@ -11,8 +11,8 @@ class MultiSegmentSlugProcessor { - private const SINGLE_SEGMENT_PATTERN = '{shortCode}'; - private const MULTI_SEGMENT_PATTERN = '{shortCode:.+}'; + private const string SINGLE_SEGMENT_PATTERN = '{shortCode}'; + private const string MULTI_SEGMENT_PATTERN = '{shortCode:.+}'; public function __invoke(array $config): array { diff --git a/module/Core/src/Domain/Entity/Domain.php b/module/Core/src/Domain/Entity/Domain.php index 628335cd0..b55a9dee2 100644 --- a/module/Core/src/Domain/Entity/Domain.php +++ b/module/Core/src/Domain/Entity/Domain.php @@ -11,7 +11,7 @@ class Domain extends AbstractEntity implements JsonSerializable, NotFoundRedirectConfigInterface { - public const DEFAULT_AUTHORITY = 'DEFAULT'; + public const string DEFAULT_AUTHORITY = 'DEFAULT'; private function __construct( public readonly string $authority, diff --git a/module/Core/src/Domain/Validation/DomainRedirectsInputFilter.php b/module/Core/src/Domain/Validation/DomainRedirectsInputFilter.php index d448b8198..39d9fa8e1 100644 --- a/module/Core/src/Domain/Validation/DomainRedirectsInputFilter.php +++ b/module/Core/src/Domain/Validation/DomainRedirectsInputFilter.php @@ -11,10 +11,10 @@ /** @extends InputFilter */ class DomainRedirectsInputFilter extends InputFilter { - public const DOMAIN = 'domain'; - public const BASE_URL_REDIRECT = 'baseUrlRedirect'; - public const REGULAR_404_REDIRECT = 'regular404Redirect'; - public const INVALID_SHORT_URL_REDIRECT = 'invalidShortUrlRedirect'; + public const string DOMAIN = 'domain'; + public const string BASE_URL_REDIRECT = 'baseUrlRedirect'; + public const string REGULAR_404_REDIRECT = 'regular404Redirect'; + public const string INVALID_SHORT_URL_REDIRECT = 'invalidShortUrlRedirect'; private function __construct() { diff --git a/module/Core/src/ErrorHandler/NotFoundTemplateHandler.php b/module/Core/src/ErrorHandler/NotFoundTemplateHandler.php index 9b59f886a..6fc3b5003 100644 --- a/module/Core/src/ErrorHandler/NotFoundTemplateHandler.php +++ b/module/Core/src/ErrorHandler/NotFoundTemplateHandler.php @@ -17,9 +17,9 @@ class NotFoundTemplateHandler implements RequestHandlerInterface { - private const TEMPLATES_BASE_DIR = __DIR__ . '/../../templates'; - public const NOT_FOUND_TEMPLATE = '404.html'; - public const INVALID_SHORT_CODE_TEMPLATE = 'invalid-short-code.html'; + private const string TEMPLATES_BASE_DIR = __DIR__ . '/../../templates'; + public const string NOT_FOUND_TEMPLATE = '404.html'; + public const string INVALID_SHORT_CODE_TEMPLATE = 'invalid-short-code.html'; private Closure $readFile; diff --git a/module/Core/src/Exception/DeleteShortUrlException.php b/module/Core/src/Exception/DeleteShortUrlException.php index 42198dc92..69e015592 100644 --- a/module/Core/src/Exception/DeleteShortUrlException.php +++ b/module/Core/src/Exception/DeleteShortUrlException.php @@ -16,8 +16,8 @@ class DeleteShortUrlException extends DomainException implements ProblemDetailsE { use CommonProblemDetailsExceptionTrait; - private const TITLE = 'Cannot delete short URL'; - public const ERROR_CODE = 'invalid-short-url-deletion'; + private const string TITLE = 'Cannot delete short URL'; + public const string ERROR_CODE = 'invalid-short-url-deletion'; public static function fromVisitsThreshold(int $threshold, ShortUrlIdentifier $identifier): self { diff --git a/module/Core/src/Exception/DomainNotFoundException.php b/module/Core/src/Exception/DomainNotFoundException.php index 688a4edc1..a3f6fd4a1 100644 --- a/module/Core/src/Exception/DomainNotFoundException.php +++ b/module/Core/src/Exception/DomainNotFoundException.php @@ -15,8 +15,8 @@ class DomainNotFoundException extends DomainException implements ProblemDetailsE { use CommonProblemDetailsExceptionTrait; - private const TITLE = 'Domain not found'; - public const ERROR_CODE = 'domain-not-found'; + private const string TITLE = 'Domain not found'; + public const string ERROR_CODE = 'domain-not-found'; private function __construct(string $message, array $additional) { diff --git a/module/Core/src/Exception/ForbiddenTagOperationException.php b/module/Core/src/Exception/ForbiddenTagOperationException.php index 64ae156c0..5c4efbc14 100644 --- a/module/Core/src/Exception/ForbiddenTagOperationException.php +++ b/module/Core/src/Exception/ForbiddenTagOperationException.php @@ -14,8 +14,8 @@ class ForbiddenTagOperationException extends DomainException implements ProblemD { use CommonProblemDetailsExceptionTrait; - private const TITLE = 'Forbidden tag operation'; - public const ERROR_CODE = 'forbidden-tag-operation'; + private const string TITLE = 'Forbidden tag operation'; + public const string ERROR_CODE = 'forbidden-tag-operation'; public static function forDeletion(): self { diff --git a/module/Core/src/Exception/NonUniqueSlugException.php b/module/Core/src/Exception/NonUniqueSlugException.php index 8f9508a26..99f1b2921 100644 --- a/module/Core/src/Exception/NonUniqueSlugException.php +++ b/module/Core/src/Exception/NonUniqueSlugException.php @@ -16,8 +16,8 @@ class NonUniqueSlugException extends InvalidArgumentException implements Problem { use CommonProblemDetailsExceptionTrait; - private const TITLE = 'Invalid custom slug'; - public const ERROR_CODE = 'non-unique-slug'; + private const string TITLE = 'Invalid custom slug'; + public const string ERROR_CODE = 'non-unique-slug'; public static function fromSlug(string $slug, string|null $domain = null): self { diff --git a/module/Core/src/Exception/ShortUrlNotFoundException.php b/module/Core/src/Exception/ShortUrlNotFoundException.php index 68087b537..a1a2135a0 100644 --- a/module/Core/src/Exception/ShortUrlNotFoundException.php +++ b/module/Core/src/Exception/ShortUrlNotFoundException.php @@ -16,8 +16,8 @@ class ShortUrlNotFoundException extends DomainException implements ProblemDetail { use CommonProblemDetailsExceptionTrait; - private const TITLE = 'Short URL not found'; - public const ERROR_CODE = 'short-url-not-found'; + private const string TITLE = 'Short URL not found'; + public const string ERROR_CODE = 'short-url-not-found'; public static function fromNotFound(ShortUrlIdentifier $identifier): self { diff --git a/module/Core/src/Exception/TagConflictException.php b/module/Core/src/Exception/TagConflictException.php index e05754c7c..a44a4a0cc 100644 --- a/module/Core/src/Exception/TagConflictException.php +++ b/module/Core/src/Exception/TagConflictException.php @@ -16,8 +16,8 @@ class TagConflictException extends RuntimeException implements ProblemDetailsExc { use CommonProblemDetailsExceptionTrait; - private const TITLE = 'Tag conflict'; - public const ERROR_CODE = 'tag-conflict'; + private const string TITLE = 'Tag conflict'; + public const string ERROR_CODE = 'tag-conflict'; public static function forExistingTag(Renaming $renaming): self { diff --git a/module/Core/src/Exception/TagNotFoundException.php b/module/Core/src/Exception/TagNotFoundException.php index 8fdd395a1..3bb4f9373 100644 --- a/module/Core/src/Exception/TagNotFoundException.php +++ b/module/Core/src/Exception/TagNotFoundException.php @@ -15,8 +15,8 @@ class TagNotFoundException extends DomainException implements ProblemDetailsExce { use CommonProblemDetailsExceptionTrait; - private const TITLE = 'Tag not found'; - public const ERROR_CODE = 'tag-not-found'; + private const string TITLE = 'Tag not found'; + public const string ERROR_CODE = 'tag-not-found'; public static function fromTag(string $tag): self { diff --git a/module/Core/src/Exception/ValidationException.php b/module/Core/src/Exception/ValidationException.php index f81c1d37b..61f01e6fd 100644 --- a/module/Core/src/Exception/ValidationException.php +++ b/module/Core/src/Exception/ValidationException.php @@ -21,8 +21,8 @@ class ValidationException extends InvalidArgumentException implements ProblemDet { use CommonProblemDetailsExceptionTrait; - private const TITLE = 'Invalid data'; - public const ERROR_CODE = 'invalid-data'; + private const string TITLE = 'Invalid data'; + public const string ERROR_CODE = 'invalid-data'; private array $invalidElements; diff --git a/module/Core/src/Matomo/MatomoTrackerBuilder.php b/module/Core/src/Matomo/MatomoTrackerBuilder.php index e006271bc..a65d9ad65 100644 --- a/module/Core/src/Matomo/MatomoTrackerBuilder.php +++ b/module/Core/src/Matomo/MatomoTrackerBuilder.php @@ -9,7 +9,7 @@ readonly class MatomoTrackerBuilder implements MatomoTrackerBuilderInterface { - public const MATOMO_DEFAULT_TIMEOUT = 10; // Time in seconds + public const int MATOMO_DEFAULT_TIMEOUT = 10; // Time in seconds public function __construct(private MatomoOptions $options) { diff --git a/module/Core/src/Model/Ordering.php b/module/Core/src/Model/Ordering.php index 0e0edab70..d06bee898 100644 --- a/module/Core/src/Model/Ordering.php +++ b/module/Core/src/Model/Ordering.php @@ -6,9 +6,9 @@ final readonly class Ordering { - private const DESC_DIR = 'DESC'; - private const ASC_DIR = 'ASC'; - private const DEFAULT_DIR = self::ASC_DIR; + private const string DESC_DIR = 'DESC'; + private const string ASC_DIR = 'ASC'; + private const string DEFAULT_DIR = self::ASC_DIR; public function __construct(public string|null $field = null, public string $direction = self::DEFAULT_DIR) { diff --git a/module/Core/src/RedirectRule/Model/Validation/RedirectRulesInputFilter.php b/module/Core/src/RedirectRule/Model/Validation/RedirectRulesInputFilter.php index 42520a971..c802d75f0 100644 --- a/module/Core/src/RedirectRule/Model/Validation/RedirectRulesInputFilter.php +++ b/module/Core/src/RedirectRule/Model/Validation/RedirectRulesInputFilter.php @@ -17,14 +17,14 @@ /** @extends InputFilter */ class RedirectRulesInputFilter extends InputFilter { - public const REDIRECT_RULES = 'redirectRules'; + public const string REDIRECT_RULES = 'redirectRules'; - public const RULE_LONG_URL = 'longUrl'; - public const RULE_CONDITIONS = 'conditions'; + public const string RULE_LONG_URL = 'longUrl'; + public const string RULE_CONDITIONS = 'conditions'; - public const CONDITION_TYPE = 'type'; - public const CONDITION_MATCH_VALUE = 'matchValue'; - public const CONDITION_MATCH_KEY = 'matchKey'; + public const string CONDITION_TYPE = 'type'; + public const string CONDITION_MATCH_VALUE = 'matchValue'; + public const string CONDITION_MATCH_KEY = 'matchKey'; private function __construct() { diff --git a/module/Core/src/ShortUrl/Helper/ShortUrlTitleResolutionHelper.php b/module/Core/src/ShortUrl/Helper/ShortUrlTitleResolutionHelper.php index df52c92d1..5af783455 100644 --- a/module/Core/src/ShortUrl/Helper/ShortUrlTitleResolutionHelper.php +++ b/module/Core/src/ShortUrl/Helper/ShortUrlTitleResolutionHelper.php @@ -21,14 +21,14 @@ readonly class ShortUrlTitleResolutionHelper implements ShortUrlTitleResolutionHelperInterface { - public const MAX_REDIRECTS = 15; - public const CHROME_USER_AGENT = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) ' + public const int MAX_REDIRECTS = 15; + public const string CHROME_USER_AGENT = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) ' . 'Chrome/121.0.0.0 Safari/537.36'; // Matches the value inside a html title tag - private const TITLE_TAG_VALUE = '/]*>(.*?)<\/title>/i'; + private const string TITLE_TAG_VALUE = '/]*>(.*?)<\/title>/i'; // Matches the charset inside a Content-Type header - private const CHARSET_VALUE = '/charset=([^;]+)/i'; + private const string CHARSET_VALUE = '/charset=([^;]+)/i'; public function __construct( private ClientInterface $httpClient, diff --git a/module/Core/src/ShortUrl/Middleware/TrimTrailingSlashMiddleware.php b/module/Core/src/ShortUrl/Middleware/TrimTrailingSlashMiddleware.php index 0b70c3ae0..4088f4503 100644 --- a/module/Core/src/ShortUrl/Middleware/TrimTrailingSlashMiddleware.php +++ b/module/Core/src/ShortUrl/Middleware/TrimTrailingSlashMiddleware.php @@ -14,7 +14,7 @@ class TrimTrailingSlashMiddleware implements MiddlewareInterface { - private const SHORT_CODE_ATTR = 'shortCode'; + private const string SHORT_CODE_ATTR = 'shortCode'; public function __construct(private readonly UrlShortenerOptions $options) { diff --git a/module/Core/src/ShortUrl/Model/Validation/CustomSlugValidator.php b/module/Core/src/ShortUrl/Model/Validation/CustomSlugValidator.php index 2bc417b42..f33416983 100644 --- a/module/Core/src/ShortUrl/Model/Validation/CustomSlugValidator.php +++ b/module/Core/src/ShortUrl/Model/Validation/CustomSlugValidator.php @@ -12,8 +12,8 @@ class CustomSlugValidator extends AbstractValidator { - private const NOT_STRING = 'NOT_STRING'; - private const CONTAINS_URL_CHARACTERS = 'CONTAINS_URL_CHARACTERS'; + private const string NOT_STRING = 'NOT_STRING'; + private const string CONTAINS_URL_CHARACTERS = 'CONTAINS_URL_CHARACTERS'; protected array $messageTemplates = [ self::NOT_STRING => 'Provided value is not a string.', diff --git a/module/Core/src/ShortUrl/Model/Validation/ShortUrlInputFilter.php b/module/Core/src/ShortUrl/Model/Validation/ShortUrlInputFilter.php index 5cd7fe38d..88b629e87 100644 --- a/module/Core/src/ShortUrl/Model/Validation/ShortUrlInputFilter.php +++ b/module/Core/src/ShortUrl/Model/Validation/ShortUrlInputFilter.php @@ -24,22 +24,22 @@ class ShortUrlInputFilter extends InputFilter { // Fields for creation only - public const SHORT_CODE_LENGTH = 'shortCodeLength'; - public const CUSTOM_SLUG = 'customSlug'; - public const PATH_PREFIX = 'pathPrefix'; - public const FIND_IF_EXISTS = 'findIfExists'; - public const DOMAIN = 'domain'; + public const string SHORT_CODE_LENGTH = 'shortCodeLength'; + public const string CUSTOM_SLUG = 'customSlug'; + public const string PATH_PREFIX = 'pathPrefix'; + public const string FIND_IF_EXISTS = 'findIfExists'; + public const string DOMAIN = 'domain'; // Fields for creation and edition - public const LONG_URL = 'longUrl'; - public const VALID_SINCE = 'validSince'; - public const VALID_UNTIL = 'validUntil'; - public const MAX_VISITS = 'maxVisits'; - public const TITLE = 'title'; - public const TAGS = 'tags'; - public const CRAWLABLE = 'crawlable'; - public const FORWARD_QUERY = 'forwardQuery'; - public const API_KEY = 'apiKey'; + public const string LONG_URL = 'longUrl'; + public const string VALID_SINCE = 'validSince'; + public const string VALID_UNTIL = 'validUntil'; + public const string MAX_VISITS = 'maxVisits'; + public const string TITLE = 'title'; + public const string TAGS = 'tags'; + public const string CRAWLABLE = 'crawlable'; + public const string FORWARD_QUERY = 'forwardQuery'; + public const string API_KEY = 'apiKey'; public static function forCreation(array $data, UrlShortenerOptions $options): self { diff --git a/module/Core/src/ShortUrl/Model/Validation/ShortUrlsParamsInputFilter.php b/module/Core/src/ShortUrl/Model/Validation/ShortUrlsParamsInputFilter.php index 600ebc339..bc9de3379 100644 --- a/module/Core/src/ShortUrl/Model/Validation/ShortUrlsParamsInputFilter.php +++ b/module/Core/src/ShortUrl/Model/Validation/ShortUrlsParamsInputFilter.php @@ -16,17 +16,17 @@ /** @extends InputFilter */ class ShortUrlsParamsInputFilter extends InputFilter { - public const PAGE = 'page'; - public const SEARCH_TERM = 'searchTerm'; - public const TAGS = 'tags'; - public const START_DATE = 'startDate'; - public const END_DATE = 'endDate'; - public const ITEMS_PER_PAGE = 'itemsPerPage'; - public const TAGS_MODE = 'tagsMode'; - public const ORDER_BY = 'orderBy'; - public const EXCLUDE_MAX_VISITS_REACHED = 'excludeMaxVisitsReached'; - public const EXCLUDE_PAST_VALID_UNTIL = 'excludePastValidUntil'; - public const DOMAIN = 'domain'; + public const string PAGE = 'page'; + public const string SEARCH_TERM = 'searchTerm'; + public const string TAGS = 'tags'; + public const string START_DATE = 'startDate'; + public const string END_DATE = 'endDate'; + public const string ITEMS_PER_PAGE = 'itemsPerPage'; + public const string TAGS_MODE = 'tagsMode'; + public const string ORDER_BY = 'orderBy'; + public const string EXCLUDE_MAX_VISITS_REACHED = 'excludeMaxVisitsReached'; + public const string EXCLUDE_PAST_VALID_UNTIL = 'excludePastValidUntil'; + public const string DOMAIN = 'domain'; public function __construct(array $data) { diff --git a/module/Core/src/Visit/Model/Visitor.php b/module/Core/src/Visit/Model/Visitor.php index cab834e6a..ae02a1a36 100644 --- a/module/Core/src/Visit/Model/Visitor.php +++ b/module/Core/src/Visit/Model/Visitor.php @@ -17,11 +17,11 @@ final readonly class Visitor { - public const USER_AGENT_MAX_LENGTH = 512; - public const REFERER_MAX_LENGTH = 1024; - public const REMOTE_ADDRESS_MAX_LENGTH = 256; - public const VISITED_URL_MAX_LENGTH = 2048; - public const REDIRECT_URL_MAX_LENGTH = 2048; + public const int USER_AGENT_MAX_LENGTH = 512; + public const int REFERER_MAX_LENGTH = 1024; + public const int REMOTE_ADDRESS_MAX_LENGTH = 256; + public const int VISITED_URL_MAX_LENGTH = 2048; + public const int REDIRECT_URL_MAX_LENGTH = 2048; private function __construct( public string $userAgent, diff --git a/module/Core/src/Visit/Repository/VisitIterationRepositoryInterface.php b/module/Core/src/Visit/Repository/VisitIterationRepositoryInterface.php index 2f4163240..ca9d6405f 100644 --- a/module/Core/src/Visit/Repository/VisitIterationRepositoryInterface.php +++ b/module/Core/src/Visit/Repository/VisitIterationRepositoryInterface.php @@ -9,7 +9,7 @@ interface VisitIterationRepositoryInterface { - public const DEFAULT_BLOCK_SIZE = 10000; + public const int DEFAULT_BLOCK_SIZE = 10000; /** * @return iterable diff --git a/module/Core/test/Action/QrCodeActionTest.php b/module/Core/test/Action/QrCodeActionTest.php index f8dea217c..688badee1 100644 --- a/module/Core/test/Action/QrCodeActionTest.php +++ b/module/Core/test/Action/QrCodeActionTest.php @@ -32,8 +32,8 @@ class QrCodeActionTest extends TestCase { - private const WHITE = 0xFFFFFF; - private const BLACK = 0x0; + private const int WHITE = 0xFFFFFF; + private const int BLACK = 0x0; private MockObject & ShortUrlResolverInterface $urlResolver; diff --git a/module/Core/test/Action/RedirectActionTest.php b/module/Core/test/Action/RedirectActionTest.php index fa4a561d0..59e1a5b8c 100644 --- a/module/Core/test/Action/RedirectActionTest.php +++ b/module/Core/test/Action/RedirectActionTest.php @@ -23,7 +23,7 @@ class RedirectActionTest extends TestCase { - private const LONG_URL = 'https://domain.com/foo/bar?some=thing'; + private const string LONG_URL = 'https://domain.com/foo/bar?some=thing'; private RedirectAction $action; private MockObject & ShortUrlResolverInterface $urlResolver; diff --git a/module/Core/test/ShortUrl/Helper/ShortUrlTitleResolutionHelperTest.php b/module/Core/test/ShortUrl/Helper/ShortUrlTitleResolutionHelperTest.php index d73a1a6d8..b11a28a3f 100644 --- a/module/Core/test/ShortUrl/Helper/ShortUrlTitleResolutionHelperTest.php +++ b/module/Core/test/ShortUrl/Helper/ShortUrlTitleResolutionHelperTest.php @@ -22,7 +22,7 @@ class ShortUrlTitleResolutionHelperTest extends TestCase { - private const LONG_URL = 'http://foobar.com/12345/hello?foo=bar'; + private const string LONG_URL = 'http://foobar.com/12345/hello?foo=bar'; private MockObject & ClientInterface $httpClient; diff --git a/module/Core/test/Visit/RequestTrackerTest.php b/module/Core/test/Visit/RequestTrackerTest.php index f9357c6ac..e7c2ef16d 100644 --- a/module/Core/test/Visit/RequestTrackerTest.php +++ b/module/Core/test/Visit/RequestTrackerTest.php @@ -23,7 +23,7 @@ class RequestTrackerTest extends TestCase { - private const LONG_URL = 'https://domain.com/foo/bar?some=thing'; + private const string LONG_URL = 'https://domain.com/foo/bar?some=thing'; private RequestTracker $requestTracker; private MockObject & VisitsTrackerInterface $visitsTracker; diff --git a/module/Rest/src/Action/AbstractRestAction.php b/module/Rest/src/Action/AbstractRestAction.php index f330bab18..b51c2f466 100644 --- a/module/Rest/src/Action/AbstractRestAction.php +++ b/module/Rest/src/Action/AbstractRestAction.php @@ -10,8 +10,8 @@ abstract class AbstractRestAction implements RequestHandlerInterface, RequestMethodInterface, StatusCodeInterface { - protected const ROUTE_PATH = ''; - protected const ROUTE_ALLOWED_METHODS = []; + protected const string ROUTE_PATH = ''; + protected const array ROUTE_ALLOWED_METHODS = []; public static function getRouteDef(array $prevMiddleware = [], array $postMiddleware = []): array { diff --git a/module/Rest/src/Action/Domain/DomainRedirectsAction.php b/module/Rest/src/Action/Domain/DomainRedirectsAction.php index e98aa339b..bc48d2d04 100644 --- a/module/Rest/src/Action/Domain/DomainRedirectsAction.php +++ b/module/Rest/src/Action/Domain/DomainRedirectsAction.php @@ -14,10 +14,10 @@ class DomainRedirectsAction extends AbstractRestAction { - protected const ROUTE_PATH = '/domains/redirects'; - protected const ROUTE_ALLOWED_METHODS = [self::METHOD_PATCH]; + protected const string ROUTE_PATH = '/domains/redirects'; + protected const array ROUTE_ALLOWED_METHODS = [self::METHOD_PATCH]; - public function __construct(private DomainServiceInterface $domainService) + public function __construct(private readonly DomainServiceInterface $domainService) { } diff --git a/module/Rest/src/Action/Domain/ListDomainsAction.php b/module/Rest/src/Action/Domain/ListDomainsAction.php index d156a7202..4007ab588 100644 --- a/module/Rest/src/Action/Domain/ListDomainsAction.php +++ b/module/Rest/src/Action/Domain/ListDomainsAction.php @@ -15,11 +15,13 @@ class ListDomainsAction extends AbstractRestAction { - protected const ROUTE_PATH = '/domains'; - protected const ROUTE_ALLOWED_METHODS = [self::METHOD_GET]; + protected const string ROUTE_PATH = '/domains'; + protected const array ROUTE_ALLOWED_METHODS = [self::METHOD_GET]; - public function __construct(private DomainServiceInterface $domainService, private NotFoundRedirectOptions $options) - { + public function __construct( + private readonly DomainServiceInterface $domainService, + private readonly NotFoundRedirectOptions $options, + ) { } public function handle(ServerRequestInterface $request): ResponseInterface diff --git a/module/Rest/src/Action/HealthAction.php b/module/Rest/src/Action/HealthAction.php index ce7313309..be47428db 100644 --- a/module/Rest/src/Action/HealthAction.php +++ b/module/Rest/src/Action/HealthAction.php @@ -13,14 +13,14 @@ class HealthAction extends AbstractRestAction { - private const HEALTH_CONTENT_TYPE = 'application/health+json'; - private const STATUS_PASS = 'pass'; - private const STATUS_FAIL = 'fail'; + private const string HEALTH_CONTENT_TYPE = 'application/health+json'; + private const string STATUS_PASS = 'pass'; + private const string STATUS_FAIL = 'fail'; - public const ROUTE_PATH = '/health'; - protected const ROUTE_ALLOWED_METHODS = [self::METHOD_GET]; + public const string ROUTE_PATH = '/health'; + protected const array ROUTE_ALLOWED_METHODS = [self::METHOD_GET]; - public function __construct(private EntityManagerInterface $em, private AppOptions $options) + public function __construct(private readonly EntityManagerInterface $em, private readonly AppOptions $options) { } diff --git a/module/Rest/src/Action/MercureInfoAction.php b/module/Rest/src/Action/MercureInfoAction.php index 1454cbbcb..873945948 100644 --- a/module/Rest/src/Action/MercureInfoAction.php +++ b/module/Rest/src/Action/MercureInfoAction.php @@ -15,11 +15,13 @@ class MercureInfoAction extends AbstractRestAction { - protected const ROUTE_PATH = '/mercure-info'; - protected const ROUTE_ALLOWED_METHODS = [self::METHOD_GET]; + protected const string ROUTE_PATH = '/mercure-info'; + protected const array ROUTE_ALLOWED_METHODS = [self::METHOD_GET]; - public function __construct(private JwtProviderInterface $jwtProvider, private array $mercureConfig) - { + public function __construct( + private readonly JwtProviderInterface $jwtProvider, + private readonly array $mercureConfig + ) { } public function handle(ServerRequestInterface $request): ResponseInterface diff --git a/module/Rest/src/Action/RedirectRule/ListRedirectRulesAction.php b/module/Rest/src/Action/RedirectRule/ListRedirectRulesAction.php index c6c12fd98..ab48bd1ef 100644 --- a/module/Rest/src/Action/RedirectRule/ListRedirectRulesAction.php +++ b/module/Rest/src/Action/RedirectRule/ListRedirectRulesAction.php @@ -13,8 +13,8 @@ class ListRedirectRulesAction extends AbstractRestAction { - protected const ROUTE_PATH = '/short-urls/{shortCode}/redirect-rules'; - protected const ROUTE_ALLOWED_METHODS = [self::METHOD_GET]; + protected const string ROUTE_PATH = '/short-urls/{shortCode}/redirect-rules'; + protected const array ROUTE_ALLOWED_METHODS = [self::METHOD_GET]; public function __construct( private readonly ShortUrlResolverInterface $urlResolver, diff --git a/module/Rest/src/Action/RedirectRule/SetRedirectRulesAction.php b/module/Rest/src/Action/RedirectRule/SetRedirectRulesAction.php index 913a833da..1f2668218 100644 --- a/module/Rest/src/Action/RedirectRule/SetRedirectRulesAction.php +++ b/module/Rest/src/Action/RedirectRule/SetRedirectRulesAction.php @@ -16,8 +16,8 @@ class SetRedirectRulesAction extends AbstractRestAction { - protected const ROUTE_PATH = '/short-urls/{shortCode}/redirect-rules'; - protected const ROUTE_ALLOWED_METHODS = [self::METHOD_POST, self::METHOD_PATCH]; + protected const string ROUTE_PATH = '/short-urls/{shortCode}/redirect-rules'; + protected const array ROUTE_ALLOWED_METHODS = [self::METHOD_POST, self::METHOD_PATCH]; public function __construct( private readonly ShortUrlResolverInterface $urlResolver, diff --git a/module/Rest/src/Action/ShortUrl/CreateShortUrlAction.php b/module/Rest/src/Action/ShortUrl/CreateShortUrlAction.php index 67509f1ba..6f5e291ca 100644 --- a/module/Rest/src/Action/ShortUrl/CreateShortUrlAction.php +++ b/module/Rest/src/Action/ShortUrl/CreateShortUrlAction.php @@ -12,8 +12,8 @@ class CreateShortUrlAction extends AbstractCreateShortUrlAction { - protected const ROUTE_PATH = '/short-urls'; - protected const ROUTE_ALLOWED_METHODS = [self::METHOD_POST]; + protected const string ROUTE_PATH = '/short-urls'; + protected const array ROUTE_ALLOWED_METHODS = [self::METHOD_POST]; /** * @throws ValidationException diff --git a/module/Rest/src/Action/ShortUrl/DeleteShortUrlAction.php b/module/Rest/src/Action/ShortUrl/DeleteShortUrlAction.php index c1511f77a..b2570d363 100644 --- a/module/Rest/src/Action/ShortUrl/DeleteShortUrlAction.php +++ b/module/Rest/src/Action/ShortUrl/DeleteShortUrlAction.php @@ -14,8 +14,8 @@ class DeleteShortUrlAction extends AbstractRestAction { - protected const ROUTE_PATH = '/short-urls/{shortCode}'; - protected const ROUTE_ALLOWED_METHODS = [self::METHOD_DELETE]; + protected const string ROUTE_PATH = '/short-urls/{shortCode}'; + protected const array ROUTE_ALLOWED_METHODS = [self::METHOD_DELETE]; public function __construct(private DeleteShortUrlServiceInterface $deleteShortUrlService) { diff --git a/module/Rest/src/Action/ShortUrl/DeleteShortUrlVisitsAction.php b/module/Rest/src/Action/ShortUrl/DeleteShortUrlVisitsAction.php index c9eaf9585..8085a6823 100644 --- a/module/Rest/src/Action/ShortUrl/DeleteShortUrlVisitsAction.php +++ b/module/Rest/src/Action/ShortUrl/DeleteShortUrlVisitsAction.php @@ -14,8 +14,8 @@ class DeleteShortUrlVisitsAction extends AbstractRestAction { - protected const ROUTE_PATH = '/short-urls/{shortCode}/visits'; - protected const ROUTE_ALLOWED_METHODS = [self::METHOD_DELETE]; + protected const string ROUTE_PATH = '/short-urls/{shortCode}/visits'; + protected const array ROUTE_ALLOWED_METHODS = [self::METHOD_DELETE]; public function __construct(private readonly ShortUrlVisitsDeleterInterface $deleter) { diff --git a/module/Rest/src/Action/ShortUrl/EditShortUrlAction.php b/module/Rest/src/Action/ShortUrl/EditShortUrlAction.php index b4b815a4e..acdc2cb44 100644 --- a/module/Rest/src/Action/ShortUrl/EditShortUrlAction.php +++ b/module/Rest/src/Action/ShortUrl/EditShortUrlAction.php @@ -16,8 +16,8 @@ class EditShortUrlAction extends AbstractRestAction { - protected const ROUTE_PATH = '/short-urls/{shortCode}'; - protected const ROUTE_ALLOWED_METHODS = [self::METHOD_PATCH]; + protected const string ROUTE_PATH = '/short-urls/{shortCode}'; + protected const array ROUTE_ALLOWED_METHODS = [self::METHOD_PATCH]; public function __construct( private readonly ShortUrlServiceInterface $shortUrlService, diff --git a/module/Rest/src/Action/ShortUrl/ListShortUrlsAction.php b/module/Rest/src/Action/ShortUrl/ListShortUrlsAction.php index b21f50fde..4b9991b9f 100644 --- a/module/Rest/src/Action/ShortUrl/ListShortUrlsAction.php +++ b/module/Rest/src/Action/ShortUrl/ListShortUrlsAction.php @@ -16,8 +16,8 @@ class ListShortUrlsAction extends AbstractRestAction { - protected const ROUTE_PATH = '/short-urls'; - protected const ROUTE_ALLOWED_METHODS = [self::METHOD_GET]; + protected const string ROUTE_PATH = '/short-urls'; + protected const array ROUTE_ALLOWED_METHODS = [self::METHOD_GET]; public function __construct( private readonly ShortUrlListServiceInterface $shortUrlService, diff --git a/module/Rest/src/Action/ShortUrl/ResolveShortUrlAction.php b/module/Rest/src/Action/ShortUrl/ResolveShortUrlAction.php index 39a9d7f22..3faae433d 100644 --- a/module/Rest/src/Action/ShortUrl/ResolveShortUrlAction.php +++ b/module/Rest/src/Action/ShortUrl/ResolveShortUrlAction.php @@ -15,8 +15,8 @@ class ResolveShortUrlAction extends AbstractRestAction { - protected const ROUTE_PATH = '/short-urls/{shortCode}'; - protected const ROUTE_ALLOWED_METHODS = [self::METHOD_GET]; + protected const string ROUTE_PATH = '/short-urls/{shortCode}'; + protected const array ROUTE_ALLOWED_METHODS = [self::METHOD_GET]; public function __construct( private readonly ShortUrlResolverInterface $urlResolver, diff --git a/module/Rest/src/Action/ShortUrl/SingleStepCreateShortUrlAction.php b/module/Rest/src/Action/ShortUrl/SingleStepCreateShortUrlAction.php index d7f5a3603..039b82d4f 100644 --- a/module/Rest/src/Action/ShortUrl/SingleStepCreateShortUrlAction.php +++ b/module/Rest/src/Action/ShortUrl/SingleStepCreateShortUrlAction.php @@ -11,8 +11,8 @@ class SingleStepCreateShortUrlAction extends AbstractCreateShortUrlAction { - protected const ROUTE_PATH = '/short-urls/shorten'; - protected const ROUTE_ALLOWED_METHODS = [self::METHOD_GET]; + protected const string ROUTE_PATH = '/short-urls/shorten'; + protected const array ROUTE_ALLOWED_METHODS = [self::METHOD_GET]; protected function buildShortUrlData(Request $request): ShortUrlCreation { diff --git a/module/Rest/src/Action/Tag/DeleteTagsAction.php b/module/Rest/src/Action/Tag/DeleteTagsAction.php index 48e7acd96..8c45acf7d 100644 --- a/module/Rest/src/Action/Tag/DeleteTagsAction.php +++ b/module/Rest/src/Action/Tag/DeleteTagsAction.php @@ -13,10 +13,10 @@ class DeleteTagsAction extends AbstractRestAction { - protected const ROUTE_PATH = '/tags'; - protected const ROUTE_ALLOWED_METHODS = [self::METHOD_DELETE]; + protected const string ROUTE_PATH = '/tags'; + protected const array ROUTE_ALLOWED_METHODS = [self::METHOD_DELETE]; - public function __construct(private TagServiceInterface $tagService) + public function __construct(private readonly TagServiceInterface $tagService) { } diff --git a/module/Rest/src/Action/Tag/ListTagsAction.php b/module/Rest/src/Action/Tag/ListTagsAction.php index 426f94e75..826ed112e 100644 --- a/module/Rest/src/Action/Tag/ListTagsAction.php +++ b/module/Rest/src/Action/Tag/ListTagsAction.php @@ -15,8 +15,8 @@ class ListTagsAction extends AbstractRestAction { - protected const ROUTE_PATH = '/tags'; - protected const ROUTE_ALLOWED_METHODS = [self::METHOD_GET]; + protected const string ROUTE_PATH = '/tags'; + protected const array ROUTE_ALLOWED_METHODS = [self::METHOD_GET]; public function __construct(private readonly TagServiceInterface $tagService) { diff --git a/module/Rest/src/Action/Tag/TagsStatsAction.php b/module/Rest/src/Action/Tag/TagsStatsAction.php index 1ae470e07..827f62418 100644 --- a/module/Rest/src/Action/Tag/TagsStatsAction.php +++ b/module/Rest/src/Action/Tag/TagsStatsAction.php @@ -15,8 +15,8 @@ class TagsStatsAction extends AbstractRestAction { - protected const ROUTE_PATH = '/tags/stats'; - protected const ROUTE_ALLOWED_METHODS = [self::METHOD_GET]; + protected const string ROUTE_PATH = '/tags/stats'; + protected const array ROUTE_ALLOWED_METHODS = [self::METHOD_GET]; public function __construct(private readonly TagServiceInterface $tagService) { diff --git a/module/Rest/src/Action/Visit/AbstractListVisitsAction.php b/module/Rest/src/Action/Visit/AbstractListVisitsAction.php index 090d30787..b63133fa0 100644 --- a/module/Rest/src/Action/Visit/AbstractListVisitsAction.php +++ b/module/Rest/src/Action/Visit/AbstractListVisitsAction.php @@ -18,7 +18,7 @@ abstract class AbstractListVisitsAction extends AbstractRestAction { - protected const ROUTE_ALLOWED_METHODS = [self::METHOD_GET]; + protected const array ROUTE_ALLOWED_METHODS = [self::METHOD_GET]; public function __construct(protected readonly VisitsStatsHelperInterface $visitsHelper) { diff --git a/module/Rest/src/Action/Visit/DeleteOrphanVisitsAction.php b/module/Rest/src/Action/Visit/DeleteOrphanVisitsAction.php index 3a0164518..c08de858b 100644 --- a/module/Rest/src/Action/Visit/DeleteOrphanVisitsAction.php +++ b/module/Rest/src/Action/Visit/DeleteOrphanVisitsAction.php @@ -13,8 +13,8 @@ class DeleteOrphanVisitsAction extends AbstractRestAction { - protected const ROUTE_PATH = '/visits/orphan'; - protected const ROUTE_ALLOWED_METHODS = [self::METHOD_DELETE]; + protected const string ROUTE_PATH = '/visits/orphan'; + protected const array ROUTE_ALLOWED_METHODS = [self::METHOD_DELETE]; public function __construct(private readonly VisitsDeleterInterface $visitsDeleter) { diff --git a/module/Rest/src/Action/Visit/DomainVisitsAction.php b/module/Rest/src/Action/Visit/DomainVisitsAction.php index ee1625e00..0e0279559 100644 --- a/module/Rest/src/Action/Visit/DomainVisitsAction.php +++ b/module/Rest/src/Action/Visit/DomainVisitsAction.php @@ -14,7 +14,7 @@ class DomainVisitsAction extends AbstractListVisitsAction { - protected const ROUTE_PATH = '/domains/{domain}/visits'; + protected const string ROUTE_PATH = '/domains/{domain}/visits'; public function __construct( VisitsStatsHelperInterface $visitsHelper, diff --git a/module/Rest/src/Action/Visit/GlobalVisitsAction.php b/module/Rest/src/Action/Visit/GlobalVisitsAction.php index 1f2e1211e..779fd4a3a 100644 --- a/module/Rest/src/Action/Visit/GlobalVisitsAction.php +++ b/module/Rest/src/Action/Visit/GlobalVisitsAction.php @@ -13,10 +13,10 @@ class GlobalVisitsAction extends AbstractRestAction { - protected const ROUTE_PATH = '/visits'; - protected const ROUTE_ALLOWED_METHODS = [self::METHOD_GET]; + protected const string ROUTE_PATH = '/visits'; + protected const array ROUTE_ALLOWED_METHODS = [self::METHOD_GET]; - public function __construct(private VisitsStatsHelperInterface $statsHelper) + public function __construct(private readonly VisitsStatsHelperInterface $statsHelper) { } diff --git a/module/Rest/src/Action/Visit/NonOrphanVisitsAction.php b/module/Rest/src/Action/Visit/NonOrphanVisitsAction.php index 8406b515b..b2f7471b2 100644 --- a/module/Rest/src/Action/Visit/NonOrphanVisitsAction.php +++ b/module/Rest/src/Action/Visit/NonOrphanVisitsAction.php @@ -11,7 +11,7 @@ class NonOrphanVisitsAction extends AbstractListVisitsAction { - protected const ROUTE_PATH = '/visits/non-orphan'; + protected const string ROUTE_PATH = '/visits/non-orphan'; protected function getVisitsPaginator( ServerRequestInterface $request, diff --git a/module/Rest/src/Action/Visit/OrphanVisitsAction.php b/module/Rest/src/Action/Visit/OrphanVisitsAction.php index 341524c35..b3c246ca4 100644 --- a/module/Rest/src/Action/Visit/OrphanVisitsAction.php +++ b/module/Rest/src/Action/Visit/OrphanVisitsAction.php @@ -12,7 +12,7 @@ class OrphanVisitsAction extends AbstractListVisitsAction { - protected const ROUTE_PATH = '/visits/orphan'; + protected const string ROUTE_PATH = '/visits/orphan'; protected function getVisitsPaginator( ServerRequestInterface $request, diff --git a/module/Rest/src/Action/Visit/ShortUrlVisitsAction.php b/module/Rest/src/Action/Visit/ShortUrlVisitsAction.php index 95ac42cc6..d8fc36e9a 100644 --- a/module/Rest/src/Action/Visit/ShortUrlVisitsAction.php +++ b/module/Rest/src/Action/Visit/ShortUrlVisitsAction.php @@ -12,7 +12,7 @@ class ShortUrlVisitsAction extends AbstractListVisitsAction { - protected const ROUTE_PATH = '/short-urls/{shortCode}/visits'; + protected const string ROUTE_PATH = '/short-urls/{shortCode}/visits'; protected function getVisitsPaginator(Request $request, VisitsParams $params, ApiKey $apiKey): Pagerfanta { diff --git a/module/Rest/src/Action/Visit/TagVisitsAction.php b/module/Rest/src/Action/Visit/TagVisitsAction.php index 08553ec53..07ad7167e 100644 --- a/module/Rest/src/Action/Visit/TagVisitsAction.php +++ b/module/Rest/src/Action/Visit/TagVisitsAction.php @@ -11,7 +11,7 @@ class TagVisitsAction extends AbstractListVisitsAction { - protected const ROUTE_PATH = '/tags/{tag}/visits'; + protected const string ROUTE_PATH = '/tags/{tag}/visits'; protected function getVisitsPaginator(Request $request, VisitsParams $params, ApiKey $apiKey): Pagerfanta { diff --git a/module/Rest/src/ConfigProvider.php b/module/Rest/src/ConfigProvider.php index 1768c7c8b..95a70b0c3 100644 --- a/module/Rest/src/ConfigProvider.php +++ b/module/Rest/src/ConfigProvider.php @@ -12,9 +12,9 @@ class ConfigProvider { - private const ROUTES_PREFIX = '/rest/v{version:1|2|3}'; - private const UNVERSIONED_ROUTES_PREFIX = '/rest'; - public const UNVERSIONED_HEALTH_ENDPOINT_NAME = 'unversioned_health'; + private const string ROUTES_PREFIX = '/rest/v{version:1|2|3}'; + private const string UNVERSIONED_ROUTES_PREFIX = '/rest'; + public const string UNVERSIONED_HEALTH_ENDPOINT_NAME = 'unversioned_health'; public function __invoke(): array { diff --git a/module/Rest/src/Exception/MercureException.php b/module/Rest/src/Exception/MercureException.php index 7e47b519e..c97e701b9 100644 --- a/module/Rest/src/Exception/MercureException.php +++ b/module/Rest/src/Exception/MercureException.php @@ -14,8 +14,8 @@ class MercureException extends RuntimeException implements ProblemDetailsExcepti { use CommonProblemDetailsExceptionTrait; - private const TITLE = 'Mercure integration not configured'; - public const ERROR_CODE = 'mercure-not-configured'; + private const string TITLE = 'Mercure integration not configured'; + public const string ERROR_CODE = 'mercure-not-configured'; public static function mercureNotConfigured(): self { diff --git a/module/Rest/src/Exception/MissingAuthenticationException.php b/module/Rest/src/Exception/MissingAuthenticationException.php index 3fd2e2c68..ff0c60268 100644 --- a/module/Rest/src/Exception/MissingAuthenticationException.php +++ b/module/Rest/src/Exception/MissingAuthenticationException.php @@ -16,8 +16,8 @@ class MissingAuthenticationException extends RuntimeException implements Problem { use CommonProblemDetailsExceptionTrait; - private const TITLE = 'Invalid authorization'; - public const ERROR_CODE = 'missing-authentication'; + private const string TITLE = 'Invalid authorization'; + public const string ERROR_CODE = 'missing-authentication'; public static function forHeaders(array $expectedHeaders): self { diff --git a/module/Rest/src/Exception/VerifyAuthenticationException.php b/module/Rest/src/Exception/VerifyAuthenticationException.php index 25f1b0503..9ed03fe16 100644 --- a/module/Rest/src/Exception/VerifyAuthenticationException.php +++ b/module/Rest/src/Exception/VerifyAuthenticationException.php @@ -14,7 +14,7 @@ class VerifyAuthenticationException extends RuntimeException implements ProblemD { use CommonProblemDetailsExceptionTrait; - public const ERROR_CODE = 'invalid-api-key'; + public const string ERROR_CODE = 'invalid-api-key'; public static function forInvalidApiKey(): self { diff --git a/module/Rest/src/Middleware/AuthenticationMiddleware.php b/module/Rest/src/Middleware/AuthenticationMiddleware.php index cf73ba10c..eaa85c961 100644 --- a/module/Rest/src/Middleware/AuthenticationMiddleware.php +++ b/module/Rest/src/Middleware/AuthenticationMiddleware.php @@ -21,7 +21,7 @@ class AuthenticationMiddleware implements MiddlewareInterface, StatusCodeInterface, RequestMethodInterface { - public const API_KEY_HEADER = 'X-Api-Key'; + public const string API_KEY_HEADER = 'X-Api-Key'; public function __construct( private readonly ApiKeyServiceInterface $apiKeyService, diff --git a/module/Rest/src/Middleware/ShortUrl/CreateShortUrlContentNegotiationMiddleware.php b/module/Rest/src/Middleware/ShortUrl/CreateShortUrlContentNegotiationMiddleware.php index 085037571..a84b9e8ae 100644 --- a/module/Rest/src/Middleware/ShortUrl/CreateShortUrlContentNegotiationMiddleware.php +++ b/module/Rest/src/Middleware/ShortUrl/CreateShortUrlContentNegotiationMiddleware.php @@ -18,8 +18,8 @@ class CreateShortUrlContentNegotiationMiddleware implements MiddlewareInterface { - private const PLAIN_TEXT = 'text'; - private const JSON = 'json'; + private const string PLAIN_TEXT = 'text'; + private const string JSON = 'json'; public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface { diff --git a/module/Rest/test-api/Action/ListRedirectRulesTest.php b/module/Rest/test-api/Action/ListRedirectRulesTest.php index 494a6564f..7909dcfdf 100644 --- a/module/Rest/test-api/Action/ListRedirectRulesTest.php +++ b/module/Rest/test-api/Action/ListRedirectRulesTest.php @@ -12,12 +12,12 @@ class ListRedirectRulesTest extends ApiTestCase { - private const LANGUAGE_EN_CONDITION = [ + private const array LANGUAGE_EN_CONDITION = [ 'type' => 'language', 'matchKey' => null, 'matchValue' => 'en', ]; - private const QUERY_FOO_BAR_CONDITION = [ + private const array QUERY_FOO_BAR_CONDITION = [ 'type' => 'query-param', 'matchKey' => 'foo', 'matchValue' => 'bar', diff --git a/module/Rest/test-api/Action/ListShortUrlsTest.php b/module/Rest/test-api/Action/ListShortUrlsTest.php index 1eba6db88..60b493d66 100644 --- a/module/Rest/test-api/Action/ListShortUrlsTest.php +++ b/module/Rest/test-api/Action/ListShortUrlsTest.php @@ -15,7 +15,7 @@ class ListShortUrlsTest extends ApiTestCase { - private const SHORT_URL_SHLINK_WITH_TITLE = [ + private const array SHORT_URL_SHLINK_WITH_TITLE = [ 'shortCode' => 'abc123', 'shortUrl' => 'http://s.test/abc123', 'longUrl' => 'https://shlink.io', @@ -37,7 +37,7 @@ class ListShortUrlsTest extends ApiTestCase 'forwardQuery' => true, 'hasRedirectRules' => false, ]; - private const SHORT_URL_DOCS = [ + private const array SHORT_URL_DOCS = [ 'shortCode' => 'ghi789', 'shortUrl' => 'http://s.test/ghi789', 'longUrl' => 'https://shlink.io/documentation/', @@ -59,7 +59,7 @@ class ListShortUrlsTest extends ApiTestCase 'forwardQuery' => true, 'hasRedirectRules' => false, ]; - private const SHORT_URL_CUSTOM_SLUG_AND_DOMAIN = [ + private const array SHORT_URL_CUSTOM_SLUG_AND_DOMAIN = [ 'shortCode' => 'custom-with-domain', 'shortUrl' => 'http://some-domain.com/custom-with-domain', 'longUrl' => 'https://google.com', @@ -81,7 +81,7 @@ class ListShortUrlsTest extends ApiTestCase 'forwardQuery' => true, 'hasRedirectRules' => false, ]; - private const SHORT_URL_META = [ + private const array SHORT_URL_META = [ 'shortCode' => 'def456', 'shortUrl' => 'http://s.test/def456', 'longUrl' => @@ -105,7 +105,7 @@ class ListShortUrlsTest extends ApiTestCase 'forwardQuery' => true, 'hasRedirectRules' => true, ]; - private const SHORT_URL_CUSTOM_SLUG = [ + private const array SHORT_URL_CUSTOM_SLUG = [ 'shortCode' => 'custom', 'shortUrl' => 'http://s.test/custom', 'longUrl' => 'https://shlink.io', @@ -127,7 +127,7 @@ class ListShortUrlsTest extends ApiTestCase 'forwardQuery' => false, 'hasRedirectRules' => false, ]; - private const SHORT_URL_CUSTOM_DOMAIN = [ + private const array SHORT_URL_CUSTOM_DOMAIN = [ 'shortCode' => 'ghi789', 'shortUrl' => 'http://example.com/ghi789', 'longUrl' => diff --git a/module/Rest/test-api/Action/OrphanVisitsTest.php b/module/Rest/test-api/Action/OrphanVisitsTest.php index 3761e113d..f94148997 100644 --- a/module/Rest/test-api/Action/OrphanVisitsTest.php +++ b/module/Rest/test-api/Action/OrphanVisitsTest.php @@ -13,7 +13,7 @@ class OrphanVisitsTest extends ApiTestCase { - private const INVALID_SHORT_URL = [ + private const array INVALID_SHORT_URL = [ 'referer' => 'https://s.test/foo', 'date' => '2020-03-01T00:00:00+00:00', 'userAgent' => 'cf-facebook', @@ -23,7 +23,7 @@ class OrphanVisitsTest extends ApiTestCase 'type' => 'invalid_short_url', 'redirectUrl' => null, ]; - private const REGULAR_NOT_FOUND = [ + private const array REGULAR_NOT_FOUND = [ 'referer' => 'https://s.test/foo/bar', 'date' => '2020-02-01T00:00:00+00:00', 'userAgent' => 'shlink-tests-agent', @@ -33,7 +33,7 @@ class OrphanVisitsTest extends ApiTestCase 'type' => 'regular_404', 'redirectUrl' => null, ]; - private const BASE_URL = [ + private const array BASE_URL = [ 'referer' => 'https://s.test', 'date' => '2020-01-01T00:00:00+00:00', 'userAgent' => 'shlink-tests-agent', diff --git a/module/Rest/test-api/Action/SetRedirectRulesTest.php b/module/Rest/test-api/Action/SetRedirectRulesTest.php index 6501ef13a..9fc6fa9d0 100644 --- a/module/Rest/test-api/Action/SetRedirectRulesTest.php +++ b/module/Rest/test-api/Action/SetRedirectRulesTest.php @@ -13,12 +13,12 @@ class SetRedirectRulesTest extends ApiTestCase { - private const LANGUAGE_EN_CONDITION = [ + private const array LANGUAGE_EN_CONDITION = [ 'type' => 'language', 'matchKey' => null, 'matchValue' => 'en', ]; - private const QUERY_FOO_BAR_CONDITION = [ + private const array QUERY_FOO_BAR_CONDITION = [ 'type' => 'query-param', 'matchKey' => 'foo', 'matchValue' => 'bar',