Skip to content
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

Add phpstan to tests #5

Merged
merged 4 commits into from
Dec 2, 2024
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
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
15 changes: 9 additions & 6 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 All @@ -15,12 +16,14 @@ jobs:
include:
- php-version: '8.1'
symfony-version: '6.4.*'
- php-version: '8.3'
- php-version: '8.4'
symfony-version: '6.4.*'
- php-version: '8.2'
symfony-version: '7.0.*'
symfony-version: '7.1.*'
- php-version: '8.3'
symfony-version: '7.0.*'
symfony-version: '7.1.*'
- php-version: '8.4'
symfony-version: '7.1.*'
steps:
- name: "Checkout"
uses: actions/checkout@v2
Expand All @@ -42,7 +45,7 @@ jobs:
uses: ./.github/actions/install
with:
php-version: '8.3'
symfony-version: '7.0.*'
symfony-version: '7.1.*'
- name: "Run checkstyle with symplify/easy-coding-standard"
run: vendor/bin/ecs

Expand All @@ -56,8 +59,8 @@ jobs:
- name: "Setup env & install dependencies"
uses: ./.github/actions/install
with:
php-version: '8.3'
symfony-version: '7.0.*'
php-version: '8.4'
symfony-version: '7.1.*'
coverage-mode: 'xdebug'
- name: "Run tests with phpunit/phpunit"
env:
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
Loading