diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml new file mode 100644 index 0000000..5b55d48 --- /dev/null +++ b/.github/workflows/phpstan.yml @@ -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 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1ae4917..c5bc73e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -5,6 +5,7 @@ on: push: branches: - "master" + - "tac" jobs: phpunit: diff --git a/composer.json b/composer.json index 6000a39..999cab5 100644 --- a/composer.json +++ b/composer.json @@ -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": { diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 0000000..0c61a8e --- /dev/null +++ b/phpstan.neon @@ -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