Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 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
4 changes: 2 additions & 2 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
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
4 changes: 2 additions & 2 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ 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:
- 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 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