Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
38 changes: 14 additions & 24 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ 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']
php: ['8.1', '8.2', '8.3', '8.4', '8.5']
postgis: ['3.4', '3.5', '3.6']
postgres: ['16', '17', '18']
exclude:
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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: |
Expand Down
15 changes: 10 additions & 5 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,16 @@ 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']
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:
- 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
Expand All @@ -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 }}-
Expand Down
2 changes: 1 addition & 1 deletion ci/php-cs-fixer/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
->setRules(
[
'@PSR2' => true,
'@PHP71Migration' => true,
'@PHP7x1Migration' => true,
'@DoctrineAnnotation' => true,
'@PhpCsFixer' => true,
'align_multiline_comment' => false,
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
},

"require": {
"php": "^8.1",
"php": "^8.1 <8.6",
"ext-ctype": "*",
"ext-json": "*",
"ext-mbstring": "*",
Expand All @@ -57,7 +57,7 @@
"symfony/cache": "^6.4||^7.0"
},
"suggest": {
"php": "^8.3",
"php": "^8.4",
"doctrine/orm": "~2.14||~3.0"
},

Expand Down
6 changes: 3 additions & 3 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 = {
Expand Down
11 changes: 7 additions & 4 deletions src/MartinGeorgiev/Doctrine/DBAL/Types/BaseIntegerArray.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
}

Expand All @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Loading