diff --git a/CHANGELOG.md b/CHANGELOG.md index 102c9a14..8ab0a09a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), and this ### Changed * Use new reusable workflow to publish docker image * [#2015](https://github.com/shlinkio/shlink/issues/2015) Update to PHPUnit 11. +* [#2130](https://github.com/shlinkio/shlink/pull/2130) Replace deprecated `pugx/shortid-php` package with `hidehalo/nanoid-php`. ### Deprecated * *Nothing* diff --git a/composer.json b/composer.json index 6cd3e92d..82a4a93a 100644 --- a/composer.json +++ b/composer.json @@ -63,10 +63,10 @@ "require-dev": { "devizzent/cebe-php-openapi": "^1.0.1", "devster/ubench": "^2.1", - "phpstan/phpstan": "^1.10", - "phpstan/phpstan-doctrine": "^1.3", - "phpstan/phpstan-phpunit": "^1.3", - "phpstan/phpstan-symfony": "^1.3", + "phpstan/phpstan": "^1.11", + "phpstan/phpstan-doctrine": "^1.4", + "phpstan/phpstan-phpunit": "^1.4", + "phpstan/phpstan-symfony": "^1.4", "phpunit/php-code-coverage": "^11.0", "phpunit/phpcov": "^10.0", "phpunit/phpunit": "^11.1", diff --git a/docker-compose.yml b/docker-compose.yml index 026d3070..918be7ca 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -105,7 +105,7 @@ services: shlink_db_ms: container_name: shlink_db_ms - image: mcr.microsoft.com/mssql/server:2019-latest + image: mcr.microsoft.com/mssql/server:2022-latest ports: - "1433:1433" environment: diff --git a/module/Core/functions/functions.php b/module/Core/functions/functions.php index 8a11209d..d9fc2b5e 100644 --- a/module/Core/functions/functions.php +++ b/module/Core/functions/functions.php @@ -9,7 +9,7 @@ use Cake\Chronos\Chronos; use DateTimeInterface; use Doctrine\ORM\Mapping\Builder\FieldBuilder; use GuzzleHttp\Psr7\Query; -use Hidehalo\Nanoid\Client; +use Hidehalo\Nanoid\Client as NanoidClient; use Jaybizzle\CrawlerDetect\CrawlerDetect; use Laminas\Filter\Word\CamelCaseToSeparator; use Laminas\Filter\Word\CamelCaseToUnderscore; @@ -37,15 +37,15 @@ use function ucfirst; function generateRandomShortCode(int $length, ShortUrlMode $mode = ShortUrlMode::STRICT): string { - static $shortIdFactory; - if ($shortIdFactory === null) { - $shortIdFactory = new Client(); + static $nanoIdClient; + if ($nanoIdClient === null) { + $nanoIdClient = new NanoidClient(); } $alphabet = $mode === ShortUrlMode::STRICT ? '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' : '0123456789abcdefghijklmnopqrstuvwxyz'; - return $shortIdFactory->formattedId($alphabet, $length); + return $nanoIdClient->formattedId($alphabet, $length); } function parseDateFromQuery(array $query, string $dateName): ?Chronos diff --git a/module/Core/test/Matomo/MatomoTrackerBuilderTest.php b/module/Core/test/Matomo/MatomoTrackerBuilderTest.php index 5a4e6ab0..1b55405e 100644 --- a/module/Core/test/Matomo/MatomoTrackerBuilderTest.php +++ b/module/Core/test/Matomo/MatomoTrackerBuilderTest.php @@ -37,8 +37,8 @@ class MatomoTrackerBuilderTest extends TestCase { $tracker = $this->builder()->buildMatomoTracker(); - self::assertEquals('api_token', $tracker->token_auth); // @phpstan-ignore-line - self::assertEquals(5, $tracker->idSite); // @phpstan-ignore-line + self::assertEquals('api_token', $tracker->token_auth); + self::assertEquals(5, $tracker->idSite); self::assertEquals(MatomoTrackerBuilder::MATOMO_DEFAULT_TIMEOUT, $tracker->getRequestTimeout()); self::assertEquals(MatomoTrackerBuilder::MATOMO_DEFAULT_TIMEOUT, $tracker->getRequestConnectTimeout()); } diff --git a/phpstan.neon b/phpstan.neon index eee4853b..9ebaec6e 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -4,8 +4,6 @@ includes: - vendor/phpstan/phpstan-phpunit/extension.neon - vendor/phpstan/phpstan-phpunit/rules.neon parameters: - checkMissingIterableValueType: false - checkGenericClassInNonGenericObjectType: false symfony: console_application_loader: 'config/cli-app.php' doctrine: @@ -14,3 +12,5 @@ parameters: ignoreErrors: - '#should return int<0, max> but returns int#' - '#expects -1|int<1, max>, int given#' + - identifier: missingType.generics + - identifier: missingType.iterableValue