Skip to content

Add PHPStan #71

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Lint

on:
push:
branches: [ master ]
pull_request:

jobs:
tests:
runs-on: ubuntu-latest
name: Lint ${{ matrix.check.name }}
strategy:
fail-fast: false
matrix:
php: [ '8.1' ]
check:
- name: PHPStan
command: make phpstan

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php }}"
tools: composer
coverage: none

- name: Run ${{ matrix.check.name }}
run: ${{ matrix.check.command }}
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ PHPNOGC=php -d zend.enable_gc=0
CCYELLOW=\033[0;33m
CCEND=\033[0m

PHPSTAN_BIN = vendor/phpstan/phpstan/phpstan
PHPSTAN = $(PHPSTAN_BIN)

.PHONY: help
help:
@echo "\033[33mUsage:\033[0m\n make TARGET\n\n\033[32m#\n# Commands\n#---------------------------------------------------------------------------\033[0m\n"
Expand All @@ -23,6 +26,14 @@ cs: $(PHP_CS_FIXER)
LC_ALL=C sort -u .gitignore -o .gitignore


.PHONY: phpstan
phpstan: ## Runs PHPStan
phpstan: $(PHPSTAN_BIN) vendor
ifndef SKIP_PHPSTAN
$(PHPSTAN) analyze
endif


#
# Tests
#---------------------------------------------------------------------------
Expand All @@ -48,5 +59,10 @@ vendor: composer.lock
$(PHP_CS_FIXER): vendor
touch $@

$(PHPSTAN_BIN): vendor
ifndef SKIP_PHPSTAN
touch $@
endif

$(PHPUNIT): vendor
touch $@
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"ext-json": "*",
"bamarni/composer-bin-plugin": "^1.8",
"ergebnis/composer-normalize": "^2.28",
"phpstan/phpstan": "^1.8",
"phpunit/phpunit": "^8.4",
"symfony/framework-bundle": "^4.4 || ^5.4 || ^6.0"
},
Expand Down
7 changes: 7 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
parameters:
level: 6
paths:
- src
- tests
excludePaths:
- tests/Integration/var