From e0af4dafa657c78d6521597f09d67c306077acbd Mon Sep 17 00:00:00 2001 From: Kamil Kokot Date: Mon, 13 Dec 2021 14:07:47 +0100 Subject: [PATCH 1/5] Run static analysis with Symfony 6 --- .github/workflows/build.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4454322..4a2b741 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -40,7 +40,7 @@ jobs: run: composer validate --no-check-lock - name: Remove analysis dependencies - run: composer remove --dev --no-update sylius-labs/coding-standard vimeo/psalm + run: composer remove --dev --no-update sylius-labs/coding-standard if: matrix.symfony-version == '6.0.*' - name: Install dependencies @@ -50,7 +50,6 @@ jobs: - name: Run analysis run: composer analyse - if: matrix.symfony-version != '6.0.*' - name: Run tests run: composer test From 4dab7f87794767ebaa900d0deaa9f15e6d40addd Mon Sep 17 00:00:00 2001 From: Kamil Kokot Date: Mon, 13 Dec 2021 14:13:56 +0100 Subject: [PATCH 2/5] Run Psalm with --php-version --- .github/workflows/build.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4a2b741..e3b2681 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -37,7 +37,7 @@ jobs: tools: composer:v2, flex - name: Validate composer.json - run: composer validate --no-check-lock + run: composer validate --strict - name: Remove analysis dependencies run: composer remove --dev --no-update sylius-labs/coding-standard @@ -48,8 +48,12 @@ jobs: env: SYMFONY_REQUIRE: "${{ matrix.symfony-version }}" - - name: Run analysis - run: composer analyse + - name: Run coding standard + run: vendor/bin/ecs check --ansi --no-progress-bar src tests + if: matrix.symfony-version != '6.0.*' + + - name: Run Psalm + run: vendor/bin/psalm src --no-progress --php-version="${{ matrix.php-version }}" - name: Run tests run: composer test From 2d0d0a40ac88d08d59be300b913c4c61154b177b Mon Sep 17 00:00:00 2001 From: Kamil Kokot Date: Mon, 13 Dec 2021 14:17:59 +0100 Subject: [PATCH 3/5] Allow for Psalm and ECS to run on all builds --- .github/workflows/build.yml | 5 ----- composer.json | 2 +- easy-coding-standard.yml | 2 -- ecs.php | 9 +++++++++ 4 files changed, 10 insertions(+), 8 deletions(-) delete mode 100644 easy-coding-standard.yml create mode 100644 ecs.php diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e3b2681..26c3bd7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,10 +39,6 @@ jobs: - name: Validate composer.json run: composer validate --strict - - name: Remove analysis dependencies - run: composer remove --dev --no-update sylius-labs/coding-standard - if: matrix.symfony-version == '6.0.*' - - name: Install dependencies run: composer install --prefer-dist --no-progress env: @@ -50,7 +46,6 @@ jobs: - name: Run coding standard run: vendor/bin/ecs check --ansi --no-progress-bar src tests - if: matrix.symfony-version != '6.0.*' - name: Run Psalm run: vendor/bin/psalm src --no-progress --php-version="${{ matrix.php-version }}" diff --git a/composer.json b/composer.json index a782887..edb2060 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ "friends-of-behat/mink-extension": "^2.5", "friends-of-behat/page-object-extension": "^0.3.2", "friends-of-behat/service-container-extension": "^1.1", - "sylius-labs/coding-standard": "^3.2", + "sylius-labs/coding-standard": "^4.1.1", "symfony/browser-kit": "^4.4 || ^5.1 || ^6.0", "symfony/framework-bundle": "^4.4 || ^5.1 || ^6.0", "symfony/process": "^4.4 || ^5.1 || ^6.0", diff --git a/easy-coding-standard.yml b/easy-coding-standard.yml deleted file mode 100644 index 2403599..0000000 --- a/easy-coding-standard.yml +++ /dev/null @@ -1,2 +0,0 @@ -imports: - - { resource: 'vendor/sylius-labs/coding-standard/easy-coding-standard.yml' } diff --git a/ecs.php b/ecs.php new file mode 100644 index 0000000..d2c4877 --- /dev/null +++ b/ecs.php @@ -0,0 +1,9 @@ +import(__DIR__ . '/vendor/sylius-labs/coding-standard/ecs.php'); +}; From d3fa3625e60467f688a6978627b4c83a0578dc00 Mon Sep 17 00:00:00 2001 From: Kamil Kokot Date: Mon, 13 Dec 2021 14:18:17 +0100 Subject: [PATCH 4/5] Apply coding standard fixes --- tests/Behat/Context/TestContext.php | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/tests/Behat/Context/TestContext.php b/tests/Behat/Context/TestContext.php index 4e66d02..8bcf1e8 100644 --- a/tests/Behat/Context/TestContext.php +++ b/tests/Behat/Context/TestContext.php @@ -78,7 +78,8 @@ CON */ public function workingSymfonyApplicationWithExtension(): void { - $this->thereIsConfiguration(<<<'CON' + $this->thereIsConfiguration( + <<<'CON' default: extensions: FriendsOfBehat\SymfonyExtension: @@ -89,7 +90,9 @@ CON $this->standardSymfonyAutoloaderConfigured(); - $this->thereIsFile('src/Kernel.php', <<<'CON' + $this->thereIsFile( + 'src/Kernel.php', + <<<'CON' thereIsFile('src/Controller.php', <<<'CON' + $this->thereIsFile( + 'src/Controller.php', + <<<'CON' thereIsFile('src/Counter.php', <<<'CON' + $this->thereIsFile( + 'src/Counter.php', + <<<'CON' thereIsFile('config/default.yaml', <<<'YML' + $this->thereIsFile( + 'config/default.yaml', + <<<'YML' services: App\Controller: arguments: From b537524fdd92f4c9bd8cd47383dc703e1843abfc Mon Sep 17 00:00:00 2001 From: Kamil Kokot Date: Mon, 13 Dec 2021 14:21:45 +0100 Subject: [PATCH 5/5] Fix null is a reserved word error --- psalm.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/psalm.xml b/psalm.xml index 38fcca1..3115a12 100644 --- a/psalm.xml +++ b/psalm.xml @@ -27,5 +27,12 @@ + + + + + + +