From 86acad7651cb751730b582cfbb6ff7f7976aa252 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Planchat?= Date: Tue, 21 Nov 2023 13:53:03 +0100 Subject: [PATCH] Updated PHPSpec level from 3 to 8 --- .github/workflows/phpstan-6.yaml | 23 ------------------- .github/workflows/phpstan-7.yaml | 23 ------------------- .github/workflows/phpstan-8.yaml | 23 ------------------- .../{phpstan-5.yaml => phpstan-9.yaml} | 4 ++-- .github/workflows/quality.yaml | 4 ++-- src/BuilderTestCase.php | 4 ++++ .../Pipeline/PipelineExtractsLike.php | 7 ++++-- src/Mock/ApiClientMockBuilder.php | 2 +- 8 files changed, 14 insertions(+), 76 deletions(-) delete mode 100644 .github/workflows/phpstan-6.yaml delete mode 100644 .github/workflows/phpstan-7.yaml delete mode 100644 .github/workflows/phpstan-8.yaml rename .github/workflows/{phpstan-5.yaml => phpstan-9.yaml} (93%) diff --git a/.github/workflows/phpstan-6.yaml b/.github/workflows/phpstan-6.yaml deleted file mode 100644 index a367107..0000000 --- a/.github/workflows/phpstan-6.yaml +++ /dev/null @@ -1,23 +0,0 @@ -name: PHPStan level 6 -on: push -jobs: - phpstan: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/cache@v3 - with: - path: '**/vendor' - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: | - ${{ runner.os }}-composer- - - uses: php-actions/composer@v6 - with: - args: --prefer-dist - php_version: '8.2' - - name: PHPStan - uses: php-actions/phpstan@v3 - with: - path: src/ - level: 6 - php_version: '8.2' diff --git a/.github/workflows/phpstan-7.yaml b/.github/workflows/phpstan-7.yaml deleted file mode 100644 index cad733d..0000000 --- a/.github/workflows/phpstan-7.yaml +++ /dev/null @@ -1,23 +0,0 @@ -name: PHPStan level 7 -on: push -jobs: - phpstan: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/cache@v3 - with: - path: '**/vendor' - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: | - ${{ runner.os }}-composer- - - uses: php-actions/composer@v6 - with: - args: --prefer-dist - php_version: '8.2' - - name: PHPStan - uses: php-actions/phpstan@v3 - with: - path: src/ - level: 7 - php_version: '8.2' diff --git a/.github/workflows/phpstan-8.yaml b/.github/workflows/phpstan-8.yaml deleted file mode 100644 index 8d7aec6..0000000 --- a/.github/workflows/phpstan-8.yaml +++ /dev/null @@ -1,23 +0,0 @@ -name: PHPStan level 8 -on: push -jobs: - phpstan: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/cache@v3 - with: - path: '**/vendor' - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: | - ${{ runner.os }}-composer- - - uses: php-actions/composer@v6 - with: - args: --prefer-dist - php_version: '8.2' - - name: PHPStan - uses: php-actions/phpstan@v3 - with: - path: src/ - level: 8 - php_version: '8.2' diff --git a/.github/workflows/phpstan-5.yaml b/.github/workflows/phpstan-9.yaml similarity index 93% rename from .github/workflows/phpstan-5.yaml rename to .github/workflows/phpstan-9.yaml index 906b4c9..9e64ec4 100644 --- a/.github/workflows/phpstan-5.yaml +++ b/.github/workflows/phpstan-9.yaml @@ -1,4 +1,4 @@ -name: PHPStan level 5 +name: PHPStan level 9 on: push jobs: phpstan: @@ -19,5 +19,5 @@ jobs: uses: php-actions/phpstan@v3 with: path: src/ - level: 5 + level: 9 php_version: '8.2' diff --git a/.github/workflows/quality.yaml b/.github/workflows/quality.yaml index 7457967..c3e2001 100644 --- a/.github/workflows/quality.yaml +++ b/.github/workflows/quality.yaml @@ -1,4 +1,4 @@ -name: Quality +name: Quality (PHPSpec level 8) on: push jobs: cs-fixer: @@ -34,5 +34,5 @@ jobs: uses: php-actions/phpstan@v3 with: path: src/ - level: 3 + level: 8 php_version: '8.2' diff --git a/src/BuilderTestCase.php b/src/BuilderTestCase.php index 632b71e..49488f6 100644 --- a/src/BuilderTestCase.php +++ b/src/BuilderTestCase.php @@ -25,6 +25,10 @@ protected function tearDown(): void protected function getBuilderCompilePath(): string { + if ($this->fs === null) { + throw new \RuntimeException('The virtual file system was not initialized. The '.__METHOD__.' method should be called after the '.get_class($this).'::setUp() method was called and after the '.get_class($this).'::tearDown() method is called.'); + } + return $this->fs->url(); } diff --git a/src/Constraint/Pipeline/PipelineExtractsLike.php b/src/Constraint/Pipeline/PipelineExtractsLike.php index 2c57f46..16d4aa1 100644 --- a/src/Constraint/Pipeline/PipelineExtractsLike.php +++ b/src/Constraint/Pipeline/PipelineExtractsLike.php @@ -4,6 +4,7 @@ namespace Kiboko\Component\PHPUnitExtension\Constraint\Pipeline; +use Kiboko\Contract\Bucket\ResultBucketInterface; use Kiboko\Contract\Pipeline\ExtractorInterface; use Kiboko\Contract\Pipeline\NullStepRejection; use Kiboko\Contract\Pipeline\NullStepState; @@ -26,9 +27,11 @@ public function __construct( } /** - * @param list $iterable + * @template ItemType * - * @return \Iterator + * @param list $iterable + * + * @return \Iterator */ private function asIterator(iterable $iterable): \Iterator { diff --git a/src/Mock/ApiClientMockBuilder.php b/src/Mock/ApiClientMockBuilder.php index b798260..1be4b69 100644 --- a/src/Mock/ApiClientMockBuilder.php +++ b/src/Mock/ApiClientMockBuilder.php @@ -17,7 +17,7 @@ final class ApiClientMockBuilder implements Builder /** @param array $mockedArgs */ public function __construct( private readonly string $mockedClientBuilder, - private readonly ?array $mockedArgs = [] + private readonly array $mockedArgs = [] ) { $this->node = new Node\Expr\New_( class: new Node\Name\FullyQualified($this->mockedClientBuilder),