Skip to content

Commit 97d0cf2

Browse files
committed
update code style
1 parent d2de1c2 commit 97d0cf2

28 files changed

+126
-104
lines changed

.php-cs-fixer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
$config
88
->setRiskyAllowed(true)
99
->setRules([
10+
'@Symfony' => true,
1011
'align_multiline_comment' => true,
1112
'array_syntax' => ['syntax' => 'short'],
1213
'binary_operator_spaces' => [

src/DBAL/Contract/EnumInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ interface EnumInterface
1010
* @return string[]
1111
*/
1212
public static function cases(): array;
13-
}
13+
}

src/DBAL/DriverWrapper/PostgreSQLDriverWrapper.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ public function __construct(Driver $innerDriver)
2828
}
2929
}
3030

31-
3231
public function connect(array $params): DriverConnection
3332
{
3433
return $this->innerDriver->connect($params);
@@ -55,4 +54,4 @@ public function getExceptionConverter(): ExceptionConverter
5554
{
5655
return $this->innerDriver->getExceptionConverter();
5756
}
58-
}
57+
}

src/DBAL/Middleware/PostgreSQLDriverMiddleware.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ public function wrap(Driver $driver): Driver
1818
: $driver
1919
;
2020
}
21-
}
21+
}

src/DBAL/Platform/PostgreSQLPlatform.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,14 @@ public function getListEnumTypesSQL(): string
4545
JSON_AGG(DISTINCT JSONB_BUILD_OBJECT(\'table\', types.usage_table, \'column\', types.usage_column, \'default\', types.usage_default)) FILTER (WHERE types.usage_table IS NOT NULL AND types.usage_column IS NOT NULL) AS usages
4646
FROM types
4747
GROUP BY types.name, types.comment'
48-
;
48+
;
4949
}
5050

5151
/**
5252
* @param EnumTypeAsset $type
53+
*
5354
* @throws Exception\InvalidArgumentException
55+
*
5456
* @return string
5557
*/
5658
public function getCreateTypeSql(EnumTypeAsset $type): string
@@ -66,7 +68,9 @@ public function getCommentOnTypeSql(EnumTypeAsset $type): string
6668
/**
6769
* @param EnumTypeAsset $from
6870
* @param EnumTypeAsset $to
71+
*
6972
* @throws Exception
73+
*
7074
* @return string[]
7175
*/
7276
public function getAlterTypeSql(EnumTypeAsset $from, EnumTypeAsset $to): array
@@ -86,7 +90,7 @@ public function getAlterTypeSql(EnumTypeAsset $from, EnumTypeAsset $to): array
8690
if (count($removedLabels) < 1) {
8791
return $result;
8892
}
89-
93+
9094
$self = $this;
9195

9296
$result[] = "ALTER TYPE {$typeName} RENAME TO {$typeName}_old";
@@ -151,7 +155,6 @@ public function columnsEqual(Column $column1, Column $column2): bool
151155
}
152156

153157
return is_subclass_of($type1, $type2::class) || is_subclass_of($type2, $type1::class);
154-
155158
}
156159

157160
protected function initializeDoctrineTypeMappings(): void
@@ -160,5 +163,4 @@ protected function initializeDoctrineTypeMappings(): void
160163

161164
$this->doctrineTypeMapping[EnumType::NAME] = EnumType::NAME;
162165
}
163-
164166
}

src/DBAL/Schema/Column.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ public function toArray(): array
4141
'enumType' => $this->_enumClass,
4242
], $this->_platformOptions, $this->_customSchemaOptions);
4343
}
44-
}
44+
}

src/DBAL/Schema/Comparator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,4 @@ public function compareSchemas(BaseSchema $fromSchema, BaseSchema $toSchema): Ba
6262

6363
return $diff;
6464
}
65-
}
65+
}

src/DBAL/Schema/EnumTypeAsset.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,11 @@ final class EnumTypeAsset extends AbstractAsset
2424
private array $usages;
2525

2626
/**
27-
* @param string $name
28-
* @param string $className
29-
* @param string[] $labels
27+
* @param string $name
28+
* @param string $className
29+
* @param string[] $labels
3030
* @param EnumTypeUsageAsset[] $usages
31+
*
3132
* @throws InvalidArgumentException
3233
*/
3334
public function __construct(string $name, string $className, array $labels = [], array $usages = [])
@@ -44,7 +45,9 @@ public function __construct(string $name, string $className, array $labels = [],
4445

4546
/**
4647
* @param class-string<EnumInterface|\UnitEnum> $className
48+
*
4749
* @throws InvalidArgumentException
50+
*
4851
* @return static
4952
*/
5053
public static function fromEnumClassName(string $name, string $className): self
@@ -86,7 +89,9 @@ public function getUsages(): array
8689

8790
/**
8891
* @param AbstractPlatform $platform
92+
*
8993
* @throws InvalidArgumentException
94+
*
9095
* @return array<int|string>
9196
*/
9297
public function getQuotedLabels(AbstractPlatform $platform): array

src/DBAL/Schema/EnumTypeUsageAsset.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
declare(strict_types=1);
34

45
namespace Pfilsx\PostgreSQLDoctrine\DBAL\Schema;

src/DBAL/Schema/PostgreSQLSchemaManager.php

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ class PostgreSQLSchemaManager extends \Doctrine\DBAL\Schema\PostgreSQLSchemaMana
1919
*/
2020
protected $_platform;
2121

22-
2322
public function createSchema(): Schema
2423
{
2524
$schemaNames = [];
@@ -161,7 +160,7 @@ protected function _getPortableTableColumnDefinition($tableColumn): Column
161160

162161
$fixed = null;
163162

164-
if (! isset($tableColumn['name'])) {
163+
if (!isset($tableColumn['name'])) {
165164
$tableColumn['name'] = '';
166165
}
167166

@@ -177,7 +176,7 @@ protected function _getPortableTableColumnDefinition($tableColumn): Column
177176
if (
178177
$tableColumn['domain_type'] !== null
179178
&& $tableColumn['domain_type'] !== ''
180-
&& ! $this->_platform->hasDoctrineTypeMappingFor($tableColumn['type'])
179+
&& !$this->_platform->hasDoctrineTypeMappingFor($tableColumn['type'])
181180
) {
182181
$dbType = strtolower($tableColumn['domain_type']);
183182
$tableColumn['complete_type'] = $tableColumn['domain_complete_type'];
@@ -262,7 +261,7 @@ protected function _getPortableTableColumnDefinition($tableColumn): Column
262261

263262
break;
264263

265-
// PostgreSQL 9.4+ only
264+
// PostgreSQL 9.4+ only
266265
case 'jsonb':
267266
$jsonb = true;
268267

@@ -272,7 +271,7 @@ protected function _getPortableTableColumnDefinition($tableColumn): Column
272271
if (
273272
$tableColumn['default'] !== null && preg_match(
274273
"('([^']+)'::)",
275-
(string)$tableColumn['default'],
274+
(string) $tableColumn['default'],
276275
$match,
277276
) === 1
278277
) {
@@ -303,12 +302,12 @@ protected function _getPortableTableColumnDefinition($tableColumn): Column
303302
}
304303
}
305304

306-
if (isset($tableColumn['collation']) && ! empty($tableColumn['collation'])) {
305+
if (isset($tableColumn['collation']) && !empty($tableColumn['collation'])) {
307306
$column->setPlatformOption('collation', $tableColumn['collation']);
308307
}
309308

310309
if ($column->getType()->getName() === Types::JSON) {
311-
if (! $column->getType() instanceof JsonType) {
310+
if (!$column->getType() instanceof JsonType) {
312311
Deprecation::trigger(
313312
'doctrine/dbal',
314313
'https://github.com/doctrine/dbal/pull/5049',
@@ -339,11 +338,11 @@ private function getPortableEnumTypesList(array $rawTypes): array
339338
foreach ($usages as &$usage) {
340339
$default = $usage['default'] ?? null;
341340
if ($default !== null) {
342-
$default = trim(explode('::', $default)[0], '\'');
341+
$default = trim(explode('::', $default)[0], '\'');
343342
}
344343
$usage['default'] = $default;
345344
}
346-
345+
347346
$list[] = new EnumTypeAsset(
348347
$rawType['name'],
349348
$rawType['comment'],
@@ -392,7 +391,7 @@ private function fixVersion94NegativeNumericDefaultValue(mixed $defaultValue): m
392391
}
393392

394393
/**
395-
* Parses a default value expression as given by PostgreSQL
394+
* Parses a default value expression as given by PostgreSQL.
396395
*/
397396
private function parseDefaultExpression(?string $default): ?string
398397
{
@@ -402,4 +401,4 @@ private function parseDefaultExpression(?string $default): ?string
402401

403402
return str_replace("''", "'", $default);
404403
}
405-
}
404+
}

0 commit comments

Comments
 (0)