diff --git a/.github/workflows/code-analysis.yml b/.github/workflows/code-analysis.yml new file mode 100644 index 0000000..1bebed1 --- /dev/null +++ b/.github/workflows/code-analysis.yml @@ -0,0 +1,20 @@ +name: "Code Analysis" + +on: [pull_request] +jobs: + code-analysis: + name: Code Analysis + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + fetch-depth: 2 + + - run: git checkout HEAD^2 + + - name: Run Linter + run: | + docker run --rm -v $PWD:/app composer:2.6 sh -c \ + "composer install --profile --ignore-platform-reqs && composer check" \ No newline at end of file diff --git a/composer.json b/composer.json index 77670c4..9b09926 100644 --- a/composer.json +++ b/composer.json @@ -25,11 +25,13 @@ }, "require-dev": { "phpunit/phpunit": "^9.3", - "laravel/pint": "1.2.*" + "laravel/pint": "1.2.*", + "phpstan/phpstan": "^1.12" }, "scripts": { "format": "vendor/bin/pint", "lint": "vendor/bin/pint --test", - "test": "vendor/bin/phpunit --configuration phpunit.xml" + "test": "vendor/bin/phpunit --configuration phpunit.xml", + "check": "./vendor/bin/phpstan analyse --level 8 src tests" } } diff --git a/composer.lock b/composer.lock index e364a0b..32e2327 100644 --- a/composer.lock +++ b/composer.lock @@ -2079,6 +2079,64 @@ } ], "time": "2024-03-03T12:36:25+00:00" + }, + { + "name": "phpstan/phpstan", + "version": "1.12.7", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan.git", + "reference": "dc2b9976bd8b0f84ec9b0e50cc35378551de7af0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/dc2b9976bd8b0f84ec9b0e50cc35378551de7af0", + "reference": "dc2b9976bd8b0f84ec9b0e50cc35378551de7af0", + "shasum": "" + }, + "require": { + "php": "^7.2|^8.0" + }, + "conflict": { + "phpstan/phpstan-shim": "*" + }, + "bin": [ + "phpstan", + "phpstan.phar" + ], + "type": "library", + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPStan - PHP Static Analysis Tool", + "keywords": [ + "dev", + "static analysis" + ], + "support": { + "docs": "https://phpstan.org/user-guide/getting-started", + "forum": "https://github.com/phpstan/phpstan/discussions", + "issues": "https://github.com/phpstan/phpstan/issues", + "security": "https://github.com/phpstan/phpstan/security/policy", + "source": "https://github.com/phpstan/phpstan-src" + }, + "funding": [ + { + "url": "https://github.com/ondrejmirtes", + "type": "github" + }, + { + "url": "https://github.com/phpstan", + "type": "github" + } + ], + "time": "2024-12-15T6:11:07+00:00" } ], "aliases": [],