From f564b592fdca88f3f66c30c6efe68229297114a6 Mon Sep 17 00:00:00 2001 From: Tobias Nyholm Date: Sun, 11 Jul 2021 18:31:09 +0200 Subject: [PATCH] Make CI green (#17) * Make CI green * Try PHP74 * Different version of psalm * fix --- .github/workflows/ci.yml | 8 +-- .github/workflows/static.yml | 71 +++++++++++++++---- phpstan-baseline.neon | 2 +- psalm.baseline.xml | 36 +++++++++- psalm.xml | 2 +- .../CompilerPass/ProxyServiceWithMockPass.php | 2 +- 6 files changed, 99 insertions(+), 22 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ad5ae97..2dd2a79 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,15 +1,15 @@ name: Tests -on: [push, pull_request] +on: [pull_request] jobs: - build: - name: Build + phpunit: + name: PHPUnit runs-on: ubuntu-latest strategy: max-parallel: 10 matrix: php: [ '7.2', '7.3', '7.4', '8.0'] - sf_version: [ '4.4.*', '5.2.*' ] + sf_version: [ '4.4.*', '5.3.*' ] steps: - name: Set up PHP diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index e38fd07..7d8b221 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -1,37 +1,80 @@ -on: [push, pull_request] +on: [pull_request] name: Static analysis jobs: phpstan: name: PHPStan - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 + steps: - name: Checkout code uses: actions/checkout@v2 - - name: PHPStan - uses: docker://oskarstark/phpstan-ga - env: - REQUIRE_DEV: true + - name: Setup PHP + uses: shivammathur/setup-php@v2 with: - args: analyze --no-progress + php-version: 8.0 + coverage: none + tools: phpstan:0.12.92, cs2pr + + - name: Download dependencies + uses: ramsey/composer-install@v1 + + - name: PHPStan + run: phpstan analyze --no-progress --error-format=checkstyle | cs2pr php-cs-fixer: name: PHP-CS-Fixer - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 + steps: - - uses: actions/checkout@v2 - - name: PHP-CS-Fixer - uses: docker://oskarstark/php-cs-fixer-ga + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 with: - args: --dry-run --diff-format udiff + php-version: 8.0 + coverage: none + tools: php-cs-fixer:2.19.0, cs2pr + + - name: PHP-CS-Fixer + run: php-cs-fixer fix --dry-run --format=checkstyle | cs2pr psalm: name: Psalm - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: Checkout code uses: actions/checkout@v2 + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 8.0 + coverage: none + tools: vimeo/psalm:4.8.1 + + - name: Download dependencies + uses: ramsey/composer-install@v1 + - name: Psalm - uses: docker://vimeo/psalm-github-actions + run: psalm --no-progress --output-format=github + + composer-normalize: + name: Composer Normalize + runs-on: ubuntu-20.04 + + steps: + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 8.0 + coverage: none + tools: composer-normalize + + - name: Checkout code + uses: actions/checkout@v2 + + - name: Normalize + run: composer-normalize --dry-run diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index f909a95..7d6b4cc 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,7 +1,7 @@ parameters: ignoreErrors: - - message: "#^Parameter \\#1 \\$autoload_function of function spl_autoload_register expects callable\\(string\\)\\: void, ProxyManager\\\\Autoloader\\\\AutoloaderInterface given\\.$#" + message: "#^Parameter \\#1 \\$callback of function spl_autoload_register expects \\(callable\\(string\\)\\: void\\)\\|null, ProxyManager\\\\Autoloader\\\\AutoloaderInterface given\\.$#" count: 1 path: src/DependencyInjection/CompilerPass/ProxyServiceWithMockPass.php diff --git a/psalm.baseline.xml b/psalm.baseline.xml index 04d2e7d..65c19ff 100644 --- a/psalm.baseline.xml +++ b/psalm.baseline.xml @@ -1,8 +1,42 @@ - + getWrappedValueHolderValue + + + $interface + $interface + ) + ) + fn + fn + + + + + $left + $type + $type + $type + ) + ) + ) + ) + , + , + , + fn + fn + + + + + $type + ) + fn + + diff --git a/psalm.xml b/psalm.xml index f03e94f..e044bd6 100644 --- a/psalm.xml +++ b/psalm.xml @@ -1,6 +1,6 @@ hasDefinition($serviceId)) { $definition = $container->getDefinition($serviceId); } elseif ($container->hasAlias($serviceId)) { - $definition = $container->getDefinition($container->getAlias($serviceId)); + $definition = $container->getDefinition($container->getAlias($serviceId)->__toString()); } else { throw new \LogicException(sprintf('[HappyrServiceMocking] Service or alias with id "%s" does not exist.', $serviceId)); }