Skip to content

Commit

Permalink
Merge pull request #5 from tacman/tac
Browse files Browse the repository at this point in the history
Add phpstan to tests
  • Loading branch information
yann-eugone authored Dec 2, 2024
2 parents 05ccf1d + 75d298e commit 99db05d
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 2 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: phpstan-CI
on:
[push, pull_request]
jobs:
phpstan:
runs-on: ubuntu-latest
name: PHPStan
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.4
- name: Checkout
uses: actions/checkout@v4
- name: composer install
run: composer install
- name: PHPStan
run: vendor/bin/phpstan
env:
REQUIRE_DEV: true
1 change: 1 addition & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
push:
branches:
- "master"
- "tac"

jobs:
phpunit:
Expand Down
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@
"symfony/framework-bundle": "^6.4|^7.0"
},
"require-dev": {
"phpunit/phpunit": "^10.0",
"phpunit/phpunit": "^10.5",
"symfony/yaml": "^6.4|^7.0",
"symplify/easy-coding-standard": "^12.0"
"symplify/easy-coding-standard": "^12.0",
"phpstan/phpstan": "^2.0"
},
"autoload": {
"psr-4": {
Expand Down
41 changes: 41 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
parameters:
level: 3
inferPrivatePropertyTypeFromConstructor: true
paths:
- ./src/

excludePaths:
# - 'src/Resources/skeleton'
# - */cache/*
analyse:
- ./vendor

reportUnmatchedIgnoredErrors: false
# checkMissingIterableValueType: false
# checkGenericClassInNonGenericObjectType: false
ignoreErrors:
- '#Call to an undefined method Symfony\\Component\\Config\\Definition\\Builder\\NodeDefinition::canBeEnabled\(\)\.#'
- '#Call to an undefined method Symfony\\Component\\Config\\Definition\\Builder\\NodeDefinition::canBeDisabled\(\)\.#'
- '#Call to an undefined method Symfony\\Component\\Config\\Definition\\Builder\\NodeDefinition::addDefaultsIfNotSet\(\)\.#'
- '#Call to an undefined method Symfony\\Component\\Config\\Definition\\Builder\\NodeDefinition::children\(\)\.#'
- '#Call to an undefined method Symfony\\Component\\Config\\Definition\\Builder\\NodeParentInterface::scalarNode\(\).#'
# Only available in ArrayNodeDefinition which is given
# False positive: clients are not dependencies of this project.
# -
# message: '#Call to an undefined method Symfony\Component\Config\Definition\Builder\NodeDefinition::children#'
# path: ./src/Client/Provider
# -
# message: '#Return typehint of method KnpU\\OAuth2ClientBundle\\Client\\Provider\\[a-zA-Z0-9\\_]+::fetchUser\(\) has invalid type [a-zA-Z0-9\\_]#'
# path: ./src/Client/Provider
# False positive: using `::class` is not an error for those providers `::getProviderClass()` method.
# -
# message: '#Class [a-zA-Z0-9\\_]+ not found#'
# path: ./src/DependencyInjection/Providers

# The DependencyInjection returns are very complex to deal with
# -
# message: '#.*NodeParentInterface\|null.*#'
# path: ./src/DependencyInjection/Providers
# -
# message: '#.*NodeDefinition::children.*#'
# path: ./src/DependencyInjection

0 comments on commit 99db05d

Please sign in to comment.