Skip to content

Commit

Permalink
Merge pull request #2132 from acelaya-forks/feature/update-phpstan
Browse files Browse the repository at this point in the history
Update to latest phpstan
  • Loading branch information
acelaya authored May 21, 2024
2 parents e2d8334 + 89b73a9 commit 5ad4b39
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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*
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
10 changes: 5 additions & 5 deletions module/Core/functions/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
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;
Expand Down Expand Up @@ -37,15 +37,15 @@

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
Expand Down
4 changes: 2 additions & 2 deletions module/Core/test/Matomo/MatomoTrackerBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ public function trackerIsCreated(): void
{
$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());
}
Expand Down
4 changes: 2 additions & 2 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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

0 comments on commit 5ad4b39

Please sign in to comment.