diff --git a/.gitattributes b/.gitattributes index ec03375..d486550 100644 --- a/.gitattributes +++ b/.gitattributes @@ -6,5 +6,5 @@ CHANGELOG.md export-ignore docker-compose.override.yml.dist export-ignore docker-compose.yml export-ignore indocker export-ignore -phpcs.xml export-ignore +mago.toml export-ignore phpstan.neon export-ignore diff --git a/CHANGELOG.md b/CHANGELOG.md index d7629f6..3f8ce35 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,23 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com), and this project adheres to [Semantic Versioning](https://semver.org). +## [Unreleased] +### Added +* *Nothing* + +### Changed +* Migrate form PHP_CodeSniffer to Mago for code linting and formatting. + +### Deprecated +* *Nothing* + +### Removed +* *Nothing* + +### Fixed +* *Nothing* + + ## [1.3.0] - 2026-01-07 ### Added * *Nothing* diff --git a/composer.json b/composer.json index 3b01a89..c5f7161 100644 --- a/composer.json +++ b/composer.json @@ -15,9 +15,9 @@ "php": "^8.4" }, "require-dev": { + "carthage-software/mago": "^1.28", "phpstan/phpstan": "^2.1", - "roave/security-advisories": "dev-master", - "shlinkio/php-coding-standard": "~2.5.0" + "shlinkio/shlink-mago-config": "^1.0" }, "autoload": { "files": [ @@ -29,8 +29,12 @@ "@cs", "@stan" ], - "cs": "phpcs", - "cs:fix": "phpcbf", + "lint": "mago lint", + "lint:fix": "mago lint --fix", + "format": "mago format", + "format:check": "mago format --check", + "cs": ["@lint", "@format:check"], + "cs:fix": ["@lint:fix", "@format"], "stan": "phpstan analyse" }, "scripts-descriptions": { diff --git a/mago.toml b/mago.toml new file mode 100644 index 0000000..66a18da --- /dev/null +++ b/mago.toml @@ -0,0 +1,19 @@ +#:schema https://mago.carthage.software/1.27.1/schema.json +# Welcome to Mago! +# For full documentation, see https://mago.carthage.software/tools/overview +version = "1" +php-version = "8.4.0" +extends = "vendor/shlinkio/shlink-mago-config/mago.toml" + +[source] +workspace = "." +paths = ["config", "functions", "src", "test"] +excludes = ["vendor"] + +[source.glob] +literal-separator = true + +[linter.rules] +no-literal-password = { exclude = ["test"] } +no-empty-catch-clause = { exclude = ["test"] } +no-empty-loop = { exclude = ["test"] } diff --git a/phpcs.xml b/phpcs.xml deleted file mode 100644 index 9d280bb..0000000 --- a/phpcs.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - Coding standard - - - - - - - - - - functions -