Skip to content

Commit

Permalink
Add phpstan (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
cesargb authored Jan 6, 2023
1 parent 3df5fd6 commit 053aa39
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 4 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: phpstan

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
phpstan:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
run: |
composer install
composer dump
- name: Run analyse phpstan
run: vendor/bin/phpstan analyse --error-format github
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/vendor
/build
composer.lock
/composer.lock
/tests/tmp
/.phpunit.result.cache
/phpunit.xml
/.phpunit.result.cache
/.php-cs-fixer.cache
1 change: 0 additions & 1 deletion .php-cs-fixer.cache

This file was deleted.

3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
"require-dev": {
"orchestra/testbench": "^7.0",
"phpunit/phpunit": "^9.5",
"friendsofphp/php-cs-fixer": "^3.13"
"friendsofphp/php-cs-fixer": "^3.13",
"nunomaduro/larastan": "^2.3"
},
"autoload": {
"psr-4": {
Expand Down
8 changes: 8 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
includes:
- ./vendor/nunomaduro/larastan/extension.neon

parameters:
paths:
- src
- tests
level: 5

0 comments on commit 053aa39

Please sign in to comment.