diff --git a/.gitattributes b/.gitattributes index eae9b747..8da698cf 100644 --- a/.gitattributes +++ b/.gitattributes @@ -6,6 +6,7 @@ .gitignore export-ignore CHANGELOG.md export-ignore phpcs.xml.dist export-ignore +phpstan.neon.dist export-ignore phpunit.xml.dist export-ignore README.md export-ignore diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index 0a9dbddd..3232ba4b 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -27,5 +27,44 @@ jobs: max_attempts: 5 command: composer update --no-interaction --no-progress + - name: Install PHP CodeSniffer + uses: nick-invision/retry@v1 + with: + timeout_minutes: 5 + max_attempts: 5 + command: composer bin phpcs update --no-interaction --no-progress + - name: Execute PHP CodeSniffer run: vendor/bin/phpcs + + phpstan: + name: PHPStan + runs-on: ubuntu-20.04 + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '7.4' + tools: composer:v2 + coverage: none + + - name: Install Dependencies + uses: nick-invision/retry@v1 + with: + timeout_minutes: 5 + max_attempts: 5 + command: composer update --no-interaction --no-progress + + - name: Install PHPStan + uses: nick-invision/retry@v1 + with: + timeout_minutes: 5 + max_attempts: 5 + command: composer bin phpstan update --no-interaction --no-progress + + - name: Execute PHPStan + run: vendor/bin/phpstan analyze --no-progress diff --git a/.gitignore b/.gitignore index ab6201ff..078697af 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ composer.lock phpcs.xml +phpstan.neon phpunit.xml -/vendor +vendor diff --git a/Makefile b/Makefile index b1f6b1fd..d34ea290 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,10 @@ install: composer update + composer bin all update test: vendor/bin/phpunit + vendor/bin/phpstan analyze vendor/bin/phpcs fix: diff --git a/composer.json b/composer.json index 64d67dc2..d8041f16 100644 --- a/composer.json +++ b/composer.json @@ -24,8 +24,8 @@ "wrench/wrench": "^2.0" }, "require-dev":{ + "bamarni/composer-bin-plugin": "^1.4.1", "phpunit/phpunit": "^6.5.14", - "squizlabs/php_codesniffer": "^3.5.8", "symfony/var-dumper": "^3.3|^4.0|^5.0" }, "autoload":{ diff --git a/phpstan.neon.dist b/phpstan.neon.dist new file mode 100644 index 00000000..b3c13846 --- /dev/null +++ b/phpstan.neon.dist @@ -0,0 +1,6 @@ +parameters: + level: 1 + + paths: + - src + - tests diff --git a/vendor-bin/phpcs/composer.json b/vendor-bin/phpcs/composer.json new file mode 100644 index 00000000..53dde945 --- /dev/null +++ b/vendor-bin/phpcs/composer.json @@ -0,0 +1,8 @@ +{ + "require": { + "squizlabs/php_codesniffer": "3.5.8" + }, + "config": { + "preferred-install": "dist" + } +} diff --git a/vendor-bin/phpstan/composer.json b/vendor-bin/phpstan/composer.json new file mode 100644 index 00000000..5104141d --- /dev/null +++ b/vendor-bin/phpstan/composer.json @@ -0,0 +1,8 @@ +{ + "require": { + "phpstan/phpstan": "0.12.59" + }, + "config": { + "preferred-install": "dist" + } +}