Skip to content

Commit 1de5aaf

Browse files
chore: update PHP-CS-Fixer config (#436)
1 parent 2922b63 commit 1de5aaf

File tree

7 files changed

+16
-10
lines changed

7 files changed

+16
-10
lines changed

ci/php-cs-fixer/config.php

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

55
use PhpCsFixer\Config;
66
use PhpCsFixer\Finder;
7+
use PhpCsFixer\Runner\Parallel\ParallelConfigFactory;
78

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

@@ -13,9 +14,7 @@
1314
->in($basePath.'src')
1415
->in($basePath.'tests');
1516

16-
$config = new Config();
17-
18-
return $config
17+
$config = (new Config())
1918
->setRules(
2019
[
2120
'@PSR2' => true,
@@ -54,6 +53,13 @@
5453
)
5554
->setRiskyAllowed(true)
5655
->setUsingCache(false)
56+
5757
->setIndent(' ')
5858
->setLineEnding("\n")
5959
->setFinder($finder);
60+
61+
if (\method_exists($config, 'setParallelConfig')) {
62+
$config->setParallelConfig(ParallelConfigFactory::detect());
63+
}
64+
65+
return $config;

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
"deptrac analyze --config-file=./ci/deptrac/config.yml --cache-file=./ci/deptrac/.cache --no-interaction --no-progress"
6767
],
6868
"php-cs-fixer": [
69-
"PHP_CS_FIXER_IGNORE_ENV=1 php-cs-fixer fix --config=./ci/php-cs-fixer/config.php --show-progress=none --no-interaction --diff -v"
69+
"php-cs-fixer fix --config=./ci/php-cs-fixer/config.php --allow-unsupported-php-version=yes --show-progress=none --no-interaction --diff -v"
7070
],
7171
"phpstan": [
7272
"phpstan analyse --configuration=./ci/phpstan/config.neon"

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ protected function transformToPostgresJson(mixed $phpValue): string
3232
return $postgresValue;
3333
}
3434

35-
protected function transformFromPostgresJson(string $postgresValue): null|array|bool|float|int|string
35+
protected function transformFromPostgresJson(string $postgresValue): array|bool|float|int|string|null
3636
{
3737
return PostgresJsonToPHPArrayTransformer::transformPostgresJsonEncodedValueToPHPValue($postgresValue);
3838
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function convertToDatabaseValue($value, AbstractPlatform $platform): ?str
4242
*
4343
* @param string|null $value the value to convert
4444
*/
45-
public function convertToPHPValue($value, AbstractPlatform $platform): null|array|bool|float|int|string
45+
public function convertToPHPValue($value, AbstractPlatform $platform): array|bool|float|int|string|null
4646
{
4747
if ($value === null) {
4848
return null;

src/MartinGeorgiev/Utils/PostgresJsonToPHPArrayTransformer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public static function transformPostgresJsonEncodedValueToPHPArray(string $postg
5353
/**
5454
* @throws InvalidJsonItemForPHPException When the PostgreSQL value is not JSON-decodable
5555
*/
56-
public static function transformPostgresJsonEncodedValueToPHPValue(string $postgresValue): null|array|bool|float|int|string
56+
public static function transformPostgresJsonEncodedValueToPHPValue(string $postgresValue): array|bool|float|int|string|null
5757
{
5858
try {
5959
// @phpstan-ignore-next-line

tests/Unit/MartinGeorgiev/Doctrine/DBAL/Types/JsonbTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ public function has_name(): void
3737

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

4545
#[DataProvider('provideValidTransformations')]
4646
#[Test]
47-
public function can_transform_to_php_value(null|array|bool|float|int|string $phpValue, ?string $postgresValue): void
47+
public function can_transform_to_php_value(array|bool|float|int|string|null $phpValue, ?string $postgresValue): void
4848
{
4949
$this->assertEquals($phpValue, $this->fixture->convertToPHPValue($postgresValue, $this->platform));
5050
}

tests/Unit/MartinGeorgiev/Utils/PostgresJsonToPHPArrayTransformerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class PostgresJsonToPHPArrayTransformerTest extends TestCase
1515
{
1616
#[DataProvider('provideValidJsonTransformations')]
1717
#[Test]
18-
public function can_transform_json_to_php_value(null|array|bool|int|string $phpValue, string $postgresValue): void
18+
public function can_transform_json_to_php_value(array|bool|int|string|null $phpValue, string $postgresValue): void
1919
{
2020
$this->assertEquals($phpValue, PostgresJsonToPHPArrayTransformer::transformPostgresJsonEncodedValueToPHPValue($postgresValue));
2121
}

0 commit comments

Comments
 (0)