From 0cee8046b9826f8dc5eec2ed366a401d74a94a32 Mon Sep 17 00:00:00 2001 From: Aydin Hassan Date: Tue, 16 Jan 2024 16:42:40 +0100 Subject: [PATCH] Try make phpstan work --- .github/workflows/php.yml | 39 +++++++++++++++++++++++---------------- phpstan.neon.dist | 17 +++++------------ tests/TestBootstrap.php | 2 +- 3 files changed, 29 insertions(+), 29 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index f14397f04..29a04c86c 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -13,31 +13,38 @@ on: workflow_dispatch: schedule: - cron: '0 3 * * *' + +env: + SHOPWARE_TOOL_CACHE_PHPSTAN: ${{ github.workspace }}/var/phpstan jobs: cs: if: github.event_name != 'schedule' uses: shopware/github-actions/.github/workflows/cs-fixer.yml@main phpstan: - uses: shopware/github-actions/.github/workflows/phpstan.yml@main + uses: shopware/github-actions/.github/workflows/phpstan.yml@phpstan-deps with: extensionName: SwagPayPal shopwareVersion: trunk + dependencies: |- + [ + {"name": "SwagCmsExtensions", "repo": "https://shopware:$CMS_TOKEN@gitlab.shopware.com/shopware/6/services/cms-extensions.git"} + ] + secrets: + env: CMS_TOKEN=${{ secrets.GITLAB_TOKEN }} phpunit: - runs-on: ubuntu-latest - steps: - - name: Setup Shopware - uses: FriendsOfShopware/setup-shopware@main - with: - shopware-version: trunk - php-version: 8.2 - php-extensions: pcov - - name: Clone Extension - uses: actions/checkout@v4 - with: - path: custom/plugins/SwagPayPal - - name: Run PHPUnit - working-directory: custom/plugins/SwagPayPal - run: ${{ github.workspace }}/vendor/bin/phpunit --coverage-clover clover.xml + uses: shopware/github-actions/.github/workflows/phpunit.yml@phpstan-deps + with: + uploadCoverage: true + extensionName: SwagPayPal + shopwareVersion: ${{ matrix.shopware-version }} + dependencies: |- + [ + {"name": "SwagCmsExtensions", "repo": "https://shopware:$CMS_TOKEN@gitlab.shopware.com/shopware/6/services/cms-extensions.git"} + ] + secrets: + env: CMS_TOKEN=${{ secrets.GITLAB_TOKEN }} + codecovToken: ${{ secrets.CODECOV_TOKEN }} + diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 24093cb80..ea186e435 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -1,5 +1,7 @@ includes: - - %ShopwareRoot%/vendor/phpstan/phpstan/conf/bleedingEdge.neon + - ../../../vendor/phpstan/phpstan/conf/bleedingEdge.neon + - ../../../src/Core/DevOps/StaticAnalyze/PHPStan/extension.neon + - ../../../src/Core/DevOps/StaticAnalyze/PHPStan/rules.neon parameters: phpVersion: 80100 @@ -15,11 +17,10 @@ parameters: excludePaths: - src/Resources - src/DevOps/Rector - symfony: constant_hassers: false - # the placeholder "%ShopwareHashedCacheDir%" will be replaced on execution by bin/phpstan-config-generator.php script - container_xml_path: '../../..%ShopwareHashedCacheDir%/%ShopwareKernelClass%DevDebugContainer.xml' + containerXmlPath: '../../../var/cache/phpstan_dev/Shopware_Core_DevOps_StaticAnalyze_StaticAnalyzeKernelPhpstan_devDebugContainer.xml' + consoleApplicationLoader: ../../../src/Core/DevOps/StaticAnalyze/console-application.php ignoreErrors: # We won't type all arrays/iterables for now @@ -45,11 +46,3 @@ parameters: path: tests/Webhook/Registration/WebhookSystemConfigControllerTest.php count: 11 - bootstrapFiles: - - bin/static-analyze-autoloader.php - -rules: - - Shopware\Core\DevOps\StaticAnalyze\PHPStan\Rules\Internal\InternalClassRule - - Shopware\Core\DevOps\StaticAnalyze\PHPStan\Rules\Internal\InternalClassRule - - Shopware\Core\DevOps\StaticAnalyze\PHPStan\Rules\Internal\InternalMethodRule - - Shopware\Core\DevOps\StaticAnalyze\PHPStan\Rules\PackageAnnotationRule diff --git a/tests/TestBootstrap.php b/tests/TestBootstrap.php index 54dce1a3d..783661f81 100644 --- a/tests/TestBootstrap.php +++ b/tests/TestBootstrap.php @@ -20,7 +20,7 @@ ->setProjectDir($_SERVER['PROJECT_ROOT'] ?? dirname(__DIR__, 4)) ->setLoadEnvFile(true) ->setForceInstallPlugins(true) - //->addActivePlugins('SwagCmsExtensions') + ->addActivePlugins('SwagCmsExtensions') ->addCallingPlugin() ->bootstrap() ->getClassLoader();