Migrate form PHPStan to Mago for code analysis

This commit is contained in:
Alejandro Celaya
2026-07-29 20:32:45 +02:00
parent 59c62a2ccc
commit 5b68e5b2d4
7 changed files with 2786 additions and 32 deletions
+2 -1
View File
@@ -18,9 +18,10 @@ vendor
docs
indocker
docker-*
phpstan.neon
php*xml*
**/test*
build*
**/.*
!config/roadrunner/.rr.yml
mago.toml
mago-analyze-baseline.toml
+1 -1
View File
@@ -16,7 +16,7 @@ CHANGELOG.md export-ignore
docker-compose.yml export-ignore
indocker export-ignore
mago.toml export-ignore
mago-analyze-baseline.toml export-ignore
phpunit.xml.dist export-ignore
phpunit-api.xml export-ignore
phpunit-db.xml export-ignore
phpstan.neon
+1 -1
View File
@@ -28,7 +28,7 @@ jobs:
strategy:
matrix:
php-version: ['8.4']
command: ['cs', 'stan', 'openapi:validate']
command: ['lint', 'format:check', 'analyze', 'openapi:validate']
steps:
- uses: actions/checkout@v5
- uses: './.github/actions/ci-setup'
+5 -8
View File
@@ -59,17 +59,13 @@
"symfony/string": "^8.1"
},
"require-dev": {
"carthage-software/mago": "^1.30",
"carthage-software/mago": "^1.45",
"devizzent/cebe-php-openapi": "^1.1.2",
"devster/ubench": "^2.1",
"phpstan/phpstan": "^2.2",
"phpstan/phpstan-doctrine": "^2.0",
"phpstan/phpstan-phpunit": "^2.0.5",
"phpstan/phpstan-symfony": "^2.0",
"phpunit/php-code-coverage": "^13.0",
"phpunit/phpcov": "^12.0",
"phpunit/phpunit": "^13.0",
"shlinkio/shlink-mago-config": "^1.0",
"shlinkio/shlink-mago-config": "^1.1",
"shlinkio/shlink-test-utils": "^4.5",
"symfony/var-dumper": "^8.1",
"veewee/composer-run-parallel": "^1.5"
@@ -103,7 +99,7 @@
},
"scripts": {
"ci": [
"@parallel cs stan openapi:validate test:unit:ci test:db:sqlite:ci test:db:postgres test:db:mysql test:db:maria test:db:ms",
"@parallel cs analyze openapi:validate test:unit:ci test:db:sqlite:ci test:db:postgres test:db:mysql test:db:maria test:db:ms",
"@parallel test:api:ci test:cli:ci"
],
"lint": "mago lint",
@@ -112,7 +108,8 @@
"format:check": "mago format --check",
"cs": ["@lint", "@format:check"],
"cs:fix": ["@lint:fix", "@format"],
"stan": ["@putenv APP_ENV=test", "phpstan analyse"],
"analyze": ["@putenv APP_ENV=test", "mago analyze"],
"stan": "@analyze",
"test": [
"@parallel test:unit test:db",
"@parallel test:api test:cli"
File diff suppressed because it is too large Load Diff
+4 -1
View File
@@ -8,7 +8,7 @@ extends = "vendor/shlinkio/shlink-mago-config/mago.toml"
[source]
workspace = "."
paths = ["bin", "config", "module"]
excludes = ["vendor"]
includes = ["vendor"]
[source.glob]
literal-separator = true
@@ -57,3 +57,6 @@ ambiguous-function-call = {
"module/Core/config/entities-mappings"
]
}
[analyzer]
baseline = "mago-analyze-baseline.toml"
-20
View File
@@ -1,20 +0,0 @@
includes:
- vendor/phpstan/phpstan-doctrine/extension.neon
- vendor/phpstan/phpstan-symfony/extension.neon
- vendor/phpstan/phpstan-phpunit/extension.neon
- vendor/phpstan/phpstan-phpunit/rules.neon
parameters:
level: 8
paths:
- module
- config
- docker/config
symfony:
consoleApplicationLoader: 'config/cli-app.php'
doctrine:
repositoryClass: Happyr\DoctrineSpecification\Repository\EntitySpecificationRepository
objectManagerLoader: 'config/entity-manager.php'
ignoreErrors:
- '#should return int<0, max> but returns int#'
- '#expects -1\|int<1, max>, int given#'
- identifier: missingType.iterableValue