From b5545defb1ff3681a180f7a1c63dcb0e3dd7aa39 Mon Sep 17 00:00:00 2001 From: Martin Georgiev Date: Thu, 23 Oct 2025 14:20:56 +0100 Subject: [PATCH 1/8] chore: run the project on PHP 8.5 --- .github/workflows/integration-tests.yml | 3 ++- .github/workflows/unit-tests.yml | 3 ++- composer.json | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 4e319a02..29eb2919 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -43,7 +43,7 @@ jobs: strategy: fail-fast: false matrix: - php: ['8.1', '8.2', '8.3', '8.4'] + php: ['8.1', '8.2', '8.3', '8.4', '8.5'] postgis: ['3.4', '3.5', '3.6'] postgres: ['16', '17', '18'] exclude: @@ -88,6 +88,7 @@ jobs: coverage: ${{ matrix.calculate-code-coverage == true && 'xdebug' || 'none' }} extensions: ctype, json, mbstring, pdo_pgsql tools: composer + update: ${{ matrix.php == '8.5' }} - name: Validate composer.json and composer.lock run: composer validate --strict diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 1d56c7d7..4f72cdd7 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -43,7 +43,7 @@ jobs: strategy: fail-fast: false matrix: - php: ['8.1', '8.2', '8.3', '8.4'] + php: ['8.1', '8.2', '8.3', '8.4', '8.5'] doctrine-lexer: ['2.1', '3.0', 'latest'] doctrine-orm: ['2.14', '2.18', '3.0', 'latest'] include: @@ -70,6 +70,7 @@ jobs: coverage: ${{ matrix.calculate-code-coverage == true && 'xdebug' || 'none' }} extensions: ctype, json, mbstring tools: composer + update: ${{ matrix.php == '8.5' }} - name: Cache Composer packages id: composer-cache diff --git a/composer.json b/composer.json index a7d5a4e3..8792d975 100644 --- a/composer.json +++ b/composer.json @@ -37,7 +37,7 @@ }, "require": { - "php": "^8.1", + "php": "^8.1 <8.6", "ext-ctype": "*", "ext-json": "*", "ext-mbstring": "*", @@ -57,7 +57,7 @@ "symfony/cache": "^6.4||^7.0" }, "suggest": { - "php": "^8.3", + "php": "^8.4", "doctrine/orm": "~2.14||~3.0" }, From d9109782ac6705d2bf8e44bae556b7a80c564b98 Mon Sep 17 00:00:00 2001 From: Martin Georgiev Date: Thu, 23 Oct 2025 14:20:56 +0100 Subject: [PATCH 2/8] chore: run the project on PHP 8.5 --- .github/workflows/integration-tests.yml | 2 +- .github/workflows/unit-tests.yml | 2 +- composer.json | 4 ++-- .../Utils/PHPArrayToPostgresValueTransformerTest.php | 1 - 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 4e319a02..6f012e3f 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -43,7 +43,7 @@ jobs: strategy: fail-fast: false matrix: - php: ['8.1', '8.2', '8.3', '8.4'] + php: ['8.1', '8.2', '8.3', '8.4', '8.5'] postgis: ['3.4', '3.5', '3.6'] postgres: ['16', '17', '18'] exclude: diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 1d56c7d7..dd1cd460 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -43,7 +43,7 @@ jobs: strategy: fail-fast: false matrix: - php: ['8.1', '8.2', '8.3', '8.4'] + php: ['8.1', '8.2', '8.3', '8.4', '8.5'] doctrine-lexer: ['2.1', '3.0', 'latest'] doctrine-orm: ['2.14', '2.18', '3.0', 'latest'] include: diff --git a/composer.json b/composer.json index a7d5a4e3..8792d975 100644 --- a/composer.json +++ b/composer.json @@ -37,7 +37,7 @@ }, "require": { - "php": "^8.1", + "php": "^8.1 <8.6", "ext-ctype": "*", "ext-json": "*", "ext-mbstring": "*", @@ -57,7 +57,7 @@ "symfony/cache": "^6.4||^7.0" }, "suggest": { - "php": "^8.3", + "php": "^8.4", "doctrine/orm": "~2.14||~3.0" }, diff --git a/tests/Unit/MartinGeorgiev/Utils/PHPArrayToPostgresValueTransformerTest.php b/tests/Unit/MartinGeorgiev/Utils/PHPArrayToPostgresValueTransformerTest.php index d3371d12..6ad90acb 100644 --- a/tests/Unit/MartinGeorgiev/Utils/PHPArrayToPostgresValueTransformerTest.php +++ b/tests/Unit/MartinGeorgiev/Utils/PHPArrayToPostgresValueTransformerTest.php @@ -260,6 +260,5 @@ public function can_transform_array_with_gd_resource(): void $resource = \imagecreatetruecolor(1, 1); $result = PHPArrayToPostgresValueTransformer::transformToPostgresTextArray([$resource]); $this->assertStringContainsString('GdImage', $result); - \imagedestroy($resource); } } From 1af11d44f8d0a2958affd4ab571634c970bb2f8f Mon Sep 17 00:00:00 2001 From: Martin Georgiev Date: Thu, 23 Oct 2025 14:31:32 +0100 Subject: [PATCH 3/8] no message --- .github/workflows/integration-tests.yml | 1 - .github/workflows/unit-tests.yml | 1 - 2 files changed, 2 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 29eb2919..6f012e3f 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -88,7 +88,6 @@ jobs: coverage: ${{ matrix.calculate-code-coverage == true && 'xdebug' || 'none' }} extensions: ctype, json, mbstring, pdo_pgsql tools: composer - update: ${{ matrix.php == '8.5' }} - name: Validate composer.json and composer.lock run: composer validate --strict diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 4f72cdd7..dd1cd460 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -70,7 +70,6 @@ jobs: coverage: ${{ matrix.calculate-code-coverage == true && 'xdebug' || 'none' }} extensions: ctype, json, mbstring tools: composer - update: ${{ matrix.php == '8.5' }} - name: Cache Composer packages id: composer-cache From 64233736ecd88b0be1799a9b56fc068866b3bc82 Mon Sep 17 00:00:00 2001 From: Martin Georgiev Date: Thu, 23 Oct 2025 14:32:36 +0100 Subject: [PATCH 4/8] no message --- .github/workflows/integration-tests.yml | 2 +- .github/workflows/unit-tests.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 6f012e3f..b207d790 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -57,7 +57,7 @@ jobs: postgis: '3.5' include: # Code coverage on the latest stable combination - - php: '8.4' + - php: '8.5' postgres: '18' postgis: '3.6' calculate-code-coverage: true diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index dd1cd460..8bd1bf77 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -50,7 +50,7 @@ jobs: - php: '8.1' doctrine-orm: '2.14' doctrine-lexer: '1.2' - - php: '8.4' # Run coverage report only based on the latest dependencies + - php: '8.5' # Run coverage report only based on the latest dependencies doctrine-lexer: 'latest' doctrine-orm: 'latest' calculate-code-coverage: true From 13e26ef128056eef40275e7918c6b7f2592de04f Mon Sep 17 00:00:00 2001 From: Martin Georgiev Date: Thu, 23 Oct 2025 14:33:47 +0100 Subject: [PATCH 5/8] no message --- .github/workflows/ci.yml | 2 +- docs/CONTRIBUTING.md | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bbf4965c..72631e76 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,7 +46,7 @@ jobs: - name: Set up PHP uses: shivammathur/setup-php@bf6b4fbd49ca58e4608c9c89fba0b8d90bd2a39f # v2 with: - php-version: '8.4' + php-version: '8.5' extensions: ctype, json, mbstring tools: composer diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index f301a692..8d64f2b3 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -128,8 +128,8 @@ Using local-only plaintext secrets here is acceptable. For example, this file: - Install [Harlequin](https://harlequin.sh/) database TUI. -- Set PHP version to 8.4. -- Change PostgreSQL related environment variables. +- Set PHP version to 8.5. +- Change PostgreSQL-related environment variables. ```nix # devenv.local.nix @@ -139,7 +139,7 @@ For example, this file: packages = with pkgs; [ harlequin ]; # https://devenv.sh/languages/ - languages.php.version = "8.4"; + languages.php.version = "8.5"; # https://devenv.sh/basics/ env = { From 42e917eeae7ed097869218450f8aa126e2124fdd Mon Sep 17 00:00:00 2001 From: Martin Georgiev Date: Thu, 23 Oct 2025 14:39:50 +0100 Subject: [PATCH 6/8] no message --- ci/php-cs-fixer/config.php | 2 +- src/MartinGeorgiev/Doctrine/DBAL/Types/SpatialDataArray.php | 2 +- src/MartinGeorgiev/Utils/PHPArrayToPostgresValueTransformer.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ci/php-cs-fixer/config.php b/ci/php-cs-fixer/config.php index 59dc9edf..ddbe3247 100644 --- a/ci/php-cs-fixer/config.php +++ b/ci/php-cs-fixer/config.php @@ -18,7 +18,7 @@ ->setRules( [ '@PSR2' => true, - '@PHP71Migration' => true, + '@PHP7x1Migration' => true, '@DoctrineAnnotation' => true, '@PhpCsFixer' => true, 'align_multiline_comment' => false, diff --git a/src/MartinGeorgiev/Doctrine/DBAL/Types/SpatialDataArray.php b/src/MartinGeorgiev/Doctrine/DBAL/Types/SpatialDataArray.php index da8bf615..9b0275d3 100644 --- a/src/MartinGeorgiev/Doctrine/DBAL/Types/SpatialDataArray.php +++ b/src/MartinGeorgiev/Doctrine/DBAL/Types/SpatialDataArray.php @@ -200,7 +200,7 @@ private function parseUnquotedWktArray(string $content): array $wktItems[] = $currentWktItem; } - return \array_map('trim', $wktItems); + return \array_map(trim(...), $wktItems); } public function isValidArrayItemForDatabase(mixed $item): bool diff --git a/src/MartinGeorgiev/Utils/PHPArrayToPostgresValueTransformer.php b/src/MartinGeorgiev/Utils/PHPArrayToPostgresValueTransformer.php index caa540e5..9aa4831b 100644 --- a/src/MartinGeorgiev/Utils/PHPArrayToPostgresValueTransformer.php +++ b/src/MartinGeorgiev/Utils/PHPArrayToPostgresValueTransformer.php @@ -30,7 +30,7 @@ public static function transformToPostgresTextArray(array $phpArray): string return self::POSTGRESQL_EMPTY_ARRAY; } - if (\array_filter($phpArray, 'is_array')) { + if (\array_filter($phpArray, is_array(...))) { throw InvalidArrayFormatException::multiDimensionalArrayNotSupported(); } From ca591575091a5b0f2cccf655dc7e0add7647d702 Mon Sep 17 00:00:00 2001 From: Martin Georgiev Date: Thu, 23 Oct 2025 14:53:27 +0100 Subject: [PATCH 7/8] no message --- .../Doctrine/DBAL/Types/BaseIntegerArray.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/MartinGeorgiev/Doctrine/DBAL/Types/BaseIntegerArray.php b/src/MartinGeorgiev/Doctrine/DBAL/Types/BaseIntegerArray.php index e8eef5e0..fa4779cf 100644 --- a/src/MartinGeorgiev/Doctrine/DBAL/Types/BaseIntegerArray.php +++ b/src/MartinGeorgiev/Doctrine/DBAL/Types/BaseIntegerArray.php @@ -44,8 +44,7 @@ private function throwIfInvalidArrayItemForDatabase(mixed $item): void throw InvalidIntegerArrayItemForDatabaseException::doesNotMatchRegex($item); } - $doesNotFitIntoPHPInteger = $stringValue !== (string) (int) $stringValue; - if ($doesNotFitIntoPHPInteger) { + if (!$this->fitsInPHPInteger($stringValue)) { throw InvalidIntegerArrayItemForDatabaseException::isOutOfRange($item); } @@ -75,8 +74,7 @@ public function transformArrayItemForPHP(mixed $item): ?int throw InvalidIntegerArrayItemForPHPException::forValueThatIsNotAValidPHPInteger($item, static::TYPE_NAME); } - $doesNotFitIntoPHPInteger = $stringValue !== (string) (int) $stringValue; - if ($doesNotFitIntoPHPInteger) { + if (!$this->fitsInPHPInteger($stringValue)) { throw InvalidIntegerArrayItemForPHPException::forValueOutOfRangeInPHP($item, static::TYPE_NAME); } @@ -88,4 +86,9 @@ public function transformArrayItemForPHP(mixed $item): ?int return $integerValue; } + + private function fitsInPHPInteger(string $value): bool + { + return \filter_var($value, \FILTER_VALIDATE_INT) !== false; + } } From a2edf8bd79f5d06deda8e9f633453dbc792403fb Mon Sep 17 00:00:00 2001 From: Martin Georgiev Date: Thu, 23 Oct 2025 15:11:25 +0100 Subject: [PATCH 8/8] no message --- .github/workflows/integration-tests.yml | 34 +++++++++---------------- .github/workflows/unit-tests.yml | 11 +++++--- 2 files changed, 20 insertions(+), 25 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index b207d790..e24fea4d 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -41,7 +41,7 @@ jobs: name: "PostgreSQL ${{ matrix.postgres }} + PostGIS ${{ matrix.postgis }} + PHP ${{ matrix.php }}" strategy: - fail-fast: false + fail-fast: ${{ github.event_name == 'pull_request' }} matrix: php: ['8.1', '8.2', '8.3', '8.4', '8.5'] postgis: ['3.4', '3.5', '3.6'] @@ -92,15 +92,20 @@ jobs: - name: Validate composer.json and composer.lock run: composer validate --strict + - name: Get composer cache directory + id: composer-cache-dir + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + - name: Cache Composer packages - id: composer-cache uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4 with: - path: vendor - key: ${{ runner.os }}-php-${{ matrix.php }}-pg-${{ matrix.postgres }}-${{ hashFiles('**/composer.lock') }} + path: | + ${{ steps.composer-cache-dir.outputs.dir }} + vendor + key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }} restore-keys: | - ${{ runner.os }}-php-${{ matrix.php }}-pg-${{ matrix.postgres }}- - ${{ runner.os }}-php-${{ matrix.php }}- + ${{ runner.os }}-php-${{ matrix.php }}-composer- + ${{ runner.os }}-composer- - name: Install dependencies run: composer install --prefer-dist --no-interaction --no-progress @@ -112,22 +117,7 @@ jobs: - name: Verify PostgreSQL connection and setup run: | - echo "Checking PostgreSQL version:" - PGPASSWORD=postgres psql -h localhost -U postgres -d postgres_doctrine_test -c "SELECT version();" - - echo "\nChecking PostgreSQL configuration:" - PGPASSWORD=postgres psql -h localhost -U postgres -d postgres_doctrine_test -c "SHOW server_version;" - PGPASSWORD=postgres psql -h localhost -U postgres -d postgres_doctrine_test -c "SHOW max_connections;" - PGPASSWORD=postgres psql -h localhost -U postgres -d postgres_doctrine_test -c "SHOW shared_buffers;" - - echo "\nCreating test schema:" - PGPASSWORD=postgres psql -h localhost -U postgres -d postgres_doctrine_test -c "CREATE SCHEMA IF NOT EXISTS test;" - - echo "\nListing available PostgreSQL extensions:" - PGPASSWORD=postgres psql -h localhost -U postgres -d postgres_doctrine_test -c "SELECT * FROM pg_available_extensions;" - - echo "\nVerifying PostGIS installation:" - PGPASSWORD=postgres psql -h localhost -U postgres -d postgres_doctrine_test -c "SELECT PostGIS_Version();" + PGPASSWORD=postgres psql -h localhost -U postgres -d postgres_doctrine_test -c "CREATE SCHEMA IF NOT EXISTS test; SELECT PostGIS_Version();" - name: Run integration test suite run: | diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 8bd1bf77..73dcf4c1 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -41,7 +41,7 @@ jobs: name: "PHP ${{ matrix.php }} + Doctrine ORM ${{ matrix.doctrine-orm }} + Doctrine Lexer ${{ matrix.doctrine-lexer }}" strategy: - fail-fast: false + fail-fast: ${{ github.event_name == 'pull_request' }} matrix: php: ['8.1', '8.2', '8.3', '8.4', '8.5'] doctrine-lexer: ['2.1', '3.0', 'latest'] @@ -71,11 +71,16 @@ jobs: extensions: ctype, json, mbstring tools: composer + - name: Get composer cache directory + id: composer-cache-dir + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + - name: Cache Composer packages - id: composer-cache uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4 with: - path: vendor + path: | + ${{ steps.composer-cache-dir.outputs.dir }} + vendor key: ${{ runner.os }}-php-${{ matrix.php }}-orm-${{ matrix.doctrine-orm }}-lexer-${{ matrix.doctrine-lexer }}-${{ hashFiles('**/composer.lock') }} restore-keys: | ${{ runner.os }}-php-${{ matrix.php }}-orm-${{ matrix.doctrine-orm }}-lexer-${{ matrix.doctrine-lexer }}-