Skip to content

Commit

Permalink
added PHPStan
Browse files Browse the repository at this point in the history
  • Loading branch information
petrparolek authored and f3l1x committed Apr 26, 2021
1 parent 2e91cc3 commit e414eca
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 1 deletion.
56 changes: 56 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,62 @@ jobs:
- name: "Coding Standard"
run: "make cs"

static-analysis:
name: "Static analysis"
runs-on: "${{ matrix.operating-system }}"

strategy:
matrix:
php-version: ["7.4"]
operating-system: ["ubuntu-latest"]
fail-fast: false

steps:
- name: "Checkout"
uses: "actions/checkout@v2"

- name: "Setup PHP cache environment"
id: "extcache"
uses: "shivammathur/cache-extensions@v1"
with:
php-version: "${{ matrix.php-version }}"
extensions: "${{ env.extensions }}"
key: "${{ env.cache-version }}"

- name: "Cache PHP extensions"
uses: "actions/cache@v2"
with:
path: "${{ steps.extcache.outputs.dir }}"
key: "${{ steps.extcache.outputs.key }}"
restore-keys: "${{ steps.extcache.outputs.key }}"

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
extensions: "${{ env.extensions }}"
tools: "composer:${{ env.composer-version }} "

- name: "Setup problem matchers for PHP"
run: 'echo "::add-matcher::${{ runner.tool_cache }}/php.json"'

- name: "Get Composer cache directory"
id: "composercache"
run: 'echo "::set-output name=dir::$(composer config cache-files-dir)"'

- name: "Cache PHP dependencies"
uses: "actions/cache@v2"
with:
path: "${{ steps.composercache.outputs.dir }}"
key: "${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}"
restore-keys: "${{ runner.os }}-composer-"

- name: "Install dependencies"
run: "${{ env.composer-install }}"

- name: "PHPStan"
run: "make phpstan"

tests:
name: "Tests"
runs-on: "${{ matrix.operating-system }}"
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ cs:
csf:
vendor/bin/codefixer src tests

phpstan:
vendor/bin/phpstan analyse -l max -c phpstan.neon src

tests:
vendor/bin/tester -s -p php --colors 1 -C tests/cases

Expand Down
6 changes: 5 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@
"require-dev": {
"mockery/mockery": "^1.3",
"ninjify/nunjuck": "^0.3",
"ninjify/qa": "^0.12"
"ninjify/qa": "^0.12",
"phpstan/phpstan": "^0.12",
"phpstan/phpstan-deprecation-rules": "^0.12",
"phpstan/phpstan-nette": "^0.12",
"phpstan/phpstan-strict-rules": "^0.12"
},
"autoload": {
"psr-4": {
Expand Down
5 changes: 5 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
includes:
- vendor/phpstan/phpstan-deprecation-rules/rules.neon
- vendor/phpstan/phpstan-nette/extension.neon
- vendor/phpstan/phpstan-nette/rules.neon
- vendor/phpstan/phpstan-strict-rules/rules.neon

0 comments on commit e414eca

Please sign in to comment.