Skip to content

Commit 6c7bdb0

Browse files
Merge branch 'main' into constants-for-types
2 parents 23dfb90 + c2fd34d commit 6c7bdb0

File tree

16 files changed

+197
-60
lines changed

16 files changed

+197
-60
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "3.6.1"
2+
".": "3.6.2"
33
}

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ jobs:
4141
name: "Code Quality"
4242

4343
steps:
44-
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
44+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
4545

4646
- name: Set up PHP
47-
uses: shivammathur/setup-php@bf6b4fbd49ca58e4608c9c89fba0b8d90bd2a39f # v2
47+
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # v2
4848
with:
4949
php-version: '8.5'
5050
extensions: ctype, json, mbstring

.github/workflows/coverage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
timeout-minutes: 20
3434

3535
- name: Finalize Coveralls parallel build
36-
uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b # v2
36+
uses: coverallsapp/github-action@5cbfd81b66ca5d10c19b062c04de0199c215fb6e # v2
3737
env:
3838
COVERALLS_SERVICE_NAME: github
3939
COVERALLS_SERVICE_NUMBER: ${{ github.sha }}

.github/workflows/integration-tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,10 @@ jobs:
7979
-e POSTGRES_INITDB_ARGS="--data-checksums"
8080
8181
steps:
82-
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
82+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
8383

8484
- name: Set up PHP
85-
uses: shivammathur/setup-php@bf6b4fbd49ca58e4608c9c89fba0b8d90bd2a39f # v2
85+
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # v2
8686
with:
8787
php-version: ${{ matrix.php }}
8888
coverage: ${{ matrix.calculate-code-coverage == true && 'xdebug' || 'none' }}
@@ -135,7 +135,7 @@ jobs:
135135

136136
- name: Upload coverage results to Coveralls
137137
if: matrix.calculate-code-coverage == true
138-
uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b # v2
138+
uses: coverallsapp/github-action@5cbfd81b66ca5d10c19b062c04de0199c215fb6e # v2
139139
env:
140140
COVERALLS_SERVICE_NAME: github
141141
COVERALLS_SERVICE_NUMBER: ${{ github.sha }}

.github/workflows/unit-tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ jobs:
6161
doctrine-lexer: '2.1'
6262

6363
steps:
64-
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
64+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
6565

6666
- name: Set up PHP with PECL extension
67-
uses: shivammathur/setup-php@bf6b4fbd49ca58e4608c9c89fba0b8d90bd2a39f # v2
67+
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # v2
6868
with:
6969
php-version: ${{ matrix.php }}
7070
coverage: ${{ matrix.calculate-code-coverage == true && 'xdebug' || 'none' }}
@@ -124,7 +124,7 @@ jobs:
124124
125125
- name: Upload coverage results to Coveralls
126126
if: matrix.calculate-code-coverage == true
127-
uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b # v2
127+
uses: coverallsapp/github-action@5cbfd81b66ca5d10c19b062c04de0199c215fb6e # v2
128128
env:
129129
COVERALLS_SERVICE_NAME: github
130130
COVERALLS_SERVICE_NUMBER: ${{ github.sha }}

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## [3.6.2](https://github.com/martin-georgiev/postgresql-for-doctrine/compare/v3.6.1...v3.6.2) (2025-11-25)
4+
5+
6+
### Bug Fixes
7+
8+
* **#482:** Always preserve strings (even if they are obviously numerical) when transforming a `TEXTARRAY` value into a PHP array ([#488](https://github.com/martin-georgiev/postgresql-for-doctrine/issues/488)) ([77eed3e](https://github.com/martin-georgiev/postgresql-for-doctrine/commit/77eed3eea3266b5f6b436f4bf624246299527d61))
9+
310
## [3.6.1](https://github.com/martin-georgiev/postgresql-for-doctrine/compare/v3.6.0...v3.6.1) (2025-11-08)
411

512

composer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,15 @@
4747
"deptrac/deptrac": "^4.0",
4848
"doctrine/orm": "~2.14||~3.0",
4949
"ekino/phpstan-banned-code": "^3.0",
50-
"friendsofphp/php-cs-fixer": "^3.89.2",
50+
"friendsofphp/php-cs-fixer": "^3.90.0",
5151
"phpstan/phpstan": "^2.1.32",
5252
"phpstan/phpstan-deprecation-rules": "^2.0.3",
5353
"phpstan/phpstan-doctrine": "^2.0.11",
5454
"phpstan/phpstan-phpunit": "^2.0.8",
5555
"phpunit/phpunit": "^10.5.58",
5656
"rector/rector": "^2.2.8",
57-
"symfony/cache": "^6.4||^7.0"
57+
"symfony/cache": "^6.4||^7.0",
58+
"symfony/var-exporter": "^6.4||^7.0"
5859
},
5960
"suggest": {
6061
"php": "^8.4",

src/MartinGeorgiev/Doctrine/DBAL/Types/GeographyArray.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
namespace MartinGeorgiev\Doctrine\DBAL\Types;
66

7-
use Doctrine\DBAL\Types\ConversionException;
87
use MartinGeorgiev\Doctrine\DBAL\Type;
98
use MartinGeorgiev\Doctrine\DBAL\Types\Exceptions\InvalidGeographyForPHPException;
109

@@ -22,12 +21,12 @@ protected function transformArrayItemForPostgres(mixed $item): string
2221
return (string) $this->getValidatedArrayItem($item);
2322
}
2423

25-
protected function createInvalidTypeExceptionForPHP(mixed $item): ConversionException
24+
protected function createInvalidTypeExceptionForPHP(mixed $item): InvalidGeographyForPHPException
2625
{
2726
return InvalidGeographyForPHPException::forInvalidType($item);
2827
}
2928

30-
protected function createInvalidFormatExceptionForPHP(mixed $item): ConversionException
29+
protected function createInvalidFormatExceptionForPHP(mixed $item): InvalidGeographyForPHPException
3130
{
3231
return InvalidGeographyForPHPException::forInvalidFormat($item);
3332
}

src/MartinGeorgiev/Doctrine/DBAL/Types/GeometryArray.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
namespace MartinGeorgiev\Doctrine\DBAL\Types;
66

7-
use Doctrine\DBAL\Types\ConversionException;
87
use MartinGeorgiev\Doctrine\DBAL\Type;
98
use MartinGeorgiev\Doctrine\DBAL\Types\Exceptions\InvalidGeometryForPHPException;
109

@@ -22,12 +21,12 @@ protected function transformArrayItemForPostgres(mixed $item): string
2221
return (string) $this->getValidatedArrayItem($item);
2322
}
2423

25-
protected function createInvalidTypeExceptionForPHP(mixed $item): ConversionException
24+
protected function createInvalidTypeExceptionForPHP(mixed $item): InvalidGeometryForPHPException
2625
{
2726
return InvalidGeometryForPHPException::forInvalidType($item);
2827
}
2928

30-
protected function createInvalidFormatExceptionForPHP(mixed $item): ConversionException
29+
protected function createInvalidFormatExceptionForPHP(mixed $item): InvalidGeometryForPHPException
3130
{
3231
return InvalidGeometryForPHPException::forInvalidFormat($item);
3332
}

src/MartinGeorgiev/Doctrine/DBAL/Types/TextArray.php

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -63,31 +63,9 @@ public function convertToPHPValue($value, AbstractPlatform $platform): ?array
6363

6464
protected function transformFromPostgresTextArray(string $postgresValue): array
6565
{
66-
$values = PostgresArrayToPHPArrayTransformer::transformPostgresArrayToPHPArray($postgresValue);
67-
68-
// No matter what the original PHP array items' data types were,
69-
// once they are stored in PostgreSQL, all of them will become strings.
70-
// Therefore, we need to ensure all items in the returned PHP array are strings.
71-
foreach ($values as $key => $value) {
72-
if (\is_string($value)) {
73-
continue;
74-
}
75-
76-
if (\is_bool($value)) {
77-
$values[$key] = $value ? 'true' : 'false';
78-
79-
continue;
80-
}
81-
82-
if ($value === null) {
83-
$values[$key] = 'null';
84-
85-
continue;
86-
}
87-
88-
$values[$key] = (string) $value; // @phpstan-ignore-line
89-
}
90-
91-
return $values;
66+
return PostgresArrayToPHPArrayTransformer::transformPostgresArrayToPHPArray(
67+
$postgresValue,
68+
preserveStringTypes: true
69+
);
9270
}
9371
}

0 commit comments

Comments
 (0)