Skip to content

Commit

Permalink
Add PHPStan Build
Browse files Browse the repository at this point in the history
  • Loading branch information
lcharette committed Dec 10, 2024
1 parent c434b1d commit 03491c3
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/PHPStan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: PHPStan

on:
push:
branches: [6.0]
pull_request:
branches: [6.0]
workflow_dispatch:

jobs:
PHPStan:

strategy:
fail-fast: false
matrix:
php_versions: ['8.1', '8.2', '8.3', '8.4']

runs-on: ubuntu-latest
name: PHPStan - ${{ matrix.php_versions }}

steps:
- uses: actions/checkout@v4

- name: Setup PHP,with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php_versions }}

- name: Install Dependencies
run: composer update --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist

- name: Run PHPStan
run: vendor/bin/phpstan analyse
5 changes: 5 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@
"isDefault": true
}
},
{
"label": "Workspace - PHPStan",
"type": "shell",
"command": "vendor/bin/phpstan analyse"
},

/**
* All workspaces NPM Tasks
Expand Down
43 changes: 43 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
parameters:
level: 8
paths:
- packages/framework/src/
- packages/framework/tests/
- packages/skeleton/app/src/
- packages/skeleton/app/tests/
- packages/sprinkle-account/app/src/
- packages/sprinkle-account/app/tests/
- packages/sprinkle-admin/app/src/
- packages/sprinkle-admin/app/tests/
- packages/sprinkle-core/app/src/
- packages/sprinkle-core/app/tests/
reportUnmatchedIgnoredErrors: false
ignoreErrors:
- '#Dynamic call to static method PHPUnit\\Framework\\.*#'
- '#Call to an undefined method Mockery\\Expectation::.*#'
- '/^Parameter #1 \$value of function strval expects bool\|float\|int\|resource\|string\|null, mixed given.$/'
- '/^Parameter #1 \$value of function intval expects array\|bool\|float\|int\|resource\|string\|null, mixed given.$/'
universalObjectCratesClasses:
- UserFrosting\Sprinkle\Core\Database\Models\Interfaces\ThrottleModelInterface
- UserFrosting\Sprinkle\Account\Database\Models\Interfaces\ActivityInterface
- UserFrosting\Sprinkle\Account\Database\Models\Interfaces\GroupInterface
- UserFrosting\Sprinkle\Account\Database\Models\Interfaces\PasswordResetInterface
- UserFrosting\Sprinkle\Account\Database\Models\Interfaces\PermissionInterface
- UserFrosting\Sprinkle\Account\Database\Models\Interfaces\PersistenceInterface
- UserFrosting\Sprinkle\Account\Database\Models\Interfaces\RoleInterface
- UserFrosting\Sprinkle\Account\Database\Models\Interfaces\UserInterface
- UserFrosting\Sprinkle\Account\Database\Models\Interfaces\VerificationInterface
includes:
- packages/sprinkle-account/phpstan-baseline.neon
- packages/sprinkle-admin/phpstan-baseline.neon
- packages/sprinkle-core/phpstan-baseline.neon
- vendor/phpstan/phpstan-strict-rules/rules.neon
- vendor/phpstan/phpstan-deprecation-rules/rules.neon
- vendor/phpstan/phpstan-mockery/extension.neon
- vendor/phpstan/phpstan-phpunit/extension.neon

services:
-
class: SlamPhpStan\UnusedVariableRule
tags:
- phpstan.rules.rule

0 comments on commit 03491c3

Please sign in to comment.