Skip to content

Commit

Permalink
CI: Fix calculating diff between branches in PRs (#7973)
Browse files Browse the repository at this point in the history
Make Mess Detector working again™️
  • Loading branch information
Wirone committed Apr 30, 2024
1 parent db8c6b0 commit 81b4ddb
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .github/workflows/sca.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

# We need to fetch base branch because `actions/checkout` only initializes empty repo and fetches PR's meta-branch
# which leads to `fatal: ambiguous argument 'origin/...': unknown revision or path not in the working tree.`,
# because of that `CHANGED_PHP_FILES` is not set, and tools based on diff between branches (like Mess Detector) don't work.
- name: Fetch base branch
if: ${{ github.event_name == 'pull_request' }}
run: git fetch --no-tags --prune --no-recurse-submodules --depth=1 origin $GITHUB_BASE_REF

- name: Setup PHP with Composer deps
uses: ./.github/composite-actions/setup-php-with-composer-deps
with:
Expand Down
2 changes: 1 addition & 1 deletion phpstan.dist.neon
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@ parameters:
-
message: '#^Method PhpCsFixer\\Tests\\.+::provide.+Cases\(\) return type has no value type specified in iterable type iterable\.$#'
path: tests
count: 1017
count: 1014
tipsOfTheDay: false
tmpDir: dev-tools/phpstan/cache
9 changes: 9 additions & 0 deletions tests/Fixer/ClassNotation/FinalClassFixerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ public function testFix(string $expected, ?string $input = null): void
$this->doTest($expected, $input);
}

/**
* @return iterable<array{0: string, 1?: string}>
*/
public static function provideFixCases(): iterable
{
yield ['<?php /** @Entity */ class MyEntity {}'];
Expand Down Expand Up @@ -104,6 +107,9 @@ public function testFix80(string $expected, ?string $input = null): void
$this->doTest($expected, $input);
}

/**
* @return iterable<array{0: string, 1?: string}>
*/
public static function provideFix80Cases(): iterable
{
yield ['<?php #[Entity] class MyEntity {}'];
Expand Down Expand Up @@ -207,6 +213,9 @@ public function testFix82(string $expected, ?string $input = null): void
$this->doTest($expected, $input);
}

/**
* @return iterable<array{0: string, 1?: string}>
*/
public static function provideFix82Cases(): iterable
{
yield ['<?php #[Entity] readonly class MyEntity {}'];
Expand Down

0 comments on commit 81b4ddb

Please sign in to comment.