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
12 changes: 9 additions & 3 deletions ci/php-cs-fixer/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use PhpCsFixer\Config;
use PhpCsFixer\Finder;
use PhpCsFixer\Runner\Parallel\ParallelConfigFactory;

$basePath = __DIR__.'/../../';

Expand All @@ -13,9 +14,7 @@
->in($basePath.'src')
->in($basePath.'tests');

$config = new Config();

return $config
$config = (new Config())
->setRules(
[
'@PSR2' => true,
Expand Down Expand Up @@ -54,6 +53,13 @@
)
->setRiskyAllowed(true)
->setUsingCache(false)

->setIndent(' ')
->setLineEnding("\n")
->setFinder($finder);

if (\method_exists($config, 'setParallelConfig')) {
$config->setParallelConfig(ParallelConfigFactory::detect());
}

return $config;
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"deptrac analyze --config-file=./ci/deptrac/config.yml --cache-file=./ci/deptrac/.cache --no-interaction --no-progress"
],
"php-cs-fixer": [
"PHP_CS_FIXER_IGNORE_ENV=1 php-cs-fixer fix --config=./ci/php-cs-fixer/config.php --show-progress=none --no-interaction --diff -v"
"php-cs-fixer fix --config=./ci/php-cs-fixer/config.php --allow-unsupported-php-version=yes --show-progress=none --no-interaction --diff -v"
],
"phpstan": [
"phpstan analyse --configuration=./ci/phpstan/config.neon"
Expand Down
2 changes: 1 addition & 1 deletion src/MartinGeorgiev/Doctrine/DBAL/Types/JsonTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ protected function transformToPostgresJson(mixed $phpValue): string
return $postgresValue;
}

protected function transformFromPostgresJson(string $postgresValue): null|array|bool|float|int|string
protected function transformFromPostgresJson(string $postgresValue): array|bool|float|int|string|null
{
return PostgresJsonToPHPArrayTransformer::transformPostgresJsonEncodedValueToPHPValue($postgresValue);
}
Expand Down
2 changes: 1 addition & 1 deletion src/MartinGeorgiev/Doctrine/DBAL/Types/Jsonb.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function convertToDatabaseValue($value, AbstractPlatform $platform): ?str
*
* @param string|null $value the value to convert
*/
public function convertToPHPValue($value, AbstractPlatform $platform): null|array|bool|float|int|string
public function convertToPHPValue($value, AbstractPlatform $platform): array|bool|float|int|string|null
{
if ($value === null) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static function transformPostgresJsonEncodedValueToPHPArray(string $postg
/**
* @throws InvalidJsonItemForPHPException When the PostgreSQL value is not JSON-decodable
*/
public static function transformPostgresJsonEncodedValueToPHPValue(string $postgresValue): null|array|bool|float|int|string
public static function transformPostgresJsonEncodedValueToPHPValue(string $postgresValue): array|bool|float|int|string|null
{
try {
// @phpstan-ignore-next-line
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/JsonbTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ public function has_name(): void

#[DataProvider('provideValidTransformations')]
#[Test]
public function can_transform_from_php_value(null|array|bool|float|int|string $phpValue, ?string $postgresValue): void
public function can_transform_from_php_value(array|bool|float|int|string|null $phpValue, ?string $postgresValue): void
{
$this->assertEquals($postgresValue, $this->fixture->convertToDatabaseValue($phpValue, $this->platform));
}

#[DataProvider('provideValidTransformations')]
#[Test]
public function can_transform_to_php_value(null|array|bool|float|int|string $phpValue, ?string $postgresValue): void
public function can_transform_to_php_value(array|bool|float|int|string|null $phpValue, ?string $postgresValue): void
{
$this->assertEquals($phpValue, $this->fixture->convertToPHPValue($postgresValue, $this->platform));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class PostgresJsonToPHPArrayTransformerTest extends TestCase
{
#[DataProvider('provideValidJsonTransformations')]
#[Test]
public function can_transform_json_to_php_value(null|array|bool|int|string $phpValue, string $postgresValue): void
public function can_transform_json_to_php_value(array|bool|int|string|null $phpValue, string $postgresValue): void
{
$this->assertEquals($phpValue, PostgresJsonToPHPArrayTransformer::transformPostgresJsonEncodedValueToPHPValue($postgresValue));
}
Expand Down
Loading