From 2764d34a7b7b23355cf2a9e9ac1ef12478744fff Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 24 Mar 2025 17:28:54 +0000 Subject: [PATCH 1/2] chore(deps): update dependency brainbits/phpcs-standard to v8 --- composer.json | 4 +- phpstan.neon.dist | 4 ++ src/HttpClientMock/HttpClientMockTrait.php | 3 +- .../Matcher/QueryParamMatcher.php | 3 +- src/ZipContents/FileInfo.php | 48 +++++++++---------- .../HttpClientMock/MockRequestBuilderTest.php | 2 +- .../SevenZipContents/SevenZipContentsTest.php | 2 +- .../SevenZipContentsTraitTest.php | 2 +- tests/ZipContents/ZipContentsTest.php | 2 +- tests/ZipContents/ZipContentsTraitTest.php | 2 +- tests/ZipContents/ZipInfoTest.php | 2 +- 11 files changed, 40 insertions(+), 34 deletions(-) diff --git a/composer.json b/composer.json index aad8250..47a1143 100644 --- a/composer.json +++ b/composer.json @@ -13,11 +13,11 @@ "ext-mbstring": "*", "ext-simplexml": "*", "ext-tidy": "*", - "brainbits/phpcs-standard": "^7.0.1", + "brainbits/phpcs-standard": "^8.0.0", "brainbits/phpstan-rules": "^4.0", "dama/doctrine-test-bundle": "^8.2", "doctrine/dbal": "^3.9", - "ergebnis/phpstan-rules": "^2.6", + "ergebnis/phpstan-rules": "^2.8", "gemorroj/archive7z": "^5.7", "mikey179/vfsstream": "^1.6.12", "monolog/monolog": "^2.0 || ^3.0", diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 1eab7fd..da110c7 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -10,6 +10,10 @@ parameters: - '#Constructor in .* has parameter .* with default value#' - '#SchemaBuilder::foo\(\)#' ergebnis: + noAssignByReference: + enabled: false + noParameterPassedByReference: + enabled: false noNullableReturnTypeDeclaration: enabled: false noParameterWithNullableTypeDeclaration: diff --git a/src/HttpClientMock/HttpClientMockTrait.php b/src/HttpClientMock/HttpClientMockTrait.php index 5977ac0..4e685e9 100644 --- a/src/HttpClientMock/HttpClientMockTrait.php +++ b/src/HttpClientMock/HttpClientMockTrait.php @@ -25,6 +25,7 @@ use function trigger_deprecation; use function ucfirst; use function urldecode; +use function vsprintf; /** @mixin TestCase */ trait HttpClientMockTrait @@ -476,7 +477,7 @@ protected static function mockRequestMessage( string $messageTemplate, mixed ...$values, ): string { - $message = sprintf($messageTemplate, ...$values); + $message = vsprintf($messageTemplate, $values); return $userMessage !== '' ? ucfirst($userMessage) . '. ' . $message diff --git a/src/HttpClientMock/Matcher/QueryParamMatcher.php b/src/HttpClientMock/Matcher/QueryParamMatcher.php index af591d4..e718ac5 100644 --- a/src/HttpClientMock/Matcher/QueryParamMatcher.php +++ b/src/HttpClientMock/Matcher/QueryParamMatcher.php @@ -7,6 +7,7 @@ use Brainbits\FunctionalTestHelpers\HttpClientMock\RealRequest; use function sprintf; +use function vsprintf; final readonly class QueryParamMatcher implements Matcher { @@ -15,7 +16,7 @@ /** @param array $placeholders */ public function __construct(private string $key, string $value, array $placeholders) { - $this->value = sprintf($value, ...$placeholders); + $this->value = vsprintf($value, $placeholders); } public function __invoke(RealRequest $realRequest): Hit|Mismatch|Missing diff --git a/src/ZipContents/FileInfo.php b/src/ZipContents/FileInfo.php index 5f5ea76..7adbf21 100644 --- a/src/ZipContents/FileInfo.php +++ b/src/ZipContents/FileInfo.php @@ -18,30 +18,30 @@ final class FileInfo { - private const COMPRESSION_STORED = 0; - private const COMPRESSION_SHRUNK = 1; - private const COMPRESSION_REDUCED_FACTOR_1 = 2; - private const COMPRESSION_REDUCED_FACTOR_2 = 3; - private const COMPRESSION_REDUCED_FACTOR_3 = 4; - private const COMPRESSION_REDUCED_FACTOR_4 = 5; - private const COMPRESSION_IMPLODED = 6; - private const COMPRESSION_DEFLATED = 8; - private const COMPRESSION_DEFLATE64 = 9; - private const COMPRESSION_PKZIP = 10; - private const COMPRESSION_BZIP2 = 12; - private const COMPRESSION_LZMA = 14; - private const COMPRESSION_CMPSC = 16; - private const COMPRESSION_TERSE = 18; - private const COMPRESSION_LZ77 = 19; - private const COMPRESSION_ZSTD = 93; - private const COMPRESSION_MP3 = 94; - private const COMPRESSION_XZ = 95; - private const COMPRESSION_JPEG = 96; - private const COMPRESSION_WAVPACK = 97; - private const COMPRESSION_PPMD = 98; - private const COMPRESSION_AEX = 99; - - private const COMPRESSION_MAP = [ + private const int COMPRESSION_STORED = 0; + private const int COMPRESSION_SHRUNK = 1; + private const int COMPRESSION_REDUCED_FACTOR_1 = 2; + private const int COMPRESSION_REDUCED_FACTOR_2 = 3; + private const int COMPRESSION_REDUCED_FACTOR_3 = 4; + private const int COMPRESSION_REDUCED_FACTOR_4 = 5; + private const int COMPRESSION_IMPLODED = 6; + private const int COMPRESSION_DEFLATED = 8; + private const int COMPRESSION_DEFLATE64 = 9; + private const int COMPRESSION_PKZIP = 10; + private const int COMPRESSION_BZIP2 = 12; + private const int COMPRESSION_LZMA = 14; + private const int COMPRESSION_CMPSC = 16; + private const int COMPRESSION_TERSE = 18; + private const int COMPRESSION_LZ77 = 19; + private const int COMPRESSION_ZSTD = 93; + private const int COMPRESSION_MP3 = 94; + private const int COMPRESSION_XZ = 95; + private const int COMPRESSION_JPEG = 96; + private const int COMPRESSION_WAVPACK = 97; + private const int COMPRESSION_PPMD = 98; + private const int COMPRESSION_AEX = 99; + + private const array COMPRESSION_MAP = [ self::COMPRESSION_STORED => 'stored (no compression)', self::COMPRESSION_SHRUNK => 'Shrunk', self::COMPRESSION_REDUCED_FACTOR_1 => 'Reduced with compression factor 1', diff --git a/tests/HttpClientMock/MockRequestBuilderTest.php b/tests/HttpClientMock/MockRequestBuilderTest.php index b3857b0..3495277 100644 --- a/tests/HttpClientMock/MockRequestBuilderTest.php +++ b/tests/HttpClientMock/MockRequestBuilderTest.php @@ -316,7 +316,7 @@ public function testEmptyResponsesThrowsException(): void $this->expectException(NoResponseMock::class); $this->expectExceptionMessage('No response configured for:'); - $mockRequestBuilder = (new MockRequestBuilder()); + $mockRequestBuilder = new MockRequestBuilder(); $mockRequestBuilder->nextResponse(); } diff --git a/tests/SevenZipContents/SevenZipContentsTest.php b/tests/SevenZipContents/SevenZipContentsTest.php index b7d447c..1d6c3fb 100644 --- a/tests/SevenZipContents/SevenZipContentsTest.php +++ b/tests/SevenZipContents/SevenZipContentsTest.php @@ -23,7 +23,7 @@ #[CoversClass(SevenZipContents::class)] final class SevenZipContentsTest extends TestCase { - private const FILE_7Z = __DIR__ . '/../files/test.7z'; + private const string FILE_7Z = __DIR__ . '/../files/test.7z'; protected function setUp(): void { diff --git a/tests/SevenZipContents/SevenZipContentsTraitTest.php b/tests/SevenZipContents/SevenZipContentsTraitTest.php index b6b8fcb..f51e013 100644 --- a/tests/SevenZipContents/SevenZipContentsTraitTest.php +++ b/tests/SevenZipContents/SevenZipContentsTraitTest.php @@ -14,7 +14,7 @@ final class SevenZipContentsTraitTest extends TestCase { use SevenZipContentsTrait; - private const FILE = __DIR__ . '/../files/test.7z'; + private const string FILE = __DIR__ . '/../files/test.7z'; protected function setUp(): void { diff --git a/tests/ZipContents/ZipContentsTest.php b/tests/ZipContents/ZipContentsTest.php index 5afef26..1d508d9 100644 --- a/tests/ZipContents/ZipContentsTest.php +++ b/tests/ZipContents/ZipContentsTest.php @@ -16,7 +16,7 @@ #[CoversClass(ZipContents::class)] final class ZipContentsTest extends TestCase { - private const FILE = __DIR__ . '/../files/test.zip'; + private const string FILE = __DIR__ . '/../files/test.zip'; public function testItNeedsFile(): void { diff --git a/tests/ZipContents/ZipContentsTraitTest.php b/tests/ZipContents/ZipContentsTraitTest.php index 994f86c..200676f 100644 --- a/tests/ZipContents/ZipContentsTraitTest.php +++ b/tests/ZipContents/ZipContentsTraitTest.php @@ -15,7 +15,7 @@ final class ZipContentsTraitTest extends TestCase { use ZipContentsTrait; - private const FILE = __DIR__ . '/../files/test.zip'; + private const string FILE = __DIR__ . '/../files/test.zip'; public function testAssertZipHasSizeForZipFileFails(): void { diff --git a/tests/ZipContents/ZipInfoTest.php b/tests/ZipContents/ZipInfoTest.php index 4aedcd4..bc78f8a 100644 --- a/tests/ZipContents/ZipInfoTest.php +++ b/tests/ZipContents/ZipInfoTest.php @@ -14,7 +14,7 @@ #[CoversClass(ZipInfo::class)] final class ZipInfoTest extends TestCase { - private const FILE = __DIR__ . '/../files/test.zip'; + private const string FILE = __DIR__ . '/../files/test.zip'; public function testZipFile(): void { From cf3fbaf208f35cffe653bbd48afabf69611713b4 Mon Sep 17 00:00:00 2001 From: Stephan Wentz Date: Tue, 25 Mar 2025 08:55:46 +0100 Subject: [PATCH 2/2] ci: Add tests for php 8.4 --- .github/workflows/build.yml | 1 + .github/workflows/code_coverage.yaml | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 110cbf8..e95d4ea 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,6 +19,7 @@ jobs: dependencies: ["lowest", "highest"] php-version: - "8.3" + - "8.4" steps: - name: "Checkout" diff --git a/.github/workflows/code_coverage.yaml b/.github/workflows/code_coverage.yaml index dfb1b38..cb3d7d1 100644 --- a/.github/workflows/code_coverage.yaml +++ b/.github/workflows/code_coverage.yaml @@ -14,7 +14,7 @@ jobs: - uses: actions/checkout@v4 - uses: shivammathur/setup-php@master with: - php-version: 8.3 + php-version: 8.4 coverage: xdebug - name: Load dependencies from cache id: composer-cache @@ -23,9 +23,9 @@ jobs: - uses: actions/cache@v4 with: path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-php8.3-composer-${{ hashFiles('**/composer.json') }} + key: ${{ runner.os }}-php8.4-composer-${{ hashFiles('**/composer.json') }} restore-keys: | - ${{ runner.os }}-php8.3-composer- + ${{ runner.os }}-php8.4-composer- - run: composer install --prefer-dist --no-progress --no-suggest - run: php vendor/bin/phpunit --coverage-clover build/logs/clover.xml