diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f8ce35..d735b6c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), and this ### Changed * Migrate form PHP_CodeSniffer to Mago for code linting and formatting. +* Migrate form PHPStan to Mago for code analysis. ### Deprecated * *Nothing* diff --git a/composer.json b/composer.json index c5f7161..5881fe0 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,6 @@ }, "require-dev": { "carthage-software/mago": "^1.28", - "phpstan/phpstan": "^2.1", "shlinkio/shlink-mago-config": "^1.0" }, "autoload": { @@ -27,7 +26,7 @@ "scripts": { "ci": [ "@cs", - "@stan" + "@analyze" ], "lint": "mago lint", "lint:fix": "mago lint --fix", @@ -35,13 +34,14 @@ "format:check": "mago format --check", "cs": ["@lint", "@format:check"], "cs:fix": ["@lint:fix", "@format"], - "stan": "phpstan analyse" + "analyze": "mago analyze", + "stan": "@analyze" }, "scripts-descriptions": { - "ci": "Alias for \"cs\" and \"stan\"", + "ci": "Alias for \"cs\" and \"analyze\"", "cs": "Checks coding styles", "cs:fix": "Fixes coding styles, when possible", - "stan": "Inspects code with phpstan" + "analyze": "Inspects code with mago analyze" }, "config": { "sort-packages": true, diff --git a/functions/functions.php b/functions/functions.php index 03b2b83..6e273b7 100644 --- a/functions/functions.php +++ b/functions/functions.php @@ -18,7 +18,8 @@ */ function json_decode(string $json): array { - return spl_json_decode($json, true, 512, JSON_THROW_ON_ERROR); + // @mago-expect analysis:mixed-return-statement + return spl_json_decode($json, associative: true, flags: JSON_THROW_ON_ERROR); } /** diff --git a/mago.toml b/mago.toml index 66a18da..27da276 100644 --- a/mago.toml +++ b/mago.toml @@ -7,8 +7,8 @@ extends = "vendor/shlinkio/shlink-mago-config/mago.toml" [source] workspace = "." -paths = ["config", "functions", "src", "test"] -excludes = ["vendor"] +paths = ["functions"] +includes = ["vendor"] [source.glob] literal-separator = true @@ -17,3 +17,5 @@ literal-separator = true no-literal-password = { exclude = ["test"] } no-empty-catch-clause = { exclude = ["test"] } no-empty-loop = { exclude = ["test"] } + +[analyzer] diff --git a/phpstan.neon b/phpstan.neon deleted file mode 100644 index 11df426..0000000 --- a/phpstan.neon +++ /dev/null @@ -1,4 +0,0 @@ -parameters: - level: 8 - paths: - - functions