From 4bb2c0b2bf735639b1e32796e506f8be9fcac7f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Mon, 29 Aug 2022 22:16:57 +0200 Subject: [PATCH] Upgrade to doctrine/coding-standard 10 One rule is excluded temporarily, pending a discussion on the standard repository. --- phpcs.xml.dist | 2 + src/ArrayParameters/Exception.php | 4 +- .../Exception/MissingNamedParameter.php | 6 +- .../Exception/MissingPositionalParameter.php | 2 +- src/Cache/ArrayResult.php | 12 +- src/Cache/CacheException.php | 4 +- src/Cache/Exception/NoCacheKey.php | 4 +- .../Exception/NoResultDriverConfigured.php | 4 +- src/Cache/QueryCacheProfile.php | 6 +- src/Configuration.php | 4 +- src/Connection.php | 36 ++-- src/ConnectionException.php | 4 +- .../PrimaryReadReplicaConnection.php | 4 +- src/Driver/API/MySQL/ExceptionConverter.php | 4 +- src/Driver/API/OCI/ExceptionConverter.php | 8 +- .../API/PostgreSQL/ExceptionConverter.php | 8 +- src/Driver/API/SQLite/ExceptionConverter.php | 8 +- src/Driver/AbstractException.php | 2 +- src/Driver/AbstractMySQLDriver.php | 4 +- .../EasyConnectString.php | 4 +- src/Driver/FetchUtils.php | 8 +- src/Driver/IBMDB2/Connection.php | 4 +- .../Exception/CannotCopyStreamToStream.php | 4 +- .../Exception/CannotCreateTemporaryFile.php | 4 +- .../IBMDB2/Exception/ConnectionError.php | 4 +- src/Driver/IBMDB2/Exception/PrepareFailed.php | 4 +- .../IBMDB2/Exception/StatementError.php | 4 +- src/Driver/IBMDB2/Statement.php | 4 +- src/Driver/Mysqli/Connection.php | 4 +- src/Driver/Mysqli/Driver.php | 4 +- .../Mysqli/Exception/InvalidCharset.php | 4 +- src/Driver/Mysqli/Exception/InvalidOption.php | 2 +- .../NonStreamResourceUsedAsLargeObject.php | 2 +- src/Driver/Mysqli/Initializer.php | 4 +- src/Driver/Mysqli/Initializer/Options.php | 4 +- src/Driver/Mysqli/Initializer/Secure.php | 2 +- src/Driver/Mysqli/Statement.php | 4 +- src/Driver/OCI8/Connection.php | 8 +- .../ConvertPositionalToNamedPlaceholders.php | 4 +- src/Driver/OCI8/Exception/Error.php | 4 +- .../Exception/NonTerminatedStringLiteral.php | 4 +- .../OCI8/Exception/UnknownParameterIndex.php | 2 +- src/Driver/OCI8/Result.php | 10 +- src/Driver/OCI8/Statement.php | 4 +- src/Driver/PDO/Connection.php | 4 +- src/Driver/PDO/MySQL/Driver.php | 2 +- src/Driver/PDO/OCI/Driver.php | 2 +- src/Driver/PDO/PgSQL/Driver.php | 2 +- src/Driver/PDO/Result.php | 8 +- src/Driver/PDO/SQLSrv/Connection.php | 8 +- src/Driver/PDO/SQLSrv/Driver.php | 2 +- src/Driver/PDO/SQLSrv/Statement.php | 14 +- src/Driver/PDO/SQLite/Driver.php | 4 +- src/Driver/PDO/Statement.php | 6 +- src/Driver/SQLSrv/Connection.php | 4 +- src/Driver/SQLSrv/Statement.php | 2 +- src/DriverManager.php | 2 +- src/Event/Listeners/OracleSessionInit.php | 8 +- src/Event/Listeners/SQLSessionInit.php | 4 +- src/Event/Listeners/SQLiteSessionInit.php | 4 +- .../SchemaAlterTableAddColumnEventArgs.php | 10 +- .../SchemaAlterTableChangeColumnEventArgs.php | 10 +- src/Event/SchemaAlterTableEventArgs.php | 8 +- .../SchemaAlterTableRemoveColumnEventArgs.php | 10 +- .../SchemaAlterTableRenameColumnEventArgs.php | 10 +- src/Event/SchemaColumnDefinitionEventArgs.php | 10 +- .../SchemaCreateTableColumnEventArgs.php | 10 +- src/Event/SchemaCreateTableEventArgs.php | 18 +- src/Event/SchemaDropTableEventArgs.php | 4 +- src/Event/SchemaEventArgs.php | 4 +- src/Event/SchemaIndexDefinitionEventArgs.php | 10 +- src/Exception.php | 4 +- src/Exception/ColumnLengthRequired.php | 8 +- src/Exception/CommitFailedRollbackOnly.php | 4 +- src/Exception/ConnectionLost.php | 4 +- src/Exception/DatabaseDoesNotExist.php | 4 +- src/Exception/DatabaseRequired.php | 8 +- src/Exception/DriverRequired.php | 14 +- src/Exception/InvalidDriverClass.php | 8 +- src/Exception/InvalidPlatformType.php | 12 +- src/Exception/InvalidWrapperClass.php | 8 +- src/Exception/NoActiveTransaction.php | 4 +- src/Exception/NoKeyValue.php | 4 +- src/Exception/SavepointsNotSupported.php | 4 +- src/Exception/SchemaDoesNotExist.php | 4 +- src/Exception/UnknownDriver.php | 12 +- src/ExpandArrayParameters.php | 16 +- src/FetchMode.php | 2 + src/Logging/Connection.php | 6 +- src/Logging/Driver.php | 6 +- src/Logging/Statement.php | 6 +- src/Platforms/AbstractMySQLPlatform.php | 34 +--- src/Platforms/AbstractPlatform.php | 74 +++---- src/Platforms/DB2Platform.php | 24 +-- .../Exception/InvalidPlatformVersion.php | 6 +- .../Exception/NoColumnsSpecifiedForTable.php | 4 +- src/Platforms/Exception/NotSupported.php | 4 +- src/Platforms/MariaDBPlatform.php | 8 +- .../MySQL/CharsetMetadataProvider.php | 4 +- .../CachingCharsetMetadataProvider.php | 4 +- .../ConnectionCharsetMetadataProvider.php | 10 +- .../MySQL/CollationMetadataProvider.php | 4 +- .../CachingCollationMetadataProvider.php | 4 +- .../ConnectionCollationMetadataProvider.php | 10 +- src/Platforms/MySQL/Comparator.php | 8 +- src/Platforms/MySQL/DefaultTableOptions.php | 4 +- src/Platforms/OraclePlatform.php | 44 ++-- src/Platforms/PostgreSQLPlatform.php | 58 ++---- src/Platforms/SQLServer/Comparator.php | 4 +- src/Platforms/SQLServerPlatform.php | 44 ++-- src/Platforms/SQLite/Comparator.php | 4 +- src/Platforms/SQLitePlatform.php | 72 +++---- src/Portability/Connection.php | 4 +- src/Portability/Driver.php | 4 +- src/Portability/Result.php | 16 +- src/Portability/Statement.php | 2 +- src/Query.php | 10 +- src/Query/Exception/NonUniqueAlias.php | 12 +- src/Query/Exception/UnknownAlias.php | 12 +- src/Query/Expression/CompositeExpression.php | 6 +- src/Query/Expression/ExpressionBuilder.php | 4 +- src/Query/From.php | 4 +- src/Query/Join.php | 4 +- src/Query/QueryBuilder.php | 24 +-- src/Query/QueryException.php | 4 +- src/Query/QueryType.php | 4 +- src/Result.php | 16 +- .../Builder/CreateSchemaObjectsSQLBuilder.php | 2 +- src/Schema/AbstractSchemaManager.php | 96 ++++----- src/Schema/Column.php | 12 +- src/Schema/ColumnDiff.php | 12 +- src/Schema/Comparator.php | 12 +- src/Schema/DB2SchemaManager.php | 2 +- src/Schema/Exception/ColumnAlreadyExists.php | 6 +- src/Schema/Exception/ColumnDoesNotExist.php | 6 +- .../Exception/ForeignKeyDoesNotExist.php | 6 +- src/Schema/Exception/IndexAlreadyExists.php | 6 +- src/Schema/Exception/IndexDoesNotExist.php | 6 +- src/Schema/Exception/IndexNameInvalid.php | 6 +- src/Schema/Exception/InvalidTableName.php | 4 +- .../Exception/NamedForeignKeyRequired.php | 8 +- .../Exception/NamespaceAlreadyExists.php | 6 +- .../Exception/SequenceAlreadyExists.php | 6 +- src/Schema/Exception/SequenceDoesNotExist.php | 6 +- src/Schema/Exception/TableAlreadyExists.php | 6 +- src/Schema/Exception/TableDoesNotExist.php | 6 +- .../UniqueConstraintDoesNotExist.php | 6 +- src/Schema/Exception/UnknownColumnOption.php | 6 +- src/Schema/ForeignKeyConstraint.php | 2 +- src/Schema/Index.php | 10 +- src/Schema/MySQLSchemaManager.php | 26 +-- src/Schema/OracleSchemaManager.php | 8 +- src/Schema/PostgreSQLSchemaManager.php | 18 +- src/Schema/SQLServerSchemaManager.php | 20 +- src/Schema/SQLiteSchemaManager.php | 20 +- src/Schema/Schema.php | 26 +-- src/Schema/SchemaConfig.php | 4 +- src/Schema/SchemaDiff.php | 12 +- src/Schema/SchemaException.php | 4 +- src/Schema/Sequence.php | 2 +- src/Schema/Table.php | 42 ++-- src/Schema/TableDiff.php | 8 +- src/Schema/UniqueConstraint.php | 10 +- src/Statement.php | 10 +- src/Tools/Console/Command/RunSqlCommand.php | 13 +- src/Tools/Console/ConnectionProvider.php | 4 +- .../SingleConnectionProvider.php | 2 +- src/Types/DateImmutableType.php | 4 +- src/Types/DateTimeImmutableType.php | 4 +- src/Types/DateTimeType.php | 2 +- src/Types/DateTimeTzImmutableType.php | 4 +- src/Types/DateTimeTzType.php | 4 +- src/Types/DateType.php | 2 +- src/Types/Exception/InvalidFormat.php | 6 +- src/Types/Exception/InvalidType.php | 4 +- src/Types/Exception/SerializationFailed.php | 8 +- src/Types/Exception/TypeNotFound.php | 4 +- src/Types/Exception/TypeNotRegistered.php | 6 +- src/Types/Exception/TypesAlreadyExists.php | 4 +- src/Types/Exception/UnknownColumnType.php | 8 +- src/Types/Exception/ValueNotConvertible.php | 4 +- src/Types/TimeImmutableType.php | 4 +- src/Types/TimeType.php | 2 +- src/Types/Type.php | 6 +- src/Types/TypeRegistry.php | 4 +- src/Types/Types.php | 12 +- src/Types/VarDateTimeImmutableType.php | 2 +- tests/Cache/QueryCacheProfileTest.php | 22 +- tests/Connection/CachedQueryTest.php | 8 +- .../Connection/ExpandArrayParametersTest.php | 14 +- tests/ConnectionTest.php | 59 +++--- tests/Driver/AbstractDB2DriverTest.php | 4 +- tests/Driver/AbstractDriverTest.php | 20 +- tests/Driver/AbstractMySQLDriverTest.php | 6 +- .../EasyConnectStringTest.php | 4 +- tests/Driver/AbstractOracleDriverTest.php | 6 +- tests/Driver/AbstractPostgreSQLDriverTest.php | 6 +- tests/Driver/AbstractSQLServerDriverTest.php | 6 +- tests/Driver/AbstractSQLiteDriverTest.php | 6 +- tests/Driver/IBMDB2/DataSourceNameTest.php | 4 +- .../AbstractConnectionMiddlewareTest.php | 2 +- tests/Driver/Mysqli/ConnectionTest.php | 4 +- ...nvertPositionalToNamedPlaceholdersTest.php | 6 +- tests/Driver/PDO/ExceptionTest.php | 4 +- tests/Driver/PDO/PgSQL/DriverTest.php | 18 +- tests/DriverManagerTest.php | 24 +-- tests/Events/OracleSessionInitTest.php | 8 +- tests/Exception/DriverRequiredTest.php | 4 +- tests/Exception/InvalidPlatformTypeTest.php | 12 +- tests/ExceptionTest.php | 8 +- tests/Functional/BlobTest.php | 6 +- .../Functional/Connection/FetchEmptyTest.php | 2 +- tests/Functional/ConnectionTest.php | 8 +- tests/Functional/DataAccessTest.php | 136 +++++-------- .../Functional/Driver/AbstractDriverTest.php | 6 +- tests/Functional/Driver/IBMDB2/DriverTest.php | 4 +- .../Driver/Mysqli/ConnectionTest.php | 16 +- tests/Functional/Driver/Mysqli/DriverTest.php | 4 +- tests/Functional/Driver/OCI8/DriverTest.php | 4 +- tests/Functional/Driver/OCI8/ResultTest.php | 16 +- .../Functional/Driver/OCI8/StatementTest.php | 12 +- .../Driver/PDO/MySQL/DriverTest.php | 4 +- .../Functional/Driver/PDO/OCI/DriverTest.php | 4 +- .../Driver/PDO/PgSQL/ConnectionTest.php | 16 +- .../Driver/PDO/PgSQL/DriverTest.php | 18 +- .../Driver/PDO/SQLSrv/DriverTest.php | 14 +- .../Driver/PDO/SQLite/DriverTest.php | 4 +- tests/Functional/Driver/SQLSrv/DriverTest.php | 4 +- tests/Functional/ExceptionTest.php | 12 +- tests/Functional/FetchBooleanTest.php | 10 +- tests/Functional/LegacyAPITest.php | 2 +- .../Functional/LikeWildcardsEscapingTest.php | 6 +- tests/Functional/ModifyLimitQueryTest.php | 8 +- tests/Functional/NamedParametersTest.php | 4 +- .../Platform/AlterDecimalColumnTest.php | 8 +- tests/Functional/Platform/ColumnTest.php | 26 +-- .../Platform/ConcatExpressionTest.php | 4 +- .../Platform/DateExpressionTest.php | 10 +- .../Platform/DefaultExpressionTest.php | 4 +- .../Platform/LengthExpressionTest.php | 4 +- tests/Functional/Platform/QuotingTest.php | 24 +-- .../Functional/Platform/RenameColumnTest.php | 8 +- tests/Functional/PortabilityTest.php | 22 +- .../PrimaryReadReplicaConnectionTest.php | 4 +- tests/Functional/ResultTest.php | 10 +- ...eateAndDropSchemaObjectsSQLBuilderTest.php | 2 +- tests/Functional/Schema/ColumnCommentTest.php | 14 +- tests/Functional/Schema/ComparatorTest.php | 10 +- .../Functional/Schema/ComparatorTestUtils.php | 16 +- tests/Functional/Schema/DefaultValueTest.php | 12 +- .../Schema/MySQL/ComparatorTest.php | 36 ++-- .../Schema/MySQLSchemaManagerTest.php | 26 +-- .../Schema/Oracle/ComparatorTest.php | 4 +- .../Schema/OracleSchemaManagerTest.php | 14 +- .../Schema/PostgreSQL/SchemaTest.php | 2 +- .../Schema/PostgreSQLSchemaManagerTest.php | 30 +-- .../Schema/SQLServerSchemaManagerTest.php | 18 +- .../SchemaManagerFunctionalTestCase.php | 76 +++---- .../Schema/SqliteSchemaManagerTest.php | 15 +- tests/Functional/StatementTest.php | 20 +- tests/Functional/TemporaryTableTest.php | 4 +- tests/Functional/Ticket/DBAL752Test.php | 5 +- tests/Functional/TypeConversionTest.php | 46 ++--- tests/Functional/Types/AsciiStringTest.php | 2 +- tests/Functional/Types/BinaryTest.php | 2 +- tests/Functional/Types/DecimalTest.php | 12 +- tests/Functional/WriteTest.php | 32 ++- tests/FunctionalTestCase.php | 8 +- tests/Logging/MiddlewareTest.php | 3 +- .../AbstractMySQLPlatformTestCase.php | 88 ++++---- tests/Platforms/AbstractPlatformTestCase.php | 190 +++++++----------- tests/Platforms/DB2PlatformTest.php | 62 +++--- .../CachingCollationMetadataProviderTest.php | 8 +- tests/Platforms/MySQL/ComparatorTest.php | 2 +- tests/Platforms/MySQLPlatformTest.php | 20 +- tests/Platforms/OraclePlatformTest.php | 56 ++---- tests/Platforms/PostgreSQLPlatformTest.php | 116 +++++------ tests/Platforms/SQLServerPlatformTestCase.php | 168 ++++++++-------- tests/Platforms/SQLitePlatformTest.php | 76 ++++--- tests/Portability/ConverterTest.php | 52 ++--- tests/Portability/ResultTest.php | 10 +- .../Expression/CompositeExpressionTest.php | 16 +- .../Expression/ExpressionBuilderTest.php | 30 +-- tests/Query/QueryBuilderTest.php | 94 +++++---- tests/SQL/ParserTest.php | 44 +--- tests/Schema/ColumnTest.php | 8 +- tests/Schema/ComparatorTest.php | 114 +++++------ tests/Schema/ForeignKeyConstraintTest.php | 14 +- tests/Schema/IndexTest.php | 8 +- tests/Schema/MySQLInheritCharsetTest.php | 8 +- tests/Schema/Platforms/MySQLSchemaTest.php | 8 +- tests/Schema/SQLiteSchemaManagerTest.php | 16 +- tests/Schema/TableTest.php | 14 +- tests/TestUtil.php | 26 +-- tests/Tools/Console/RunSqlCommandTest.php | 6 +- tests/Types/BaseDateTypeTestCase.php | 8 +- tests/Types/BinaryTest.php | 12 +- tests/Types/ConversionExceptionTest.php | 22 +- tests/Types/DateImmutableTypeTest.php | 2 +- tests/Types/DateIntervalTest.php | 8 +- tests/Types/DateTest.php | 2 +- tests/Types/DateTimeImmutableTypeTest.php | 2 +- tests/Types/DateTimeTzImmutableTypeTest.php | 2 +- .../Exception/SerializationFailedTest.php | 2 +- .../Types/Exception/TypeNotRegisteredTest.php | 2 +- tests/Types/JsonTest.php | 6 +- tests/Types/TimeImmutableTypeTest.php | 2 +- tests/Types/TypeRegistryTest.php | 8 +- tests/Types/TypeTest.php | 8 +- tests/Types/VarDateTimeImmutableTypeTest.php | 2 +- 310 files changed, 1513 insertions(+), 2602 deletions(-) diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 4acb7c33cfa..e5fcbb250e7 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -22,6 +22,8 @@ + + diff --git a/src/ArrayParameters/Exception.php b/src/ArrayParameters/Exception.php index ceac940e65e..e5a580b7691 100644 --- a/src/ArrayParameters/Exception.php +++ b/src/ArrayParameters/Exception.php @@ -6,9 +6,7 @@ use Throwable; -/** - * @internal - */ +/** @internal */ interface Exception extends Throwable { } diff --git a/src/ArrayParameters/Exception/MissingNamedParameter.php b/src/ArrayParameters/Exception/MissingNamedParameter.php index a70f91f9a50..7ed18dc9833 100644 --- a/src/ArrayParameters/Exception/MissingNamedParameter.php +++ b/src/ArrayParameters/Exception/MissingNamedParameter.php @@ -9,15 +9,13 @@ use function sprintf; -/** - * @psalm-immutable - */ +/** @psalm-immutable */ class MissingNamedParameter extends LogicException implements Exception { public static function new(string $name): self { return new self( - sprintf('Named parameter "%s" does not have a bound value.', $name) + sprintf('Named parameter "%s" does not have a bound value.', $name), ); } } diff --git a/src/ArrayParameters/Exception/MissingPositionalParameter.php b/src/ArrayParameters/Exception/MissingPositionalParameter.php index 482015a5f47..91bdbe718fb 100644 --- a/src/ArrayParameters/Exception/MissingPositionalParameter.php +++ b/src/ArrayParameters/Exception/MissingPositionalParameter.php @@ -19,7 +19,7 @@ class MissingPositionalParameter extends LogicException implements Exception public static function new(int $index): self { return new self( - sprintf('Positional parameter at index %d does not have a bound value.', $index) + sprintf('Positional parameter at index %d does not have a bound value.', $index), ); } } diff --git a/src/Cache/ArrayResult.php b/src/Cache/ArrayResult.php index e530daf38cd..55a63f943d8 100644 --- a/src/Cache/ArrayResult.php +++ b/src/Cache/ArrayResult.php @@ -11,17 +11,13 @@ use function count; use function reset; -/** - * @internal The class is internal to the caching layer implementation. - */ +/** @internal The class is internal to the caching layer implementation. */ final class ArrayResult implements Result { private readonly int $columnCount; private int $num = 0; - /** - * @param list> $data - */ + /** @param list> $data */ public function __construct(private array $data) { $this->columnCount = $data === [] ? 0 : count($data[0]); @@ -93,9 +89,7 @@ public function free(): void $this->data = []; } - /** - * @return array|false - */ + /** @return array|false */ private function fetch(): array|false { if (! isset($this->data[$this->num])) { diff --git a/src/Cache/CacheException.php b/src/Cache/CacheException.php index 98c9f03ab51..78793625483 100644 --- a/src/Cache/CacheException.php +++ b/src/Cache/CacheException.php @@ -6,9 +6,7 @@ use Doctrine\DBAL\Exception; -/** - * @psalm-immutable - */ +/** @psalm-immutable */ class CacheException extends Exception { } diff --git a/src/Cache/Exception/NoCacheKey.php b/src/Cache/Exception/NoCacheKey.php index b2a5d893a1d..9fc58b7e063 100644 --- a/src/Cache/Exception/NoCacheKey.php +++ b/src/Cache/Exception/NoCacheKey.php @@ -6,9 +6,7 @@ use Doctrine\DBAL\Cache\CacheException; -/** - * @psalm-immutable - */ +/** @psalm-immutable */ final class NoCacheKey extends CacheException { public static function new(): self diff --git a/src/Cache/Exception/NoResultDriverConfigured.php b/src/Cache/Exception/NoResultDriverConfigured.php index c0d76323be8..14e41f78543 100644 --- a/src/Cache/Exception/NoResultDriverConfigured.php +++ b/src/Cache/Exception/NoResultDriverConfigured.php @@ -6,9 +6,7 @@ use Doctrine\DBAL\Cache\CacheException; -/** - * @psalm-immutable - */ +/** @psalm-immutable */ final class NoResultDriverConfigured extends CacheException { public static function new(): self diff --git a/src/Cache/QueryCacheProfile.php b/src/Cache/QueryCacheProfile.php index 619d5e44aa5..0f2f22f8533 100644 --- a/src/Cache/QueryCacheProfile.php +++ b/src/Cache/QueryCacheProfile.php @@ -23,7 +23,7 @@ class QueryCacheProfile public function __construct( private readonly int $lifetime = 0, private readonly ?string $cacheKey = null, - private readonly ?CacheItemPoolInterface $resultCache = null + private readonly ?CacheItemPoolInterface $resultCache = null, ) { } @@ -37,9 +37,7 @@ public function getLifetime(): int return $this->lifetime; } - /** - * @throws CacheException - */ + /** @throws CacheException */ public function getCacheKey(): string { if ($this->cacheKey === null) { diff --git a/src/Configuration.php b/src/Configuration.php index 05239b10adc..9534c18b76f 100644 --- a/src/Configuration.php +++ b/src/Configuration.php @@ -111,9 +111,7 @@ public function setMiddlewares(array $middlewares): self return $this; } - /** - * @return Middleware[] - */ + /** @return Middleware[] */ public function getMiddlewares(): array { return $this->middlewares; diff --git a/src/Connection.php b/src/Connection.php index f6c029ae546..2e6b133b5e3 100644 --- a/src/Connection.php +++ b/src/Connection.php @@ -130,7 +130,7 @@ public function __construct( array $params, protected Driver $driver, ?Configuration $config = null, - ?EventManager $eventManager = null + ?EventManager $eventManager = null, ) { $this->_config = $config ?? new Configuration(); $this->_eventManager = $eventManager ?? new EventManager(); @@ -436,7 +436,7 @@ private function addCriteriaCondition( array $criteria, array &$columns, array &$values, - array &$conditions + array &$conditions, ): void { foreach ($criteria as $columnName => $value) { if ($value === null) { @@ -477,7 +477,7 @@ public function delete(string $table, array $criteria = [], array $types = []): return $this->executeStatement( $sql, $values, - is_string(key($types)) ? $this->extractTypeValues($columns, $types) : $types + is_string(key($types)) ? $this->extractTypeValues($columns, $types) : $types, ); } @@ -586,7 +586,7 @@ public function insert(string $table, array $data, array $types = []): int|strin 'INSERT INTO ' . $table . ' (' . implode(', ', $columns) . ')' . ' VALUES (' . implode(', ', $set) . ')', $values, - is_string(key($types)) ? $this->extractTypeValues($columns, $types) : $types + is_string(key($types)) ? $this->extractTypeValues($columns, $types) : $types, ); } @@ -829,7 +829,7 @@ public function executeQuery( string $sql, array $params = [], array $types = [], - ?QueryCacheProfile $qcp = null + ?QueryCacheProfile $qcp = null, ): Result { if ($qcp !== null) { return $this->executeCacheQuery($sql, $params, $types, $qcp); @@ -1015,7 +1015,7 @@ public function setNestTransactionsWithSavepoints(bool $nestTransactionsWithSave if (! $nestTransactionsWithSavepoints) { throw new InvalidArgumentException(sprintf( 'Calling %s with false to enable nesting transactions without savepoints is no longer supported.', - __METHOD__ + __METHOD__, )); } @@ -1023,7 +1023,7 @@ public function setNestTransactionsWithSavepoints(bool $nestTransactionsWithSave 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5383', '%s is deprecated and will be removed in 5.0', - __METHOD__ + __METHOD__, ); } @@ -1038,7 +1038,7 @@ public function getNestTransactionsWithSavepoints(): bool 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5383', '%s is deprecated and will be removed in 5.0', - __METHOD__ + __METHOD__, ); return true; @@ -1052,9 +1052,7 @@ protected function _getNestedTransactionSavePointName(): string return 'DOCTRINE2_SAVEPOINT_' . $this->transactionNestingLevel; } - /** - * @throws Exception - */ + /** @throws Exception */ public function beginTransaction(): void { $connection = $this->connect(); @@ -1070,9 +1068,7 @@ public function beginTransaction(): void $this->getEventManager()->dispatchEvent(Events::onTransactionBegin, new TransactionBeginEventArgs($this)); } - /** - * @throws Exception - */ + /** @throws Exception */ public function commit(): void { if ($this->transactionNestingLevel === 0) { @@ -1126,9 +1122,7 @@ private function commitAll(): void } } - /** - * @throws Exception - */ + /** @throws Exception */ public function rollBack(): void { if ($this->transactionNestingLevel === 0) { @@ -1388,14 +1382,12 @@ final public function convertExceptionDuringQuery( Driver\Exception $e, string $sql, array $params = [], - array $types = [] + array $types = [], ): DriverException { return $this->handleDriverException($e, new Query($sql, $params, $types)); } - /** - * @internal - */ + /** @internal */ final public function convertException(Driver\Exception $e): DriverException { return $this->handleDriverException($e, null); @@ -1447,7 +1439,7 @@ private function expandArrayParameters(string $sql, array $params, array $types) private function handleDriverException( Driver\Exception $driverException, - ?Query $query + ?Query $query, ): DriverException { $this->exceptionConverter ??= $this->driver->getExceptionConverter(); $exception = $this->exceptionConverter->convert($driverException, $query); diff --git a/src/ConnectionException.php b/src/ConnectionException.php index 459afaf7177..4c60c20a1f4 100644 --- a/src/ConnectionException.php +++ b/src/ConnectionException.php @@ -4,9 +4,7 @@ namespace Doctrine\DBAL; -/** - * @psalm-immutable - */ +/** @psalm-immutable */ class ConnectionException extends Exception { } diff --git a/src/Connections/PrimaryReadReplicaConnection.php b/src/Connections/PrimaryReadReplicaConnection.php index 758c62fca62..7152d8355d9 100644 --- a/src/Connections/PrimaryReadReplicaConnection.php +++ b/src/Connections/PrimaryReadReplicaConnection.php @@ -106,7 +106,7 @@ public function __construct( array $params, Driver $driver, ?Configuration $config = null, - ?EventManager $eventManager = null + ?EventManager $eventManager = null, ) { if (! isset($params['replica'], $params['primary'])) { throw new InvalidArgumentException('primary or replica configuration missing'); @@ -142,7 +142,7 @@ public function connect(?string $connectionName = null): DriverConnection if ($connectionName !== null) { throw new InvalidArgumentException( 'Passing a connection name as first argument is not supported anymore.' - . ' Use ensureConnectedToPrimary()/ensureConnectedToReplica() instead.' + . ' Use ensureConnectedToPrimary()/ensureConnectedToReplica() instead.', ); } diff --git a/src/Driver/API/MySQL/ExceptionConverter.php b/src/Driver/API/MySQL/ExceptionConverter.php index 799f65a6a22..254489834f2 100644 --- a/src/Driver/API/MySQL/ExceptionConverter.php +++ b/src/Driver/API/MySQL/ExceptionConverter.php @@ -22,9 +22,7 @@ use Doctrine\DBAL\Exception\UniqueConstraintViolationException; use Doctrine\DBAL\Query; -/** - * @internal - */ +/** @internal */ final class ExceptionConverter implements ExceptionConverterInterface { /** diff --git a/src/Driver/API/OCI/ExceptionConverter.php b/src/Driver/API/OCI/ExceptionConverter.php index 2f04d43acb8..1c0dc793fed 100644 --- a/src/Driver/API/OCI/ExceptionConverter.php +++ b/src/Driver/API/OCI/ExceptionConverter.php @@ -20,14 +20,10 @@ use Doctrine\DBAL\Exception\UniqueConstraintViolationException; use Doctrine\DBAL\Query; -/** - * @internal - */ +/** @internal */ final class ExceptionConverter implements ExceptionConverterInterface { - /** - * @link http://www.dba-oracle.com/t_error_code_list.htm - */ + /** @link http://www.dba-oracle.com/t_error_code_list.htm */ public function convert(Exception $exception, ?Query $query): DriverException { return match ($exception->getCode()) { diff --git a/src/Driver/API/PostgreSQL/ExceptionConverter.php b/src/Driver/API/PostgreSQL/ExceptionConverter.php index 085611d64a0..4511ded4b55 100644 --- a/src/Driver/API/PostgreSQL/ExceptionConverter.php +++ b/src/Driver/API/PostgreSQL/ExceptionConverter.php @@ -23,14 +23,10 @@ use function str_contains; -/** - * @internal - */ +/** @internal */ final class ExceptionConverter implements ExceptionConverterInterface { - /** - * @link http://www.postgresql.org/docs/9.4/static/errcodes-appendix.html - */ + /** @link http://www.postgresql.org/docs/9.4/static/errcodes-appendix.html */ public function convert(Exception $exception, ?Query $query): DriverException { switch ($exception->getSQLState()) { diff --git a/src/Driver/API/SQLite/ExceptionConverter.php b/src/Driver/API/SQLite/ExceptionConverter.php index ec5163b4cf8..58851955fbd 100644 --- a/src/Driver/API/SQLite/ExceptionConverter.php +++ b/src/Driver/API/SQLite/ExceptionConverter.php @@ -22,14 +22,10 @@ use function str_contains; -/** - * @internal - */ +/** @internal */ final class ExceptionConverter implements ExceptionConverterInterface { - /** - * @link http://www.sqlite.org/c3ref/c_abort.html - */ + /** @link http://www.sqlite.org/c3ref/c_abort.html */ public function convert(Exception $exception, ?Query $query): DriverException { if (str_contains($exception->getMessage(), 'database is locked')) { diff --git a/src/Driver/AbstractException.php b/src/Driver/AbstractException.php index 42d3f559b2d..367fc497a6b 100644 --- a/src/Driver/AbstractException.php +++ b/src/Driver/AbstractException.php @@ -24,7 +24,7 @@ public function __construct( string $message, private readonly ?string $sqlState = null, int $code = 0, - ?Throwable $previous = null + ?Throwable $previous = null, ) { parent::__construct($message, $code, $previous); } diff --git a/src/Driver/AbstractMySQLDriver.php b/src/Driver/AbstractMySQLDriver.php index d8f24a71426..7339a8bbc04 100644 --- a/src/Driver/AbstractMySQLDriver.php +++ b/src/Driver/AbstractMySQLDriver.php @@ -56,12 +56,12 @@ private function getOracleMysqlVersionNumber(string $versionString): string preg_match( '/^(?P\d+)(?:\.(?P\d+)(?:\.(?P\d+))?)?/', $versionString, - $versionParts + $versionParts, ) === 0 ) { throw InvalidPlatformVersion::new( $versionString, - '..' + '..', ); } diff --git a/src/Driver/AbstractOracleDriver/EasyConnectString.php b/src/Driver/AbstractOracleDriver/EasyConnectString.php index bf46eaf3ad3..a7778176ce5 100644 --- a/src/Driver/AbstractOracleDriver/EasyConnectString.php +++ b/src/Driver/AbstractOracleDriver/EasyConnectString.php @@ -83,9 +83,7 @@ public static function fromConnectionParameters(array $params): self ]); } - /** - * @param mixed[] $params - */ + /** @param mixed[] $params */ private static function renderParams(array $params): string { $chunks = []; diff --git a/src/Driver/FetchUtils.php b/src/Driver/FetchUtils.php index 65bc9e1b551..eda5211f673 100644 --- a/src/Driver/FetchUtils.php +++ b/src/Driver/FetchUtils.php @@ -4,14 +4,10 @@ namespace Doctrine\DBAL\Driver; -/** - * @internal - */ +/** @internal */ final class FetchUtils { - /** - * @throws Exception - */ + /** @throws Exception */ public static function fetchOne(Result $result): mixed { $row = $result->fetchNumeric(); diff --git a/src/Driver/IBMDB2/Connection.php b/src/Driver/IBMDB2/Connection.php index 62d4470dd3f..ae437ce3de9 100644 --- a/src/Driver/IBMDB2/Connection.php +++ b/src/Driver/IBMDB2/Connection.php @@ -117,9 +117,7 @@ public function rollBack(): void } } - /** - * @return resource - */ + /** @return resource */ public function getNativeConnection() { return $this->connection; diff --git a/src/Driver/IBMDB2/Exception/CannotCopyStreamToStream.php b/src/Driver/IBMDB2/Exception/CannotCopyStreamToStream.php index 86821688c41..231c9d47316 100644 --- a/src/Driver/IBMDB2/Exception/CannotCopyStreamToStream.php +++ b/src/Driver/IBMDB2/Exception/CannotCopyStreamToStream.php @@ -13,9 +13,7 @@ */ final class CannotCopyStreamToStream extends AbstractException { - /** - * @psalm-param array{message: string}|null $error - */ + /** @psalm-param array{message: string}|null $error */ public static function new(?array $error): self { $message = 'Could not copy source stream to temporary file'; diff --git a/src/Driver/IBMDB2/Exception/CannotCreateTemporaryFile.php b/src/Driver/IBMDB2/Exception/CannotCreateTemporaryFile.php index 587ae65f42a..63f7ca1e26f 100644 --- a/src/Driver/IBMDB2/Exception/CannotCreateTemporaryFile.php +++ b/src/Driver/IBMDB2/Exception/CannotCreateTemporaryFile.php @@ -13,9 +13,7 @@ */ final class CannotCreateTemporaryFile extends AbstractException { - /** - * @psalm-param array{message: string}|null $error - */ + /** @psalm-param array{message: string}|null $error */ public static function new(?array $error): self { $message = 'Could not create temporary file'; diff --git a/src/Driver/IBMDB2/Exception/ConnectionError.php b/src/Driver/IBMDB2/Exception/ConnectionError.php index a27a99a1858..b7bd8be6932 100644 --- a/src/Driver/IBMDB2/Exception/ConnectionError.php +++ b/src/Driver/IBMDB2/Exception/ConnectionError.php @@ -16,9 +16,7 @@ */ final class ConnectionError extends AbstractException { - /** - * @param resource $connection - */ + /** @param resource $connection */ public static function new($connection): self { $message = db2_conn_errormsg($connection); diff --git a/src/Driver/IBMDB2/Exception/PrepareFailed.php b/src/Driver/IBMDB2/Exception/PrepareFailed.php index 035fd67f9c2..42df5e15c85 100644 --- a/src/Driver/IBMDB2/Exception/PrepareFailed.php +++ b/src/Driver/IBMDB2/Exception/PrepareFailed.php @@ -13,9 +13,7 @@ */ final class PrepareFailed extends AbstractException { - /** - * @psalm-param array{message: string}|null $error - */ + /** @psalm-param array{message: string}|null $error */ public static function new(?array $error): self { if ($error === null) { diff --git a/src/Driver/IBMDB2/Exception/StatementError.php b/src/Driver/IBMDB2/Exception/StatementError.php index 5c30d1cab72..6bf8511317d 100644 --- a/src/Driver/IBMDB2/Exception/StatementError.php +++ b/src/Driver/IBMDB2/Exception/StatementError.php @@ -16,9 +16,7 @@ */ final class StatementError extends AbstractException { - /** - * @param resource|null $statement - */ + /** @param resource|null $statement */ public static function new($statement = null): self { if ($statement !== null) { diff --git a/src/Driver/IBMDB2/Statement.php b/src/Driver/IBMDB2/Statement.php index 670d57cc2f3..4fda8fe90b4 100644 --- a/src/Driver/IBMDB2/Statement.php +++ b/src/Driver/IBMDB2/Statement.php @@ -69,9 +69,7 @@ public function bindValue(int|string $param, mixed $value, ParameterType $type): } } - /** - * @throws Exception - */ + /** @throws Exception */ private function bind(int $position, mixed &$variable, int $parameterType, int $dataType): void { $this->parameters[$position] =& $variable; diff --git a/src/Driver/Mysqli/Connection.php b/src/Driver/Mysqli/Connection.php index ff153d9d663..cc00fb62c1d 100644 --- a/src/Driver/Mysqli/Connection.php +++ b/src/Driver/Mysqli/Connection.php @@ -17,9 +17,7 @@ final class Connection implements ConnectionInterface */ public const OPTION_FLAGS = 'flags'; - /** - * @internal The connection can be only instantiated by its driver. - */ + /** @internal The connection can be only instantiated by its driver. */ public function __construct(private readonly mysqli $connection) { } diff --git a/src/Driver/Mysqli/Driver.php b/src/Driver/Mysqli/Driver.php index 729771d9256..e80b7dfd715 100644 --- a/src/Driver/Mysqli/Driver.php +++ b/src/Driver/Mysqli/Driver.php @@ -64,7 +64,7 @@ public function connect(array $params): Connection $params['dbname'] ?? '', $params['port'] ?? 0, $params['unix_socket'] ?? '', - $flags + $flags, ); } catch (mysqli_sql_exception $e) { throw ConnectionFailed::upcast($e); @@ -116,7 +116,7 @@ private function withSecure(array $initializers, array $params): array $params['ssl_cert'] ?? '', $params['ssl_ca'] ?? '', $params['ssl_capath'] ?? '', - $params['ssl_cipher'] ?? '' + $params['ssl_cipher'] ?? '', ); } diff --git a/src/Driver/Mysqli/Exception/InvalidCharset.php b/src/Driver/Mysqli/Exception/InvalidCharset.php index 98080e83e4a..b6f3bb7bf1f 100644 --- a/src/Driver/Mysqli/Exception/InvalidCharset.php +++ b/src/Driver/Mysqli/Exception/InvalidCharset.php @@ -23,7 +23,7 @@ public static function fromCharset(mysqli $connection, string $charset): self return new self( sprintf('Failed to set charset "%s": %s', $charset, $connection->error), $connection->sqlstate, - $connection->errno + $connection->errno, ); } @@ -35,7 +35,7 @@ public static function upcast(mysqli_sql_exception $exception, string $charset): sprintf('Failed to set charset "%s": %s', $charset, $exception->getMessage()), $p->getValue($exception), (int) $exception->getCode(), - $exception + $exception, ); } } diff --git a/src/Driver/Mysqli/Exception/InvalidOption.php b/src/Driver/Mysqli/Exception/InvalidOption.php index 1e0482c3109..654bb87b2fb 100644 --- a/src/Driver/Mysqli/Exception/InvalidOption.php +++ b/src/Driver/Mysqli/Exception/InvalidOption.php @@ -18,7 +18,7 @@ final class InvalidOption extends AbstractException public static function fromOption(int $option, mixed $value): self { return new self( - sprintf('Failed to set option %d with value "%s"', $option, $value) + sprintf('Failed to set option %d with value "%s"', $option, $value), ); } } diff --git a/src/Driver/Mysqli/Exception/NonStreamResourceUsedAsLargeObject.php b/src/Driver/Mysqli/Exception/NonStreamResourceUsedAsLargeObject.php index c4884c0cd23..566d63638c7 100644 --- a/src/Driver/Mysqli/Exception/NonStreamResourceUsedAsLargeObject.php +++ b/src/Driver/Mysqli/Exception/NonStreamResourceUsedAsLargeObject.php @@ -18,7 +18,7 @@ final class NonStreamResourceUsedAsLargeObject extends AbstractException public static function new(int $parameter): self { return new self( - sprintf('The resource passed as a LARGE_OBJECT parameter #%d must be of type "stream"', $parameter) + sprintf('The resource passed as a LARGE_OBJECT parameter #%d must be of type "stream"', $parameter), ); } } diff --git a/src/Driver/Mysqli/Initializer.php b/src/Driver/Mysqli/Initializer.php index 9966da46bcd..efab67e22d2 100644 --- a/src/Driver/Mysqli/Initializer.php +++ b/src/Driver/Mysqli/Initializer.php @@ -9,8 +9,6 @@ interface Initializer { - /** - * @throws Exception - */ + /** @throws Exception */ public function initialize(mysqli $connection): void; } diff --git a/src/Driver/Mysqli/Initializer/Options.php b/src/Driver/Mysqli/Initializer/Options.php index 0e53a02311e..32239513513 100644 --- a/src/Driver/Mysqli/Initializer/Options.php +++ b/src/Driver/Mysqli/Initializer/Options.php @@ -12,9 +12,7 @@ final class Options implements Initializer { - /** - * @param array $options - */ + /** @param array $options */ public function __construct(private readonly array $options) { } diff --git a/src/Driver/Mysqli/Initializer/Secure.php b/src/Driver/Mysqli/Initializer/Secure.php index 6e7982d274d..9ac751cf24f 100644 --- a/src/Driver/Mysqli/Initializer/Secure.php +++ b/src/Driver/Mysqli/Initializer/Secure.php @@ -14,7 +14,7 @@ public function __construct( private readonly string $cert, private readonly string $ca, private readonly string $capath, - private readonly string $cipher + private readonly string $cipher, ) { } diff --git a/src/Driver/Mysqli/Statement.php b/src/Driver/Mysqli/Statement.php index 6861473e3fe..8436fadfc6c 100644 --- a/src/Driver/Mysqli/Statement.php +++ b/src/Driver/Mysqli/Statement.php @@ -41,9 +41,7 @@ final class Statement implements StatementInterface */ private array $values = []; - /** - * @internal The statement can be only instantiated by its driver connection. - */ + /** @internal The statement can be only instantiated by its driver connection. */ public function __construct(private readonly mysqli_stmt $stmt) { $paramCount = $this->stmt->param_count; diff --git a/src/Driver/OCI8/Connection.php b/src/Driver/OCI8/Connection.php index b2f304fe93f..cbda7c7e395 100644 --- a/src/Driver/OCI8/Connection.php +++ b/src/Driver/OCI8/Connection.php @@ -50,9 +50,7 @@ public function getServerVersion(): string return $matches[1]; } - /** - * @throws Parser\Exception - */ + /** @throws Parser\Exception */ public function prepare(string $sql): Statement { $visitor = new ConvertPositionalToNamedPlaceholders(); @@ -116,9 +114,7 @@ public function rollBack(): void $this->executionMode->enableAutoCommit(); } - /** - * @return resource - */ + /** @return resource */ public function getNativeConnection() { return $this->connection; diff --git a/src/Driver/OCI8/ConvertPositionalToNamedPlaceholders.php b/src/Driver/OCI8/ConvertPositionalToNamedPlaceholders.php index 48f8d48b81d..5898a2c5e6f 100644 --- a/src/Driver/OCI8/ConvertPositionalToNamedPlaceholders.php +++ b/src/Driver/OCI8/ConvertPositionalToNamedPlaceholders.php @@ -50,9 +50,7 @@ public function getSQL(): string return implode('', $this->buffer); } - /** - * @return array - */ + /** @return array */ public function getParameterMap(): array { return $this->parameterMap; diff --git a/src/Driver/OCI8/Exception/Error.php b/src/Driver/OCI8/Exception/Error.php index 7a27141fe5e..6abdf233c11 100644 --- a/src/Driver/OCI8/Exception/Error.php +++ b/src/Driver/OCI8/Exception/Error.php @@ -16,9 +16,7 @@ */ final class Error extends AbstractException { - /** - * @param resource $resource - */ + /** @param resource $resource */ public static function new($resource): self { $error = oci_error($resource); diff --git a/src/Driver/OCI8/Exception/NonTerminatedStringLiteral.php b/src/Driver/OCI8/Exception/NonTerminatedStringLiteral.php index c26fe2990b9..776728fbeb4 100644 --- a/src/Driver/OCI8/Exception/NonTerminatedStringLiteral.php +++ b/src/Driver/OCI8/Exception/NonTerminatedStringLiteral.php @@ -20,8 +20,8 @@ public static function new(int $offset): self return new self( sprintf( 'The statement contains non-terminated string literal starting at offset %d.', - $offset - ) + $offset, + ), ); } } diff --git a/src/Driver/OCI8/Exception/UnknownParameterIndex.php b/src/Driver/OCI8/Exception/UnknownParameterIndex.php index ea56c549e54..2cd3fe7962f 100644 --- a/src/Driver/OCI8/Exception/UnknownParameterIndex.php +++ b/src/Driver/OCI8/Exception/UnknownParameterIndex.php @@ -18,7 +18,7 @@ final class UnknownParameterIndex extends AbstractException public static function new(int $index): self { return new self( - sprintf('Could not find variable mapping with index %d, in the SQL statement', $index) + sprintf('Could not find variable mapping with index %d, in the SQL statement', $index), ); } } diff --git a/src/Driver/OCI8/Result.php b/src/Driver/OCI8/Result.php index b5f66082cc3..609e651c4b8 100644 --- a/src/Driver/OCI8/Result.php +++ b/src/Driver/OCI8/Result.php @@ -100,9 +100,7 @@ public function free(): void oci_cancel($this->statement); } - /** - * @throws Exception - */ + /** @throws Exception */ private function fetch(int $mode): mixed { $result = oci_fetch_array($this->statement, $mode | OCI_RETURN_NULLS | OCI_RETURN_LOBS); @@ -114,9 +112,7 @@ private function fetch(int $mode): mixed return $result; } - /** - * @return array - */ + /** @return array */ private function fetchAll(int $mode, int $fetchStructure): array { oci_fetch_all( @@ -124,7 +120,7 @@ private function fetchAll(int $mode, int $fetchStructure): array $result, 0, -1, - $mode | OCI_RETURN_NULLS | $fetchStructure | OCI_RETURN_LOBS + $mode | OCI_RETURN_NULLS | $fetchStructure | OCI_RETURN_LOBS, ); return $result; diff --git a/src/Driver/OCI8/Statement.php b/src/Driver/OCI8/Statement.php index f0f2f24abc1..408f0dd5d01 100644 --- a/src/Driver/OCI8/Statement.php +++ b/src/Driver/OCI8/Statement.php @@ -35,7 +35,7 @@ public function __construct( private readonly mixed $connection, private readonly mixed $statement, private readonly array $parameterMap, - private readonly ExecutionMode $executionMode + private readonly ExecutionMode $executionMode, ) { } @@ -66,7 +66,7 @@ public function bindValue(int|string $param, mixed $value, ParameterType $type): $param, $value, -1, - $this->convertParameterType($type) + $this->convertParameterType($type), ) ) { throw Error::new($this->statement); diff --git a/src/Driver/PDO/Connection.php b/src/Driver/PDO/Connection.php index 54712e60199..7446b4a1d08 100644 --- a/src/Driver/PDO/Connection.php +++ b/src/Driver/PDO/Connection.php @@ -15,9 +15,7 @@ final class Connection implements ConnectionInterface { - /** - * @internal The connection can be only instantiated by its driver. - */ + /** @internal The connection can be only instantiated by its driver. */ public function __construct(private readonly PDO $connection) { $connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); diff --git a/src/Driver/PDO/MySQL/Driver.php b/src/Driver/PDO/MySQL/Driver.php index 4b116212252..5dbdadfe716 100644 --- a/src/Driver/PDO/MySQL/Driver.php +++ b/src/Driver/PDO/MySQL/Driver.php @@ -28,7 +28,7 @@ public function connect(array $params): Connection $this->constructPdoDsn($params), $params['user'] ?? '', $params['password'] ?? '', - $driverOptions + $driverOptions, ); } catch (PDOException $exception) { throw Exception::new($exception); diff --git a/src/Driver/PDO/OCI/Driver.php b/src/Driver/PDO/OCI/Driver.php index c0b59a5ed0c..cf3185a6b04 100644 --- a/src/Driver/PDO/OCI/Driver.php +++ b/src/Driver/PDO/OCI/Driver.php @@ -28,7 +28,7 @@ public function connect(array $params): Connection $this->constructPdoDsn($params), $params['user'] ?? '', $params['password'] ?? '', - $driverOptions + $driverOptions, ); } catch (PDOException $exception) { throw Exception::new($exception); diff --git a/src/Driver/PDO/PgSQL/Driver.php b/src/Driver/PDO/PgSQL/Driver.php index 60767dc1c92..a83c4211ecd 100644 --- a/src/Driver/PDO/PgSQL/Driver.php +++ b/src/Driver/PDO/PgSQL/Driver.php @@ -28,7 +28,7 @@ public function connect(array $params): Connection $this->constructPdoDsn($params), $params['user'] ?? '', $params['password'] ?? '', - $driverOptions + $driverOptions, ); } catch (PDOException $exception) { throw Exception::new($exception); diff --git a/src/Driver/PDO/Result.php b/src/Driver/PDO/Result.php index af73ff26aaf..f56a563ce5e 100644 --- a/src/Driver/PDO/Result.php +++ b/src/Driver/PDO/Result.php @@ -11,9 +11,7 @@ final class Result implements ResultInterface { - /** - * @internal The result can be only instantiated by its driver connection or statement. - */ + /** @internal The result can be only instantiated by its driver connection or statement. */ public function __construct(private readonly PDOStatement $statement) { } @@ -80,9 +78,7 @@ public function free(): void $this->statement->closeCursor(); } - /** - * @throws Exception - */ + /** @throws Exception */ private function fetch(int $mode): mixed { try { diff --git a/src/Driver/PDO/SQLSrv/Connection.php b/src/Driver/PDO/SQLSrv/Connection.php index 01a984b3013..78ba7f82160 100644 --- a/src/Driver/PDO/SQLSrv/Connection.php +++ b/src/Driver/PDO/SQLSrv/Connection.php @@ -10,19 +10,15 @@ final class Connection extends AbstractConnectionMiddleware { - private readonly PDOConnection $connection; - - public function __construct(PDOConnection $connection) + public function __construct(private readonly PDOConnection $connection) { parent::__construct($connection); - - $this->connection = $connection; } public function prepare(string $sql): Statement { return new Statement( - $this->connection->prepare($sql) + $this->connection->prepare($sql), ); } diff --git a/src/Driver/PDO/SQLSrv/Driver.php b/src/Driver/PDO/SQLSrv/Driver.php index 04d3372233e..8920f4c1e2b 100644 --- a/src/Driver/PDO/SQLSrv/Driver.php +++ b/src/Driver/PDO/SQLSrv/Driver.php @@ -42,7 +42,7 @@ public function connect(array $params): Connection $this->constructDsn($params, $dsnOptions), $params['user'] ?? '', $params['password'] ?? '', - $driverOptions + $driverOptions, ); } catch (\PDOException $exception) { throw PDOException::new($exception); diff --git a/src/Driver/PDO/SQLSrv/Statement.php b/src/Driver/PDO/SQLSrv/Statement.php index 651feaf4c9e..44cecc97f21 100644 --- a/src/Driver/PDO/SQLSrv/Statement.php +++ b/src/Driver/PDO/SQLSrv/Statement.php @@ -11,16 +11,10 @@ final class Statement extends AbstractStatementMiddleware { - private readonly PDOStatement $statement; - - /** - * @internal The statement can be only instantiated by its driver connection. - */ - public function __construct(PDOStatement $statement) + /** @internal The statement can be only instantiated by its driver connection. */ + public function __construct(private readonly PDOStatement $statement) { parent::__construct($statement); - - $this->statement = $statement; } public function bindValue(int|string $param, mixed $value, ParameterType $type): void @@ -32,7 +26,7 @@ public function bindValue(int|string $param, mixed $value, ParameterType $type): $param, $value, $type, - PDO::SQLSRV_ENCODING_BINARY + PDO::SQLSRV_ENCODING_BINARY, ); break; @@ -41,7 +35,7 @@ public function bindValue(int|string $param, mixed $value, ParameterType $type): $param, $value, ParameterType::STRING, - PDO::SQLSRV_ENCODING_SYSTEM + PDO::SQLSRV_ENCODING_SYSTEM, ); break; diff --git a/src/Driver/PDO/SQLite/Driver.php b/src/Driver/PDO/SQLite/Driver.php index 4f5610ad0d9..d9895f4d1dd 100644 --- a/src/Driver/PDO/SQLite/Driver.php +++ b/src/Driver/PDO/SQLite/Driver.php @@ -41,7 +41,7 @@ public function connect(array $params): Connection if (isset($driverOptions['userDefinedFunctions'])) { $this->userDefinedFunctions = array_merge( $this->userDefinedFunctions, - $driverOptions['userDefinedFunctions'] + $driverOptions['userDefinedFunctions'], ); unset($driverOptions['userDefinedFunctions']); } @@ -51,7 +51,7 @@ public function connect(array $params): Connection $this->constructPdoDsn($params), $params['user'] ?? '', $params['password'] ?? '', - $driverOptions + $driverOptions, ); } catch (PDOException $exception) { throw Exception::new($exception); diff --git a/src/Driver/PDO/Statement.php b/src/Driver/PDO/Statement.php index fdd6d57839f..3c10d1de678 100644 --- a/src/Driver/PDO/Statement.php +++ b/src/Driver/PDO/Statement.php @@ -13,9 +13,7 @@ final class Statement implements StatementInterface { - /** - * @internal The statement can be only instantiated by its driver connection. - */ + /** @internal The statement can be only instantiated by its driver connection. */ public function __construct(private readonly PDOStatement $stmt) { } @@ -40,7 +38,7 @@ public function bindParamWithDriverOptions( string|int $param, mixed &$variable, ParameterType $type, - mixed $driverOptions + mixed $driverOptions, ): void { try { $this->stmt->bindParam($param, $variable, $this->convertParamType($type), 0, $driverOptions); diff --git a/src/Driver/SQLSrv/Connection.php b/src/Driver/SQLSrv/Connection.php index f675989247b..44629ec5f04 100644 --- a/src/Driver/SQLSrv/Connection.php +++ b/src/Driver/SQLSrv/Connection.php @@ -100,9 +100,7 @@ public function rollBack(): void } } - /** - * @return resource - */ + /** @return resource */ public function getNativeConnection() { return $this->connection; diff --git a/src/Driver/SQLSrv/Statement.php b/src/Driver/SQLSrv/Statement.php index 4e0f367b66a..dc7827a50f4 100644 --- a/src/Driver/SQLSrv/Statement.php +++ b/src/Driver/SQLSrv/Statement.php @@ -57,7 +57,7 @@ final class Statement implements StatementInterface */ public function __construct( private readonly mixed $conn, - private string $sql + private string $sql, ) { if (stripos($sql, 'INSERT INTO ') !== 0) { return; diff --git a/src/DriverManager.php b/src/DriverManager.php index fa6155aa288..c1df87c373e 100644 --- a/src/DriverManager.php +++ b/src/DriverManager.php @@ -187,7 +187,7 @@ private function __construct() public static function getConnection( array $params, ?Configuration $config = null, - ?EventManager $eventManager = null + ?EventManager $eventManager = null, ): Connection { // create default config and event manager, if not set $config ??= new Configuration(); diff --git a/src/Event/Listeners/OracleSessionInit.php b/src/Event/Listeners/OracleSessionInit.php index 9b91cbdda67..b7c606d6c75 100644 --- a/src/Event/Listeners/OracleSessionInit.php +++ b/src/Event/Listeners/OracleSessionInit.php @@ -37,17 +37,13 @@ class OracleSessionInit implements EventSubscriber 'NLS_NUMERIC_CHARACTERS' => '.,', ]; - /** - * @param array $oracleSessionVars - */ + /** @param array $oracleSessionVars */ public function __construct(array $oracleSessionVars = []) { $this->_defaultSessionVars = array_merge($this->_defaultSessionVars, $oracleSessionVars); } - /** - * @throws Exception - */ + /** @throws Exception */ public function postConnect(ConnectionEventArgs $args): void { if (count($this->_defaultSessionVars) === 0) { diff --git a/src/Event/Listeners/SQLSessionInit.php b/src/Event/Listeners/SQLSessionInit.php index 495fe0e2707..ac29592495a 100644 --- a/src/Event/Listeners/SQLSessionInit.php +++ b/src/Event/Listeners/SQLSessionInit.php @@ -18,9 +18,7 @@ public function __construct(protected string $sql) { } - /** - * @throws Exception - */ + /** @throws Exception */ public function postConnect(ConnectionEventArgs $args): void { $args->getConnection()->executeStatement($this->sql); diff --git a/src/Event/Listeners/SQLiteSessionInit.php b/src/Event/Listeners/SQLiteSessionInit.php index 8f5bd07b820..559837eeb96 100644 --- a/src/Event/Listeners/SQLiteSessionInit.php +++ b/src/Event/Listeners/SQLiteSessionInit.php @@ -11,9 +11,7 @@ class SQLiteSessionInit implements EventSubscriber { - /** - * @throws Exception - */ + /** @throws Exception */ public function postConnect(ConnectionEventArgs $args): void { $args->getConnection()->executeStatement('PRAGMA foreign_keys=ON'); diff --git a/src/Event/SchemaAlterTableAddColumnEventArgs.php b/src/Event/SchemaAlterTableAddColumnEventArgs.php index f3008eebfd8..193d8f71b20 100644 --- a/src/Event/SchemaAlterTableAddColumnEventArgs.php +++ b/src/Event/SchemaAlterTableAddColumnEventArgs.php @@ -22,7 +22,7 @@ class SchemaAlterTableAddColumnEventArgs extends SchemaEventArgs public function __construct( private readonly Column $column, private readonly TableDiff $tableDiff, - private readonly AbstractPlatform $platform + private readonly AbstractPlatform $platform, ) { } @@ -41,9 +41,7 @@ public function getPlatform(): AbstractPlatform return $this->platform; } - /** - * @return $this - */ + /** @return $this */ public function addSql(string ...$sql): self { $this->sql = array_merge($this->sql, array_values($sql)); @@ -51,9 +49,7 @@ public function addSql(string ...$sql): self return $this; } - /** - * @return array - */ + /** @return array */ public function getSql(): array { return $this->sql; diff --git a/src/Event/SchemaAlterTableChangeColumnEventArgs.php b/src/Event/SchemaAlterTableChangeColumnEventArgs.php index 632bea7b6ec..24f966e15b6 100644 --- a/src/Event/SchemaAlterTableChangeColumnEventArgs.php +++ b/src/Event/SchemaAlterTableChangeColumnEventArgs.php @@ -22,7 +22,7 @@ class SchemaAlterTableChangeColumnEventArgs extends SchemaEventArgs public function __construct( private readonly ColumnDiff $columnDiff, private readonly TableDiff $tableDiff, - private readonly AbstractPlatform $platform + private readonly AbstractPlatform $platform, ) { } @@ -41,9 +41,7 @@ public function getPlatform(): AbstractPlatform return $this->platform; } - /** - * @return $this - */ + /** @return $this */ public function addSql(string ...$sql): self { $this->sql = array_merge($this->sql, array_values($sql)); @@ -51,9 +49,7 @@ public function addSql(string ...$sql): self return $this; } - /** - * @return array - */ + /** @return array */ public function getSql(): array { return $this->sql; diff --git a/src/Event/SchemaAlterTableEventArgs.php b/src/Event/SchemaAlterTableEventArgs.php index 638831a89e2..a5e77fa3423 100644 --- a/src/Event/SchemaAlterTableEventArgs.php +++ b/src/Event/SchemaAlterTableEventArgs.php @@ -32,9 +32,7 @@ public function getPlatform(): AbstractPlatform return $this->platform; } - /** - * @return $this - */ + /** @return $this */ public function addSql(string ...$sql): self { $this->sql = array_merge($this->sql, array_values($sql)); @@ -42,9 +40,7 @@ public function addSql(string ...$sql): self return $this; } - /** - * @return array - */ + /** @return array */ public function getSql(): array { return $this->sql; diff --git a/src/Event/SchemaAlterTableRemoveColumnEventArgs.php b/src/Event/SchemaAlterTableRemoveColumnEventArgs.php index 1f983624de1..24f2bac822d 100644 --- a/src/Event/SchemaAlterTableRemoveColumnEventArgs.php +++ b/src/Event/SchemaAlterTableRemoveColumnEventArgs.php @@ -22,7 +22,7 @@ class SchemaAlterTableRemoveColumnEventArgs extends SchemaEventArgs public function __construct( private readonly Column $column, private readonly TableDiff $tableDiff, - private readonly AbstractPlatform $platform + private readonly AbstractPlatform $platform, ) { } @@ -41,9 +41,7 @@ public function getPlatform(): AbstractPlatform return $this->platform; } - /** - * @return $this - */ + /** @return $this */ public function addSql(string ...$sql): self { $this->sql = array_merge($this->sql, array_values($sql)); @@ -51,9 +49,7 @@ public function addSql(string ...$sql): self return $this; } - /** - * @return array - */ + /** @return array */ public function getSql(): array { return $this->sql; diff --git a/src/Event/SchemaAlterTableRenameColumnEventArgs.php b/src/Event/SchemaAlterTableRenameColumnEventArgs.php index 224f91d6daf..297e8a5399c 100644 --- a/src/Event/SchemaAlterTableRenameColumnEventArgs.php +++ b/src/Event/SchemaAlterTableRenameColumnEventArgs.php @@ -23,7 +23,7 @@ public function __construct( private readonly string $oldColumnName, private readonly Column $column, private readonly TableDiff $tableDiff, - private readonly AbstractPlatform $platform + private readonly AbstractPlatform $platform, ) { } @@ -47,9 +47,7 @@ public function getPlatform(): AbstractPlatform return $this->platform; } - /** - * @return $this - */ + /** @return $this */ public function addSql(string ...$sql): self { $this->sql = array_merge($this->sql, array_values($sql)); @@ -57,9 +55,7 @@ public function addSql(string ...$sql): self return $this; } - /** - * @return array - */ + /** @return array */ public function getSql(): array { return $this->sql; diff --git a/src/Event/SchemaColumnDefinitionEventArgs.php b/src/Event/SchemaColumnDefinitionEventArgs.php index c7f43d36496..02c3eccc539 100644 --- a/src/Event/SchemaColumnDefinitionEventArgs.php +++ b/src/Event/SchemaColumnDefinitionEventArgs.php @@ -14,14 +14,12 @@ class SchemaColumnDefinitionEventArgs extends SchemaEventArgs { private ?Column $column = null; - /** - * @param array $tableColumn - */ + /** @param array $tableColumn */ public function __construct( private readonly array $tableColumn, private readonly string $table, private readonly string $database, - private readonly Connection $connection + private readonly Connection $connection, ) { } @@ -43,9 +41,7 @@ public function getColumn(): ?Column return $this->column; } - /** - * @return array - */ + /** @return array */ public function getTableColumn(): array { return $this->tableColumn; diff --git a/src/Event/SchemaCreateTableColumnEventArgs.php b/src/Event/SchemaCreateTableColumnEventArgs.php index 7fbfe7a8299..8d52f29fc15 100644 --- a/src/Event/SchemaCreateTableColumnEventArgs.php +++ b/src/Event/SchemaCreateTableColumnEventArgs.php @@ -22,7 +22,7 @@ class SchemaCreateTableColumnEventArgs extends SchemaEventArgs public function __construct( private readonly Column $column, private readonly Table $table, - private readonly AbstractPlatform $platform + private readonly AbstractPlatform $platform, ) { } @@ -41,9 +41,7 @@ public function getPlatform(): AbstractPlatform return $this->platform; } - /** - * @return $this - */ + /** @return $this */ public function addSql(string ...$sql): self { $this->sql = array_merge($this->sql, array_values($sql)); @@ -51,9 +49,7 @@ public function addSql(string ...$sql): self return $this; } - /** - * @return array - */ + /** @return array */ public function getSql(): array { return $this->sql; diff --git a/src/Event/SchemaCreateTableEventArgs.php b/src/Event/SchemaCreateTableEventArgs.php index ba64a54d385..4422627ca0f 100644 --- a/src/Event/SchemaCreateTableEventArgs.php +++ b/src/Event/SchemaCreateTableEventArgs.php @@ -26,7 +26,7 @@ public function __construct( private readonly Table $table, private readonly array $columns, private readonly array $options, - private readonly AbstractPlatform $platform + private readonly AbstractPlatform $platform, ) { } @@ -35,17 +35,13 @@ public function getTable(): Table return $this->table; } - /** - * @return array> - */ + /** @return array> */ public function getColumns(): array { return $this->columns; } - /** - * @return array - */ + /** @return array */ public function getOptions(): array { return $this->options; @@ -56,9 +52,7 @@ public function getPlatform(): AbstractPlatform return $this->platform; } - /** - * @return $this - */ + /** @return $this */ public function addSql(string ...$sql): self { $this->sql = array_merge($this->sql, array_values($sql)); @@ -66,9 +60,7 @@ public function addSql(string ...$sql): self return $this; } - /** - * @return array - */ + /** @return array */ public function getSql(): array { return $this->sql; diff --git a/src/Event/SchemaDropTableEventArgs.php b/src/Event/SchemaDropTableEventArgs.php index f88897ff049..eb64f42f8f1 100644 --- a/src/Event/SchemaDropTableEventArgs.php +++ b/src/Event/SchemaDropTableEventArgs.php @@ -27,9 +27,7 @@ public function getPlatform(): AbstractPlatform return $this->platform; } - /** - * @return $this - */ + /** @return $this */ public function setSql(string $sql): self { $this->sql = $sql; diff --git a/src/Event/SchemaEventArgs.php b/src/Event/SchemaEventArgs.php index 6ed5856bb8c..6e8dcaebbef 100644 --- a/src/Event/SchemaEventArgs.php +++ b/src/Event/SchemaEventArgs.php @@ -13,9 +13,7 @@ class SchemaEventArgs extends EventArgs { private bool $preventDefault = false; - /** - * @return $this - */ + /** @return $this */ public function preventDefault(): self { $this->preventDefault = true; diff --git a/src/Event/SchemaIndexDefinitionEventArgs.php b/src/Event/SchemaIndexDefinitionEventArgs.php index ba334efebd0..26d7607ffb0 100644 --- a/src/Event/SchemaIndexDefinitionEventArgs.php +++ b/src/Event/SchemaIndexDefinitionEventArgs.php @@ -14,13 +14,11 @@ class SchemaIndexDefinitionEventArgs extends SchemaEventArgs { private ?Index $index = null; - /** - * @param array $tableIndex - */ + /** @param array $tableIndex */ public function __construct( private readonly array $tableIndex, private readonly string $table, - private readonly Connection $connection + private readonly Connection $connection, ) { } @@ -41,9 +39,7 @@ public function getIndex(): ?Index return $this->index; } - /** - * @return array - */ + /** @return array */ public function getTableIndex(): array { return $this->tableIndex; diff --git a/src/Exception.php b/src/Exception.php index e6a97c47ab6..a2f84f96b0b 100644 --- a/src/Exception.php +++ b/src/Exception.php @@ -4,9 +4,7 @@ namespace Doctrine\DBAL; -/** - * @psalm-immutable - */ +/** @psalm-immutable */ class Exception extends \Exception { } diff --git a/src/Exception/ColumnLengthRequired.php b/src/Exception/ColumnLengthRequired.php index f7e02233a55..aa4c2042a14 100644 --- a/src/Exception/ColumnLengthRequired.php +++ b/src/Exception/ColumnLengthRequired.php @@ -10,9 +10,7 @@ use function get_debug_type; use function sprintf; -/** - * @psalm-immutable - */ +/** @psalm-immutable */ final class ColumnLengthRequired extends Exception { /** @@ -25,8 +23,8 @@ public static function new(AbstractPlatform $platform, string $type): self sprintf( '%s requires the length of a %s column to be specified', get_debug_type($platform), - $type - ) + $type, + ), ); } } diff --git a/src/Exception/CommitFailedRollbackOnly.php b/src/Exception/CommitFailedRollbackOnly.php index b5884f5f93b..b49fd0ccc18 100644 --- a/src/Exception/CommitFailedRollbackOnly.php +++ b/src/Exception/CommitFailedRollbackOnly.php @@ -6,9 +6,7 @@ use Doctrine\DBAL\ConnectionException; -/** - * @psalm-immutable - */ +/** @psalm-immutable */ final class CommitFailedRollbackOnly extends ConnectionException { public static function new(): self diff --git a/src/Exception/ConnectionLost.php b/src/Exception/ConnectionLost.php index 89430acf802..eda8db1e2de 100644 --- a/src/Exception/ConnectionLost.php +++ b/src/Exception/ConnectionLost.php @@ -4,9 +4,7 @@ namespace Doctrine\DBAL\Exception; -/** - * @psalm-immutable - */ +/** @psalm-immutable */ final class ConnectionLost extends ConnectionException { } diff --git a/src/Exception/DatabaseDoesNotExist.php b/src/Exception/DatabaseDoesNotExist.php index 731c766e3d9..d569d781a44 100644 --- a/src/Exception/DatabaseDoesNotExist.php +++ b/src/Exception/DatabaseDoesNotExist.php @@ -4,9 +4,7 @@ namespace Doctrine\DBAL\Exception; -/** - * @psalm-immutable - */ +/** @psalm-immutable */ class DatabaseDoesNotExist extends DatabaseObjectNotFoundException { } diff --git a/src/Exception/DatabaseRequired.php b/src/Exception/DatabaseRequired.php index 635525feeaf..d5276289693 100644 --- a/src/Exception/DatabaseRequired.php +++ b/src/Exception/DatabaseRequired.php @@ -8,9 +8,7 @@ use function sprintf; -/** - * @psalm-immutable - */ +/** @psalm-immutable */ class DatabaseRequired extends Exception { public static function new(string $methodName): self @@ -18,8 +16,8 @@ public static function new(string $methodName): self return new self( sprintf( 'A database is required for the method: %s.', - $methodName - ) + $methodName, + ), ); } } diff --git a/src/Exception/DriverRequired.php b/src/Exception/DriverRequired.php index ba6ee38bea9..48a70559099 100644 --- a/src/Exception/DriverRequired.php +++ b/src/Exception/DriverRequired.php @@ -8,14 +8,10 @@ use function sprintf; -/** - * @psalm-immutable - */ +/** @psalm-immutable */ final class DriverRequired extends Exception { - /** - * @param string|null $url The URL that was provided in the connection parameters (if any). - */ + /** @param string|null $url The URL that was provided in the connection parameters (if any). */ public static function new(?string $url = null): self { if ($url !== null) { @@ -23,14 +19,14 @@ public static function new(?string $url = null): self sprintf( 'The options "driver" or "driverClass" are mandatory if a connection URL without scheme ' . 'is given to DriverManager::getConnection(). Given URL "%s".', - $url - ) + $url, + ), ); } return new self( 'The options "driver" or "driverClass" are mandatory if no PDO ' - . 'instance is given to DriverManager::getConnection().' + . 'instance is given to DriverManager::getConnection().', ); } } diff --git a/src/Exception/InvalidDriverClass.php b/src/Exception/InvalidDriverClass.php index 5c78148834e..1c40d790e75 100644 --- a/src/Exception/InvalidDriverClass.php +++ b/src/Exception/InvalidDriverClass.php @@ -9,9 +9,7 @@ use function sprintf; -/** - * @psalm-immutable - */ +/** @psalm-immutable */ final class InvalidDriverClass extends Exception { public static function new(string $driverClass): self @@ -20,8 +18,8 @@ public static function new(string $driverClass): self sprintf( 'The given "driverClass" %s has to implement the %s interface.', $driverClass, - Driver::class - ) + Driver::class, + ), ); } } diff --git a/src/Exception/InvalidPlatformType.php b/src/Exception/InvalidPlatformType.php index a63666ca5d8..b9313122576 100644 --- a/src/Exception/InvalidPlatformType.php +++ b/src/Exception/InvalidPlatformType.php @@ -11,9 +11,7 @@ use function is_object; use function sprintf; -/** - * @psalm-immutable - */ +/** @psalm-immutable */ final class InvalidPlatformType extends Exception { public static function new(mixed $invalidPlatform): self @@ -23,8 +21,8 @@ public static function new(mixed $invalidPlatform): self sprintf( 'Option "platform" must be a subtype of %s, instance of %s given.', AbstractPlatform::class, - get_debug_type($invalidPlatform) - ) + get_debug_type($invalidPlatform), + ), ); } @@ -32,8 +30,8 @@ public static function new(mixed $invalidPlatform): self sprintf( 'Option "platform" must be an object and subtype of %s. Got %s.', AbstractPlatform::class, - get_debug_type($invalidPlatform) - ) + get_debug_type($invalidPlatform), + ), ); } } diff --git a/src/Exception/InvalidWrapperClass.php b/src/Exception/InvalidWrapperClass.php index 934f48d7b44..b5e26626199 100644 --- a/src/Exception/InvalidWrapperClass.php +++ b/src/Exception/InvalidWrapperClass.php @@ -9,9 +9,7 @@ use function sprintf; -/** - * @psalm-immutable - */ +/** @psalm-immutable */ final class InvalidWrapperClass extends Exception { public static function new(string $wrapperClass): self @@ -20,8 +18,8 @@ public static function new(string $wrapperClass): self sprintf( 'The given "wrapperClass" %s has to be a subtype of %s.', $wrapperClass, - Connection::class - ) + Connection::class, + ), ); } } diff --git a/src/Exception/NoActiveTransaction.php b/src/Exception/NoActiveTransaction.php index 532b1a7f708..a8d19c50f5c 100644 --- a/src/Exception/NoActiveTransaction.php +++ b/src/Exception/NoActiveTransaction.php @@ -6,9 +6,7 @@ use Doctrine\DBAL\ConnectionException; -/** - * @psalm-immutable - */ +/** @psalm-immutable */ final class NoActiveTransaction extends ConnectionException { public static function new(): self diff --git a/src/Exception/NoKeyValue.php b/src/Exception/NoKeyValue.php index 45a6c1ba67d..0cc2f4ebb5e 100644 --- a/src/Exception/NoKeyValue.php +++ b/src/Exception/NoKeyValue.php @@ -20,8 +20,8 @@ public static function fromColumnCount(int $columnCount): self return new self( sprintf( 'Fetching as key-value pairs requires the result to contain at least 2 columns, %d given.', - $columnCount - ) + $columnCount, + ), ); } } diff --git a/src/Exception/SavepointsNotSupported.php b/src/Exception/SavepointsNotSupported.php index 11faac61ebc..1d7260e1f99 100644 --- a/src/Exception/SavepointsNotSupported.php +++ b/src/Exception/SavepointsNotSupported.php @@ -6,9 +6,7 @@ use Doctrine\DBAL\ConnectionException; -/** - * @psalm-immutable - */ +/** @psalm-immutable */ final class SavepointsNotSupported extends ConnectionException { public static function new(): self diff --git a/src/Exception/SchemaDoesNotExist.php b/src/Exception/SchemaDoesNotExist.php index 65e16eb60a5..463d95b517b 100644 --- a/src/Exception/SchemaDoesNotExist.php +++ b/src/Exception/SchemaDoesNotExist.php @@ -4,9 +4,7 @@ namespace Doctrine\DBAL\Exception; -/** - * @psalm-immutable - */ +/** @psalm-immutable */ class SchemaDoesNotExist extends DatabaseObjectNotFoundException { } diff --git a/src/Exception/UnknownDriver.php b/src/Exception/UnknownDriver.php index 01ffca29f65..ba03cbd718b 100644 --- a/src/Exception/UnknownDriver.php +++ b/src/Exception/UnknownDriver.php @@ -9,22 +9,18 @@ use function implode; use function sprintf; -/** - * @psalm-immutable - */ +/** @psalm-immutable */ final class UnknownDriver extends Exception { - /** - * @param string[] $knownDrivers - */ + /** @param string[] $knownDrivers */ public static function new(string $unknownDriverName, array $knownDrivers): self { return new self( sprintf( 'The given "driver" "%s" is unknown, Doctrine currently supports only the following drivers: %s', $unknownDriverName, - implode(', ', $knownDrivers) - ) + implode(', ', $knownDrivers), + ), ); } } diff --git a/src/ExpandArrayParameters.php b/src/ExpandArrayParameters.php index 4daae7bc7df..7062eda12d2 100644 --- a/src/ExpandArrayParameters.php +++ b/src/ExpandArrayParameters.php @@ -72,17 +72,13 @@ public function getSQL(): string return implode('', $this->convertedSQL); } - /** - * @return list - */ + /** @return list */ public function getParameters(): array { return $this->convertedParameters; } - /** - * @throws InvalidParameterType - */ + /** @throws InvalidParameterType */ private function acceptParameter(int|string $key, mixed $value): void { if (! isset($this->types[$key])) { @@ -114,17 +110,13 @@ private function acceptParameter(int|string $key, mixed $value): void }); } - /** - * @return array - */ + /** @return array */ public function getTypes(): array { return $this->convertedTypes; } - /** - * @param list $values - */ + /** @param list $values */ private function appendTypedParameter(array $values, string|ParameterType|Type $type): void { $this->convertedSQL[] = implode(', ', array_fill(0, count($values), '?')); diff --git a/src/FetchMode.php b/src/FetchMode.php index fd625c353f5..eb050a5bb9f 100644 --- a/src/FetchMode.php +++ b/src/FetchMode.php @@ -11,8 +11,10 @@ class FetchMode { /** @link PDO::FETCH_ASSOC */ final public const ASSOCIATIVE = 2; + /** @link PDO::FETCH_NUM */ final public const NUMERIC = 3; + /** @link PDO::FETCH_COLUMN */ final public const COLUMN = 7; } diff --git a/src/Logging/Connection.php b/src/Logging/Connection.php index 8ae40f7ef73..9c220dea19d 100644 --- a/src/Logging/Connection.php +++ b/src/Logging/Connection.php @@ -12,9 +12,7 @@ final class Connection extends AbstractConnectionMiddleware { - /** - * @internal This connection can be only instantiated by its driver. - */ + /** @internal This connection can be only instantiated by its driver. */ public function __construct(ConnectionInterface $connection, private readonly LoggerInterface $logger) { parent::__construct($connection); @@ -30,7 +28,7 @@ public function prepare(string $sql): DriverStatement return new Statement( parent::prepare($sql), $this->logger, - $sql + $sql, ); } diff --git a/src/Logging/Driver.php b/src/Logging/Driver.php index 0a3e47e0406..9e0ea7c6681 100644 --- a/src/Logging/Driver.php +++ b/src/Logging/Driver.php @@ -10,9 +10,7 @@ final class Driver extends AbstractDriverMiddleware { - /** - * @internal This driver can be only instantiated by its middleware. - */ + /** @internal This driver can be only instantiated by its middleware. */ public function __construct(DriverInterface $driver, private readonly LoggerInterface $logger) { parent::__construct($driver); @@ -27,7 +25,7 @@ public function connect(array $params): Connection return new Connection( parent::connect($params), - $this->logger + $this->logger, ); } diff --git a/src/Logging/Statement.php b/src/Logging/Statement.php index af8ef3a6b7d..ed1ca7f2d04 100644 --- a/src/Logging/Statement.php +++ b/src/Logging/Statement.php @@ -18,13 +18,11 @@ final class Statement extends AbstractStatementMiddleware /** @var array|array */ private array $types = []; - /** - * @internal This statement can be only instantiated by its connection. - */ + /** @internal This statement can be only instantiated by its connection. */ public function __construct( StatementInterface $statement, private readonly LoggerInterface $logger, - private readonly string $sql + private readonly string $sql, ) { parent::__construct($statement); } diff --git a/src/Platforms/AbstractMySQLPlatform.php b/src/Platforms/AbstractMySQLPlatform.php index bc8842013cc..a62e07651c5 100644 --- a/src/Platforms/AbstractMySQLPlatform.php +++ b/src/Platforms/AbstractMySQLPlatform.php @@ -85,7 +85,7 @@ protected function getDateArithmeticIntervalExpression( string $date, string $operator, string $interval, - DateIntervalUnit $unit + DateIntervalUnit $unit, ): string { $function = $operator === '+' ? 'DATE_ADD' : 'DATE_SUB'; @@ -107,17 +107,13 @@ public function getLengthExpression(string $string): string return 'CHAR_LENGTH(' . $string . ')'; } - /** - * @internal The method should be only used from within the {@see AbstractSchemaManager} class hierarchy. - */ + /** @internal The method should be only used from within the {@see AbstractSchemaManager} class hierarchy. */ public function getListDatabasesSQL(): string { return 'SHOW DATABASES'; } - /** - * @internal The method should be only used from within the {@see AbstractSchemaManager} class hierarchy. - */ + /** @internal The method should be only used from within the {@see AbstractSchemaManager} class hierarchy. */ public function getListViewsSQL(string $database): string { return 'SELECT * FROM information_schema.VIEWS WHERE TABLE_SCHEMA = ' . $this->quoteStringLiteral($database); @@ -199,17 +195,13 @@ public function supportsIdentityColumns(): bool return true; } - /** - * @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. - */ + /** @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. */ public function supportsInlineColumnComments(): bool { return true; } - /** - * @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. - */ + /** @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. */ public function supportsColumnCollation(): bool { return true; @@ -401,7 +393,7 @@ public function getAlterTableSQL(TableDiff $diff): array $sql = array_merge( $this->getPreAlterTableIndexForeignKeySQL($diff), $sql, - $this->getPostAlterTableIndexForeignKeySQL($diff) + $this->getPostAlterTableIndexForeignKeySQL($diff), ); } @@ -465,7 +457,7 @@ protected function getPreAlterTableIndexForeignKeySQL(TableDiff $diff): array $sql, $this->getPreAlterTableAlterIndexForeignKeySQL($diff), parent::getPreAlterTableIndexForeignKeySQL($diff), - $this->getPreAlterTableRenameIndexForeignKeySQL($diff) + $this->getPreAlterTableRenameIndexForeignKeySQL($diff), ); } @@ -637,25 +629,19 @@ protected function _getCommonIntegerTypeDeclarationSQL(array $column): string return $this->getUnsignedDeclaration($column) . $autoinc; } - /** - * @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. - */ + /** @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. */ public function getColumnCharsetDeclarationSQL(string $charset): string { return 'CHARACTER SET ' . $charset; } - /** - * @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. - */ + /** @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. */ public function getColumnCollationDeclarationSQL(string $collation): string { return 'COLLATE ' . $this->quoteSingleIdentifier($collation); } - /** - * @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. - */ + /** @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. */ public function getAdvancedForeignKeyOptionsSQL(ForeignKeyConstraint $foreignKey): string { $query = ''; diff --git a/src/Platforms/AbstractPlatform.php b/src/Platforms/AbstractPlatform.php index 692bcf40e96..70603782a48 100644 --- a/src/Platforms/AbstractPlatform.php +++ b/src/Platforms/AbstractPlatform.php @@ -72,14 +72,10 @@ */ abstract class AbstractPlatform { - /** - * @deprecated - */ + /** @deprecated */ public const CREATE_INDEXES = 1; - /** - * @deprecated - */ + /** @deprecated */ public const CREATE_FOREIGNKEYS = 2; /** @var string[]|null */ @@ -361,7 +357,7 @@ public function getDoctrineTypeMapping(string $dbType): string throw new Exception(sprintf( 'Unknown database type "%s" requested, %s may not support it.', $dbType, - static::class + static::class, )); } @@ -688,7 +684,7 @@ abstract protected function getDateArithmeticIntervalExpression( string $date, string $operator, string $interval, - DateIntervalUnit $unit + DateIntervalUnit $unit, ): string; /** @@ -783,7 +779,7 @@ public function getDropTableSQL(string $table): string if ($sql === null) { throw new UnexpectedValueException( - 'Default implementation of DROP TABLE was overridden with NULL.' + 'Default implementation of DROP TABLE was overridden with NULL.', ); } @@ -979,7 +975,7 @@ public function getCreateTablesSQL(array $tables): array foreach ($table->getForeignKeys() as $foreignKey) { $sql[] = $this->getCreateForeignKeySQL( $foreignKey, - $table->getQuotedName($this) + $table->getQuotedName($this), ); } } @@ -1000,7 +996,7 @@ public function getDropTablesSQL(array $tables): array foreach ($table->getForeignKeys() as $foreignKey) { $sql[] = $this->getDropForeignKeySQL( $foreignKey->getQuotedName($this), - $table->getQuotedName($this) + $table->getQuotedName($this), ); } } @@ -1019,13 +1015,11 @@ protected function getCommentOnTableSQL(string $tableName, string $comment): str return sprintf( 'COMMENT ON TABLE %s IS %s', $tableName->getQuotedName($this), - $this->quoteStringLiteral($comment) + $this->quoteStringLiteral($comment), ); } - /** - * @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. - */ + /** @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. */ public function getCommentOnColumnSQL(string $tableName, string $columnName, string $comment): string { $tableName = new Identifier($tableName); @@ -1035,7 +1029,7 @@ public function getCommentOnColumnSQL(string $tableName, string $columnName, str 'COMMENT ON COLUMN %s.%s IS %s', $tableName->getQuotedName($this), $columnName->getQuotedName($this), - $this->quoteStringLiteral($comment) + $this->quoteStringLiteral($comment), ); } @@ -1287,9 +1281,7 @@ public function getCreateForeignKeySQL(ForeignKeyConstraint $foreignKey, string */ abstract public function getAlterTableSQL(TableDiff $diff): array; - /** - * @param mixed[] $columnSql - */ + /** @param mixed[] $columnSql */ protected function onSchemaAlterTableAddColumn(Column $column, TableDiff $diff, array &$columnSql): bool { if ($this->_eventManager === null) { @@ -1308,9 +1300,7 @@ protected function onSchemaAlterTableAddColumn(Column $column, TableDiff $diff, return $eventArgs->isDefaultPrevented(); } - /** - * @param string[] $columnSql - */ + /** @param string[] $columnSql */ protected function onSchemaAlterTableRemoveColumn(Column $column, TableDiff $diff, array &$columnSql): bool { if ($this->_eventManager === null) { @@ -1329,9 +1319,7 @@ protected function onSchemaAlterTableRemoveColumn(Column $column, TableDiff $dif return $eventArgs->isDefaultPrevented(); } - /** - * @param string[] $columnSql - */ + /** @param string[] $columnSql */ protected function onSchemaAlterTableChangeColumn(ColumnDiff $columnDiff, TableDiff $diff, array &$columnSql): bool { if ($this->_eventManager === null) { @@ -1350,14 +1338,12 @@ protected function onSchemaAlterTableChangeColumn(ColumnDiff $columnDiff, TableD return $eventArgs->isDefaultPrevented(); } - /** - * @param string[] $columnSql - */ + /** @param string[] $columnSql */ protected function onSchemaAlterTableRenameColumn( string $oldColumnName, Column $column, TableDiff $diff, - array &$columnSql + array &$columnSql, ): bool { if ($this->_eventManager === null) { return false; @@ -1375,9 +1361,7 @@ protected function onSchemaAlterTableRenameColumn( return $eventArgs->isDefaultPrevented(); } - /** - * @param string[] $sql - */ + /** @param string[] $sql */ protected function onSchemaAlterTable(TableDiff $diff, array &$sql): bool { if ($this->_eventManager === null) { @@ -1396,9 +1380,7 @@ protected function onSchemaAlterTable(TableDiff $diff, array &$sql): bool return $eventArgs->isDefaultPrevented(); } - /** - * @return string[] - */ + /** @return string[] */ protected function getPreAlterTableIndexForeignKeySQL(TableDiff $diff): array { $tableName = $diff->getName($this)->getQuotedName($this); @@ -1424,9 +1406,7 @@ protected function getPreAlterTableIndexForeignKeySQL(TableDiff $diff): array return $sql; } - /** - * @return string[] - */ + /** @return string[] */ protected function getPostAlterTableIndexForeignKeySQL(TableDiff $diff): array { $sql = []; @@ -1458,7 +1438,7 @@ protected function getPostAlterTableIndexForeignKeySQL(TableDiff $diff): array $oldIndexName = new Identifier($oldIndexName); $sql = array_merge( $sql, - $this->getRenameIndexSQL($oldIndexName->getQuotedName($this), $index, $tableName) + $this->getRenameIndexSQL($oldIndexName->getQuotedName($this), $index, $tableName), ); } @@ -2021,9 +2001,7 @@ public function getDropViewSQL(string $name): string return 'DROP VIEW ' . $name; } - /** - * @throws Exception If not supported on this platform. - */ + /** @throws Exception If not supported on this platform. */ public function getSequenceNextValSQL(string $sequence): string { throw NotSupported::new(__METHOD__); @@ -2088,9 +2066,7 @@ abstract public function getDateTypeDeclarationSQL(array $column): string; */ abstract public function getTimeTypeDeclarationSQL(array $column): string; - /** - * @param mixed[] $column - */ + /** @param mixed[] $column */ public function getFloatDeclarationSQL(array $column): string { return 'DOUBLE PRECISION'; @@ -2253,7 +2229,7 @@ final public function modifyLimitQuery(string $query, ?int $limit, int $offset = if ($offset < 0) { throw new Exception(sprintf( 'Offset must be a positive integer or zero, %d given.', - $offset + $offset, )); } @@ -2379,7 +2355,7 @@ final public function escapeStringForLike(string $inputString, string $escapeCha $sql = preg_replace( '~([' . preg_quote($this->getLikeWildcardCharacters() . $escapeChar, '~') . '])~u', addcslashes($escapeChar, '\\') . '$1', - $inputString + $inputString, ); assert(is_string($sql)); @@ -2400,9 +2376,7 @@ private function columnToArray(Column $column): array ]); } - /** - * @internal - */ + /** @internal */ public function createSQLParser(): Parser { return new Parser(false); diff --git a/src/Platforms/DB2Platform.php b/src/Platforms/DB2Platform.php index 160eb23a187..0b4088c0a4c 100644 --- a/src/Platforms/DB2Platform.php +++ b/src/Platforms/DB2Platform.php @@ -134,7 +134,7 @@ protected function getDateArithmeticIntervalExpression( string $date, string $operator, string $interval, - DateIntervalUnit $unit + DateIntervalUnit $unit, ): string { switch ($unit) { case DateIntervalUnit::WEEK: @@ -201,17 +201,13 @@ public function getSetTransactionIsolationSQL(TransactionIsolationLevel $level): throw NotSupported::new(__METHOD__); } - /** - * @internal The method should be only used from within the {@see AbstractSchemaManager} class hierarchy. - */ + /** @internal The method should be only used from within the {@see AbstractSchemaManager} class hierarchy. */ public function getListViewsSQL(string $database): string { return 'SELECT NAME, TEXT FROM SYSIBM.SYSVIEWS'; } - /** - * @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. - */ + /** @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. */ public function supportsCommentOnStatement(): bool { return true; @@ -232,9 +228,7 @@ public function getCurrentTimestampSQL(): string return 'CURRENT TIMESTAMP'; } - /** - * @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. - */ + /** @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. */ public function getIndexDeclarationSQL(Index $index): string { // Index declaration in statements like CREATE TABLE is not supported. @@ -300,7 +294,7 @@ public function getAlterTableSQL(TableDiff $diff): array $commentsSQL[] = $this->getCommentOnColumnSQL( $diff->getName($this)->getQuotedName($this), $column->getQuotedName($this), - $comment + $comment, ); } @@ -321,7 +315,7 @@ public function getAlterTableSQL(TableDiff $diff): array $commentsSQL[] = $this->getCommentOnColumnSQL( $diff->getName($this)->getQuotedName($this), $columnDiff->column->getQuotedName($this), - $columnDiff->column->getComment() + $columnDiff->column->getComment(), ); } @@ -359,14 +353,14 @@ public function getAlterTableSQL(TableDiff $diff): array $sql[] = sprintf( 'RENAME TABLE %s TO %s', $diff->getName($this)->getQuotedName($this), - $newName->getQuotedName($this) + $newName->getQuotedName($this), ); } $sql = array_merge( $this->getPreAlterTableIndexForeignKeySQL($diff), $sql, - $this->getPostAlterTableIndexForeignKeySQL($diff) + $this->getPostAlterTableIndexForeignKeySQL($diff), ); } @@ -385,7 +379,7 @@ private function gatherAlterColumnSQL( Identifier $table, ColumnDiff $columnDiff, array &$sql, - array &$queryParts + array &$queryParts, ): void { $alterColumnClauses = $this->getAlterColumnClausesSQL($columnDiff); diff --git a/src/Platforms/Exception/InvalidPlatformVersion.php b/src/Platforms/Exception/InvalidPlatformVersion.php index 5709428ce5a..bb0ece08c76 100644 --- a/src/Platforms/Exception/InvalidPlatformVersion.php +++ b/src/Platforms/Exception/InvalidPlatformVersion.php @@ -8,9 +8,7 @@ use function sprintf; -/** - * @psalm-immutable - */ +/** @psalm-immutable */ final class InvalidPlatformVersion extends Exception implements PlatformException { /** @@ -24,7 +22,7 @@ public static function new(string $version, string $expectedFormat): self return new self(sprintf( 'Invalid platform version "%s" specified. The platform version has to be specified in the format: "%s".', $version, - $expectedFormat + $expectedFormat, )); } } diff --git a/src/Platforms/Exception/NoColumnsSpecifiedForTable.php b/src/Platforms/Exception/NoColumnsSpecifiedForTable.php index 4c92a4c7ebf..0a3105e3c9a 100644 --- a/src/Platforms/Exception/NoColumnsSpecifiedForTable.php +++ b/src/Platforms/Exception/NoColumnsSpecifiedForTable.php @@ -8,9 +8,7 @@ use function sprintf; -/** - * @psalm-immutable - */ +/** @psalm-immutable */ final class NoColumnsSpecifiedForTable extends Exception implements PlatformException { public static function new(string $tableName): self diff --git a/src/Platforms/Exception/NotSupported.php b/src/Platforms/Exception/NotSupported.php index cb660c7529e..56995578812 100644 --- a/src/Platforms/Exception/NotSupported.php +++ b/src/Platforms/Exception/NotSupported.php @@ -8,9 +8,7 @@ use function sprintf; -/** - * @psalm-immutable - */ +/** @psalm-immutable */ final class NotSupported extends Exception implements PlatformException { public static function new(string $method): self diff --git a/src/Platforms/MariaDBPlatform.php b/src/Platforms/MariaDBPlatform.php index 2384f2d8009..618e0c89b68 100644 --- a/src/Platforms/MariaDBPlatform.php +++ b/src/Platforms/MariaDBPlatform.php @@ -55,13 +55,11 @@ protected function getPostAlterTableIndexForeignKeySQL(TableDiff $diff): array { return array_merge( parent::getPostAlterTableIndexForeignKeySQL($diff), - $this->getPostAlterTableRenameIndexForeignKeySQL($diff) + $this->getPostAlterTableRenameIndexForeignKeySQL($diff), ); } - /** - * @return list - */ + /** @return list */ private function getPostAlterTableRenameIndexForeignKeySQL(TableDiff $diff): array { $sql = []; @@ -104,7 +102,7 @@ private function getRemainingForeignKeyConstraintsRequiringRenamedIndexes(TableD $remainingForeignKeys = array_diff_key( $diff->fromTable->getForeignKeys(), - $diff->removedForeignKeys + $diff->removedForeignKeys, ); foreach ($remainingForeignKeys as $foreignKey) { diff --git a/src/Platforms/MySQL/CharsetMetadataProvider.php b/src/Platforms/MySQL/CharsetMetadataProvider.php index 86d9d01d43d..665543e0d0a 100644 --- a/src/Platforms/MySQL/CharsetMetadataProvider.php +++ b/src/Platforms/MySQL/CharsetMetadataProvider.php @@ -4,9 +4,7 @@ namespace Doctrine\DBAL\Platforms\MySQL; -/** - * @internal - */ +/** @internal */ interface CharsetMetadataProvider { public function getDefaultCharsetCollation(string $charset): ?string; diff --git a/src/Platforms/MySQL/CharsetMetadataProvider/CachingCharsetMetadataProvider.php b/src/Platforms/MySQL/CharsetMetadataProvider/CachingCharsetMetadataProvider.php index 1e7c55c2a51..dadc8419d54 100644 --- a/src/Platforms/MySQL/CharsetMetadataProvider/CachingCharsetMetadataProvider.php +++ b/src/Platforms/MySQL/CharsetMetadataProvider/CachingCharsetMetadataProvider.php @@ -8,9 +8,7 @@ use function array_key_exists; -/** - * @internal - */ +/** @internal */ final class CachingCharsetMetadataProvider implements CharsetMetadataProvider { /** @var array */ diff --git a/src/Platforms/MySQL/CharsetMetadataProvider/ConnectionCharsetMetadataProvider.php b/src/Platforms/MySQL/CharsetMetadataProvider/ConnectionCharsetMetadataProvider.php index 6ba5ca1eda2..65b63df8fe6 100644 --- a/src/Platforms/MySQL/CharsetMetadataProvider/ConnectionCharsetMetadataProvider.php +++ b/src/Platforms/MySQL/CharsetMetadataProvider/ConnectionCharsetMetadataProvider.php @@ -8,18 +8,14 @@ use Doctrine\DBAL\Exception; use Doctrine\DBAL\Platforms\MySQL\CharsetMetadataProvider; -/** - * @internal - */ +/** @internal */ final class ConnectionCharsetMetadataProvider implements CharsetMetadataProvider { public function __construct(private readonly Connection $connection) { } - /** - * @throws Exception - */ + /** @throws Exception */ public function getDefaultCharsetCollation(string $charset): ?string { $collation = $this->connection->fetchOne( @@ -29,7 +25,7 @@ public function getDefaultCharsetCollation(string $charset): ?string WHERE CHARACTER_SET_NAME = ?; SQL , - [$charset] + [$charset], ); if ($collation !== false) { diff --git a/src/Platforms/MySQL/CollationMetadataProvider.php b/src/Platforms/MySQL/CollationMetadataProvider.php index 4aa0faf6c31..d52ca74a2b2 100644 --- a/src/Platforms/MySQL/CollationMetadataProvider.php +++ b/src/Platforms/MySQL/CollationMetadataProvider.php @@ -4,9 +4,7 @@ namespace Doctrine\DBAL\Platforms\MySQL; -/** - * @internal - */ +/** @internal */ interface CollationMetadataProvider { public function getCollationCharset(string $collation): ?string; diff --git a/src/Platforms/MySQL/CollationMetadataProvider/CachingCollationMetadataProvider.php b/src/Platforms/MySQL/CollationMetadataProvider/CachingCollationMetadataProvider.php index e9aeec27cbc..0c99aa31366 100644 --- a/src/Platforms/MySQL/CollationMetadataProvider/CachingCollationMetadataProvider.php +++ b/src/Platforms/MySQL/CollationMetadataProvider/CachingCollationMetadataProvider.php @@ -8,9 +8,7 @@ use function array_key_exists; -/** - * @internal - */ +/** @internal */ final class CachingCollationMetadataProvider implements CollationMetadataProvider { /** @var array */ diff --git a/src/Platforms/MySQL/CollationMetadataProvider/ConnectionCollationMetadataProvider.php b/src/Platforms/MySQL/CollationMetadataProvider/ConnectionCollationMetadataProvider.php index b113993e081..fcd9995621f 100644 --- a/src/Platforms/MySQL/CollationMetadataProvider/ConnectionCollationMetadataProvider.php +++ b/src/Platforms/MySQL/CollationMetadataProvider/ConnectionCollationMetadataProvider.php @@ -8,18 +8,14 @@ use Doctrine\DBAL\Exception; use Doctrine\DBAL\Platforms\MySQL\CollationMetadataProvider; -/** - * @internal - */ +/** @internal */ final class ConnectionCollationMetadataProvider implements CollationMetadataProvider { public function __construct(private readonly Connection $connection) { } - /** - * @throws Exception - */ + /** @throws Exception */ public function getCollationCharset(string $collation): ?string { $charset = $this->connection->fetchOne( @@ -29,7 +25,7 @@ public function getCollationCharset(string $collation): ?string WHERE COLLATION_NAME = ?; SQL , - [$collation] + [$collation], ); if ($charset !== false) { diff --git a/src/Platforms/MySQL/Comparator.php b/src/Platforms/MySQL/Comparator.php index c6f2fcbd801..f5c87b6d741 100644 --- a/src/Platforms/MySQL/Comparator.php +++ b/src/Platforms/MySQL/Comparator.php @@ -20,14 +20,12 @@ */ class Comparator extends BaseComparator { - /** - * @internal The comparator can be only instantiated by a schema manager. - */ + /** @internal The comparator can be only instantiated by a schema manager. */ public function __construct( AbstractMySQLPlatform $platform, private readonly CharsetMetadataProvider $charsetMetadataProvider, private readonly CollationMetadataProvider $collationMetadataProvider, - private readonly DefaultTableOptions $defaultTableOptions + private readonly DefaultTableOptions $defaultTableOptions, ) { parent::__construct($platform); } @@ -36,7 +34,7 @@ public function diffTable(Table $fromTable, Table $toTable): ?TableDiff { return parent::diffTable( $this->normalizeTable($fromTable), - $this->normalizeTable($toTable) + $this->normalizeTable($toTable), ); } diff --git a/src/Platforms/MySQL/DefaultTableOptions.php b/src/Platforms/MySQL/DefaultTableOptions.php index 7f5d5f79e86..ede3ba23bbf 100644 --- a/src/Platforms/MySQL/DefaultTableOptions.php +++ b/src/Platforms/MySQL/DefaultTableOptions.php @@ -4,9 +4,7 @@ namespace Doctrine\DBAL\Platforms\MySQL; -/** - * @internal - */ +/** @internal */ final class DefaultTableOptions { public function __construct(private readonly string $charset, private readonly string $collation) diff --git a/src/Platforms/OraclePlatform.php b/src/Platforms/OraclePlatform.php index 0a04ff3bfad..471d65248aa 100644 --- a/src/Platforms/OraclePlatform.php +++ b/src/Platforms/OraclePlatform.php @@ -54,7 +54,7 @@ protected function getDateArithmeticIntervalExpression( string $date, string $operator, string $interval, - DateIntervalUnit $unit + DateIntervalUnit $unit, ): string { switch ($unit) { case DateIntervalUnit::MONTH: @@ -291,22 +291,18 @@ public function getClobTypeDeclarationSQL(array $column): string return 'CLOB'; } - /** - * @internal The method should be only used from within the {@see AbstractSchemaManager} class hierarchy. - */ + /** @internal The method should be only used from within the {@see AbstractSchemaManager} class hierarchy. */ public function getListDatabasesSQL(): string { return 'SELECT username FROM all_users'; } - /** - * @internal The method should be only used from within the {@see AbstractSchemaManager} class hierarchy. - */ + /** @internal The method should be only used from within the {@see AbstractSchemaManager} class hierarchy. */ public function getListSequencesSQL(string $database): string { return 'SELECT SEQUENCE_NAME, MIN_VALUE, INCREMENT_BY FROM SYS.ALL_SEQUENCES WHERE SEQUENCE_OWNER = ' . $this->quoteStringLiteral( - $this->normalizeIdentifier($database)->getName() + $this->normalizeIdentifier($database)->getName(), ); } @@ -340,17 +336,13 @@ protected function _getCreateTableSQL(string $name, array $columns, array $optio return $sql; } - /** - * @internal The method should be only used from within the {@see AbstractSchemaManager} class hierarchy. - */ + /** @internal The method should be only used from within the {@see AbstractSchemaManager} class hierarchy. */ public function getListViewsSQL(string $database): string { return 'SELECT view_name, text FROM sys.user_views'; } - /** - * @return array - */ + /** @return array */ protected function getCreateAutoincrementSql(string $name, string $table, int $start = 1): array { $tableIdentifier = $this->normalizeIdentifier($table); @@ -380,7 +372,7 @@ protected function getCreateAutoincrementSql(string $name, string $table, int $s END;"; $sequenceName = $this->getIdentitySequenceName( - $tableIdentifier->isQuoted() ? $quotedTableName : $unquotedTableName + $tableIdentifier->isQuoted() ? $quotedTableName : $unquotedTableName, ); $sequence = new Sequence($sequenceName, $start); $sql[] = $this->getCreateSequenceSQL($sequence); @@ -424,7 +416,7 @@ public function getDropAutoincrementSql(string $table): array $table = $this->normalizeIdentifier($table); $autoincrementIdentifierName = $this->getAutoincrementIdentifierName($table); $identitySequenceName = $this->getIdentitySequenceName( - $table->isQuoted() ? $table->getQuotedName($this) : $table->getName() + $table->isQuoted() ? $table->getQuotedName($this) : $table->getName(), ); return [ @@ -485,9 +477,7 @@ public function getDropForeignKeySQL(string $foreignKey, string $table): string return $this->getDropConstraintSQL($foreignKey, $table); } - /** - * @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. - */ + /** @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. */ public function getAdvancedForeignKeyOptionsSQL(ForeignKeyConstraint $foreignKey): string { $referentialAction = ''; @@ -503,9 +493,7 @@ public function getAdvancedForeignKeyOptionsSQL(ForeignKeyConstraint $foreignKey return ''; } - /** - * @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. - */ + /** @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. */ public function getForeignKeyReferentialActionSQL(string $action): string { $action = strtoupper($action); @@ -555,7 +543,7 @@ public function getAlterTableSQL(TableDiff $diff): array $commentsSQL[] = $this->getCommentOnColumnSQL( $diff->getName($this)->getQuotedName($this), $column->getQuotedName($this), - $comment + $comment, ); } @@ -592,7 +580,7 @@ public function getAlterTableSQL(TableDiff $diff): array $commentsSQL[] = $this->getCommentOnColumnSQL( $diff->getName($this)->getQuotedName($this), $column->getQuotedName($this), - $column->getComment() + $column->getComment(), ); } @@ -637,14 +625,14 @@ public function getAlterTableSQL(TableDiff $diff): array $sql[] = sprintf( 'ALTER TABLE %s RENAME TO %s', $diff->getName($this)->getQuotedName($this), - $newName->getQuotedName($this) + $newName->getQuotedName($this), ); } $sql = array_merge( $this->getPreAlterTableIndexForeignKeySQL($diff), $sql, - $this->getPostAlterTableIndexForeignKeySQL($diff) + $this->getPostAlterTableIndexForeignKeySQL($diff), ); } @@ -710,9 +698,7 @@ protected function getIdentitySequenceName(string $tableName): string return $identitySequenceIdentifier->getQuotedName($this); } - /** - * @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. - */ + /** @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. */ public function supportsCommentOnStatement(): bool { return true; diff --git a/src/Platforms/PostgreSQLPlatform.php b/src/Platforms/PostgreSQLPlatform.php index c60774f3b84..15063665af6 100644 --- a/src/Platforms/PostgreSQLPlatform.php +++ b/src/Platforms/PostgreSQLPlatform.php @@ -95,7 +95,7 @@ protected function getDateArithmeticIntervalExpression( string $date, string $operator, string $interval, - DateIntervalUnit $unit + DateIntervalUnit $unit, ): string { if ($unit === DateIntervalUnit::QUARTER) { $interval = $this->multiplyInterval($interval, 3); @@ -130,33 +130,25 @@ public function supportsIdentityColumns(): bool return true; } - /** - * @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. - */ + /** @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. */ public function supportsPartialIndexes(): bool { return true; } - /** - * @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. - */ + /** @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. */ public function supportsCommentOnStatement(): bool { return true; } - /** - * @internal The method should be only used from within the {@see AbstractSchemaManager} class hierarchy. - */ + /** @internal The method should be only used from within the {@see AbstractSchemaManager} class hierarchy. */ public function getListDatabasesSQL(): string { return 'SELECT datname FROM pg_database'; } - /** - * @internal The method should be only used from within the {@see AbstractSchemaManager} class hierarchy. - */ + /** @internal The method should be only used from within the {@see AbstractSchemaManager} class hierarchy. */ public function getListSequencesSQL(string $database): string { return 'SELECT sequence_name AS relname, @@ -169,9 +161,7 @@ public function getListSequencesSQL(string $database): string AND sequence_schema != 'information_schema'"; } - /** - * @internal The method should be only used from within the {@see AbstractSchemaManager} class hierarchy. - */ + /** @internal The method should be only used from within the {@see AbstractSchemaManager} class hierarchy. */ public function getListViewsSQL(string $database): string { return 'SELECT quote_ident(table_name) AS viewname, @@ -199,13 +189,11 @@ private function getTableWhereClause(string $table, string $classAlias = 'c', st $classAlias, $table, $namespaceAlias, - $schema + $schema, ); } - /** - * @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. - */ + /** @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. */ public function getAdvancedForeignKeyOptionsSQL(ForeignKeyConstraint $foreignKey): string { $query = ''; @@ -259,7 +247,7 @@ public function getAlterTableSQL(TableDiff $diff): array $commentsSQL[] = $this->getCommentOnColumnSQL( $diff->getName($this)->getQuotedName($this), $column->getQuotedName($this), - $comment + $comment, ); } @@ -335,7 +323,7 @@ public function getAlterTableSQL(TableDiff $diff): array $commentsSQL[] = $this->getCommentOnColumnSQL( $diff->getName($this)->getQuotedName($this), $column->getQuotedName($this), - $newComment + $newComment, ); } @@ -370,14 +358,14 @@ public function getAlterTableSQL(TableDiff $diff): array $sql[] = sprintf( 'ALTER TABLE %s RENAME TO %s', $diff->getName($this)->getQuotedName($this), - $newName->getQuotedName($this) + $newName->getQuotedName($this), ); } $sql = array_merge( $this->getPreAlterTableIndexForeignKeySQL($diff), $sql, - $this->getPostAlterTableIndexForeignKeySQL($diff) + $this->getPostAlterTableIndexForeignKeySQL($diff), ); } @@ -537,7 +525,7 @@ private function convertSingleBooleanValue(mixed $value, callable $callback): mi throw new UnexpectedValueException(sprintf( 'Unrecognized boolean literal, %s given.', - $value + $value, )); } @@ -577,16 +565,14 @@ public function convertBooleans(mixed $item): mixed return $this->doConvertBooleans( $item, - /** - * @param mixed $value - */ + /** @param mixed $value */ static function ($value): string { if ($value === null) { return 'NULL'; } return $value === true ? 'true' : 'false'; - } + }, ); } @@ -598,12 +584,10 @@ public function convertBooleansToDatabaseValue(mixed $item): mixed return $this->doConvertBooleans( $item, - /** - * @param mixed $value - */ + /** @param mixed $value */ static function ($value): ?int { return $value === null ? null : (int) $value; - } + }, ); } @@ -841,17 +825,13 @@ public function getDefaultValueDeclarationSQL(array $column): string return parent::getDefaultValueDeclarationSQL($column); } - /** - * @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. - */ + /** @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. */ public function supportsColumnCollation(): bool { return true; } - /** - * @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. - */ + /** @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. */ public function getColumnCollationDeclarationSQL(string $collation): string { return 'COLLATE ' . $this->quoteSingleIdentifier($collation); diff --git a/src/Platforms/SQLServer/Comparator.php b/src/Platforms/SQLServer/Comparator.php index d8b69fb0289..3165b1e8be7 100644 --- a/src/Platforms/SQLServer/Comparator.php +++ b/src/Platforms/SQLServer/Comparator.php @@ -16,9 +16,7 @@ */ class Comparator extends BaseComparator { - /** - * @internal The comparator can be only instantiated by a schema manager. - */ + /** @internal The comparator can be only instantiated by a schema manager. */ public function __construct(SQLServerPlatform $platform, private readonly string $databaseCollation) { parent::__construct($platform); diff --git a/src/Platforms/SQLServerPlatform.php b/src/Platforms/SQLServerPlatform.php index baccc877b64..d63281de5b4 100644 --- a/src/Platforms/SQLServerPlatform.php +++ b/src/Platforms/SQLServerPlatform.php @@ -71,7 +71,7 @@ protected function getDateArithmeticIntervalExpression( string $date, string $operator, string $interval, - DateIntervalUnit $unit + DateIntervalUnit $unit, ): string { $factorClause = ''; @@ -107,9 +107,7 @@ public function supportsSchemas(): bool return true; } - /** - * @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. - */ + /** @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. */ public function supportsColumnCollation(): bool { return true; @@ -134,9 +132,7 @@ public function getCreateSequenceSQL(Sequence $sequence): string ' MINVALUE ' . $sequence->getInitialValue(); } - /** - * @internal The method should be only used from within the {@see AbstractSchemaManager} class hierarchy. - */ + /** @internal The method should be only used from within the {@see AbstractSchemaManager} class hierarchy. */ public function getListSequencesSQL(string $database): string { return 'SELECT seq.name, @@ -286,7 +282,7 @@ protected function getCreateColumnCommentSQL(string $tableName, string $columnNa 'TABLE', $tableSQL, 'COLUMN', - $columnName + $columnName, ); } @@ -387,7 +383,7 @@ public function getAlterTableSQL(TableDiff $diff): array $commentsSql[] = $this->getCreateColumnCommentSQL( $diff->name, $column->getQuotedName($this), - $comment + $comment, ); } @@ -466,7 +462,7 @@ public function getAlterTableSQL(TableDiff $diff): array $queryParts[] = $this->getAlterTableDropDefaultConstraintClause( $diff->name, - $fromColumnName->getQuotedName($this) + $fromColumnName->getQuotedName($this), ); $queryParts[] = $this->getAlterTableAddDefaultConstraintClause($diff->name, $column); } @@ -509,7 +505,7 @@ public function getAlterTableSQL(TableDiff $diff): array $sql = array_merge( $this->getPreAlterTableIndexForeignKeySQL($diff), $sql, - $this->getPostAlterTableIndexForeignKeySQL($diff) + $this->getPostAlterTableIndexForeignKeySQL($diff), ); return array_merge($sql, $tableSql, $columnSql); @@ -601,7 +597,7 @@ protected function getAlterColumnCommentSQL(string $tableName, string $columnNam 'TABLE', $tableSQL, 'COLUMN', - $columnName + $columnName, ); } @@ -637,7 +633,7 @@ protected function getDropColumnCommentSQL(string $tableName, string $columnName 'TABLE', $tableSQL, 'COLUMN', - $columnName + $columnName, ); } @@ -650,7 +646,7 @@ protected function getRenameIndexSQL(string $oldIndexName, Index $index, string "EXEC sp_rename N'%s.%s', N'%s', N'INDEX'", $tableName, $oldIndexName, - $index->getQuotedName($this) + $index->getQuotedName($this), ), ]; } @@ -677,7 +673,7 @@ protected function getAddExtendedPropertySQL( ?string $level1Type = null, ?string $level1Name = null, ?string $level2Type = null, - ?string $level2Name = null + ?string $level2Name = null, ): string { return 'EXEC sp_addextendedproperty ' . 'N' . $this->quoteStringLiteral($name) . ', N' . $this->quoteStringLiteral((string) $value) . ', ' . @@ -706,7 +702,7 @@ protected function getDropExtendedPropertySQL( ?string $level1Type = null, ?string $level1Name = null, ?string $level2Type = null, - ?string $level2Name = null + ?string $level2Name = null, ): string { return 'EXEC sp_dropextendedproperty ' . 'N' . $this->quoteStringLiteral($name) . ', ' . @@ -737,7 +733,7 @@ protected function getUpdateExtendedPropertySQL( ?string $level1Type = null, ?string $level1Name = null, ?string $level2Type = null, - ?string $level2Name = null + ?string $level2Name = null, ): string { return 'EXEC sp_updateextendedproperty ' . 'N' . $this->quoteStringLiteral($name) . ', N' . $this->quoteStringLiteral((string) $value) . ', ' . @@ -751,9 +747,7 @@ public function getEmptyIdentityInsertSQL(string $quotedTableName, string $quote return 'INSERT INTO ' . $quotedTableName . ' DEFAULT VALUES'; } - /** - * @internal The method should be only used from within the {@see AbstractSchemaManager} class hierarchy. - */ + /** @internal The method should be only used from within the {@see AbstractSchemaManager} class hierarchy. */ public function getListViewsSQL(string $database): string { return "SELECT name, definition FROM sysobjects @@ -827,9 +821,7 @@ public function getConcatExpression(string ...$string): string return sprintf('CONCAT(%s)', implode(', ', $string)); } - /** - * @internal The method should be only used from within the {@see AbstractSchemaManager} class hierarchy. - */ + /** @internal The method should be only used from within the {@see AbstractSchemaManager} class hierarchy. */ public function getListDatabasesSQL(): string { return 'SELECT * FROM sys.databases'; @@ -1114,9 +1106,7 @@ public function rollbackSavePoint(string $savepoint): string return 'ROLLBACK TRANSACTION ' . $savepoint; } - /** - * @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. - */ + /** @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. */ public function getForeignKeyReferentialActionSQL(string $action): string { // RESTRICT is not supported, therefore falling back to NO ACTION. @@ -1243,7 +1233,7 @@ protected function getCommentOnTableSQL(string $tableName, string $comment): str SQL , $this->quoteStringLiteral($comment), - $this->quoteStringLiteral($tableName) + $this->quoteStringLiteral($tableName), ); } diff --git a/src/Platforms/SQLite/Comparator.php b/src/Platforms/SQLite/Comparator.php index 320a0ade712..2d2a940397e 100644 --- a/src/Platforms/SQLite/Comparator.php +++ b/src/Platforms/SQLite/Comparator.php @@ -18,9 +18,7 @@ */ class Comparator extends BaseComparator { - /** - * @internal The comparator can be only instantiated by a schema manager. - */ + /** @internal The comparator can be only instantiated by a schema manager. */ public function __construct(SQLitePlatform $platform) { parent::__construct($platform); diff --git a/src/Platforms/SQLitePlatform.php b/src/Platforms/SQLitePlatform.php index 7207406cf42..55dfeca2953 100644 --- a/src/Platforms/SQLitePlatform.php +++ b/src/Platforms/SQLitePlatform.php @@ -38,17 +38,13 @@ */ class SQLitePlatform extends AbstractPlatform { - /** - * @throws NotSupported - */ + /** @throws NotSupported */ public function getCreateDatabaseSQL(string $name): string { throw NotSupported::new(__METHOD__); } - /** - * @throws NotSupported - */ + /** @throws NotSupported */ public function getDropDatabaseSQL(string $name): string { throw NotSupported::new(__METHOD__); @@ -99,7 +95,7 @@ protected function getDateArithmeticIntervalExpression( string $date, string $operator, string $interval, - DateIntervalUnit $unit + DateIntervalUnit $unit, ): string { switch ($unit) { case DateIntervalUnit::WEEK: @@ -116,7 +112,7 @@ protected function getDateArithmeticIntervalExpression( return 'DATETIME(' . $date . ',' . $this->getConcatExpression( $this->quoteStringLiteral($operator), $interval, - $this->quoteStringLiteral(' ' . $unit->value) + $this->quoteStringLiteral(' ' . $unit->value), ) . ')'; } @@ -233,9 +229,7 @@ protected function _getCommonIntegerTypeDeclarationSQL(array $column): string return ! empty($column['unsigned']) ? ' UNSIGNED' : ''; } - /** - * @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. - */ + /** @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. */ public function getForeignKeyDeclarationSQL(ForeignKeyConstraint $foreignKey): string { return parent::getForeignKeyDeclarationSQL(new ForeignKeyConstraint( @@ -243,7 +237,7 @@ public function getForeignKeyDeclarationSQL(ForeignKeyConstraint $foreignKey): s $foreignKey->getQuotedForeignTableName($this), $foreignKey->getQuotedForeignColumns($this), $foreignKey->getName(), - $foreignKey->getOptions() + $foreignKey->getOptions(), )); } @@ -350,17 +344,13 @@ public function getClobTypeDeclarationSQL(array $column): string return 'CLOB'; } - /** - * @internal The method should be only used from within the {@see AbstractSchemaManager} class hierarchy. - */ + /** @internal The method should be only used from within the {@see AbstractSchemaManager} class hierarchy. */ public function getListViewsSQL(string $database): string { return "SELECT name, sql FROM sqlite_master WHERE type='view' AND sql NOT NULL"; } - /** - * @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. - */ + /** @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. */ public function getAdvancedForeignKeyOptionsSQL(ForeignKeyConstraint $foreignKey): string { $query = parent::getAdvancedForeignKeyOptionsSQL($foreignKey); @@ -386,17 +376,13 @@ public function supportsIdentityColumns(): bool return true; } - /** - * @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. - */ + /** @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. */ public function supportsColumnCollation(): bool { return true; } - /** - * @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. - */ + /** @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. */ public function supportsInlineColumnComments(): bool { return true; @@ -414,9 +400,7 @@ public function getForUpdateSQL(): string return ''; } - /** - * @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. - */ + /** @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy. */ public function getInlineColumnCommentSQL(string $comment): string { if ($comment === '') { @@ -492,7 +476,7 @@ protected function getPostAlterTableIndexForeignKeySQL(TableDiff $diff): array if ($fromTable === null) { throw new Exception( - 'Sqlite platform requires for alter table the table diff with reference to original table schema.' + 'Sqlite platform requires for alter table the table diff with reference to original table schema.', ); } @@ -592,7 +576,7 @@ public function getAlterTableSQL(TableDiff $diff): array $fromTable = $diff->fromTable; if ($fromTable === null) { throw new Exception( - 'Sqlite platform requires for alter table the table diff with reference to original table schema.' + 'Sqlite platform requires for alter table the table diff with reference to original table schema.', ); } @@ -620,7 +604,7 @@ public function getAlterTableSQL(TableDiff $diff): array unset( $columns[$columnName], $oldColumnNames[$columnName], - $newColumnNames[$columnName] + $newColumnNames[$columnName], ); } @@ -674,7 +658,7 @@ public function getAlterTableSQL(TableDiff $diff): array $this->getPrimaryIndexInAlteredTable($diff, $fromTable), [], $this->getForeignKeysInAlteredTable($diff, $fromTable), - $fromTable->getOptions() + $fromTable->getOptions(), ); $newTable->addOption('alter', true); @@ -685,7 +669,7 @@ public function getAlterTableSQL(TableDiff $diff): array 'CREATE TEMPORARY TABLE %s AS SELECT %s FROM %s', $dataTable->getQuotedName($this), implode(', ', $oldColumnNames), - $fromTable->getQuotedName($this) + $fromTable->getQuotedName($this), ); $sql[] = $this->getDropTableSQL($fromTable->getQuotedName($this)); @@ -695,7 +679,7 @@ public function getAlterTableSQL(TableDiff $diff): array $newTable->getQuotedName($this), implode(', ', $newColumnNames), implode(', ', $oldColumnNames), - $dataTable->getQuotedName($this) + $dataTable->getQuotedName($this), ); $sql[] = $this->getDropTableSQL($dataTable->getQuotedName($this)); @@ -705,7 +689,7 @@ public function getAlterTableSQL(TableDiff $diff): array $sql[] = sprintf( 'ALTER TABLE %s RENAME TO %s', $newTable->getQuotedName($this), - $newName->getQuotedName($this) + $newName->getQuotedName($this), ); } @@ -832,9 +816,7 @@ private function getSimpleAlterTableSQL(TableDiff $diff): array|false return array_merge($sql, $tableSql, $columnSql); } - /** - * @return string[] - */ + /** @return string[] */ private function getColumnNamesInAlteredTable(TableDiff $diff, Table $fromTable): array { $columns = []; @@ -873,9 +855,7 @@ private function getColumnNamesInAlteredTable(TableDiff $diff, Table $fromTable) return $columns; } - /** - * @return Index[] - */ + /** @return Index[] */ private function getIndexesInAlteredTable(TableDiff $diff, Table $fromTable): array { $indexes = $fromTable->getIndexes(); @@ -916,7 +896,7 @@ private function getIndexesInAlteredTable(TableDiff $diff, Table $fromTable): ar $indexColumns, $index->isUnique(), $index->isPrimary(), - $index->getFlags() + $index->getFlags(), ); } @@ -943,9 +923,7 @@ private function getIndexesInAlteredTable(TableDiff $diff, Table $fromTable): ar return $indexes; } - /** - * @return ForeignKeyConstraint[] - */ + /** @return ForeignKeyConstraint[] */ private function getForeignKeysInAlteredTable(TableDiff $diff, Table $fromTable): array { $foreignKeys = $fromTable->getForeignKeys(); @@ -978,7 +956,7 @@ private function getForeignKeysInAlteredTable(TableDiff $diff, Table $fromTable) $constraint->getForeignTableName(), $constraint->getForeignColumns(), $constraint->getName(), - $constraint->getOptions() + $constraint->getOptions(), ); } @@ -1005,9 +983,7 @@ private function getForeignKeysInAlteredTable(TableDiff $diff, Table $fromTable) return $foreignKeys; } - /** - * @return Index[] - */ + /** @return Index[] */ private function getPrimaryIndexInAlteredTable(TableDiff $diff, Table $fromTable): array { $primaryIndex = []; diff --git a/src/Portability/Connection.php b/src/Portability/Connection.php index 4f873906be4..4a821d83004 100644 --- a/src/Portability/Connection.php +++ b/src/Portability/Connection.php @@ -27,7 +27,7 @@ public function prepare(string $sql): Statement { return new Statement( parent::prepare($sql), - $this->converter + $this->converter, ); } @@ -35,7 +35,7 @@ public function query(string $sql): Result { return new Result( parent::query($sql), - $this->converter + $this->converter, ); } } diff --git a/src/Portability/Driver.php b/src/Portability/Driver.php index 831fd4a514f..884d2acc177 100644 --- a/src/Portability/Driver.php +++ b/src/Portability/Driver.php @@ -29,7 +29,7 @@ public function connect(array $params): ConnectionInterface $portability = (new OptimizeFlags())( $this->getDatabasePlatform($connection), - $this->mode + $this->mode, ); $case = null; @@ -57,7 +57,7 @@ public function connect(array $params): ConnectionInterface return new Connection( $connection, - new Converter($convertEmptyStringToNull, $rightTrimString, $case) + new Converter($convertEmptyStringToNull, $rightTrimString, $case), ); } } diff --git a/src/Portability/Result.php b/src/Portability/Result.php index 03bf692b267..d158683c1dc 100644 --- a/src/Portability/Result.php +++ b/src/Portability/Result.php @@ -9,9 +9,7 @@ final class Result extends AbstractResultMiddleware { - /** - * @internal The result can be only instantiated by the portability connection or statement. - */ + /** @internal The result can be only instantiated by the portability connection or statement. */ public function __construct(ResultInterface $result, private readonly Converter $converter) { parent::__construct($result); @@ -20,21 +18,21 @@ public function __construct(ResultInterface $result, private readonly Converter public function fetchNumeric(): array|false { return $this->converter->convertNumeric( - parent::fetchNumeric() + parent::fetchNumeric(), ); } public function fetchAssociative(): array|false { return $this->converter->convertAssociative( - parent::fetchAssociative() + parent::fetchAssociative(), ); } public function fetchOne(): mixed { return $this->converter->convertOne( - parent::fetchOne() + parent::fetchOne(), ); } @@ -44,7 +42,7 @@ public function fetchOne(): mixed public function fetchAllNumeric(): array { return $this->converter->convertAllNumeric( - parent::fetchAllNumeric() + parent::fetchAllNumeric(), ); } @@ -54,7 +52,7 @@ public function fetchAllNumeric(): array public function fetchAllAssociative(): array { return $this->converter->convertAllAssociative( - parent::fetchAllAssociative() + parent::fetchAllAssociative(), ); } @@ -64,7 +62,7 @@ public function fetchAllAssociative(): array public function fetchFirstColumn(): array { return $this->converter->convertFirstColumn( - parent::fetchFirstColumn() + parent::fetchFirstColumn(), ); } } diff --git a/src/Portability/Statement.php b/src/Portability/Statement.php index 3d005891df4..de0c76fc450 100644 --- a/src/Portability/Statement.php +++ b/src/Portability/Statement.php @@ -25,7 +25,7 @@ public function execute(): ResultInterface { return new Result( parent::execute(), - $this->converter + $this->converter, ); } } diff --git a/src/Query.php b/src/Query.php index 8caae6ef57b..ee89fbdb35f 100644 --- a/src/Query.php +++ b/src/Query.php @@ -22,7 +22,7 @@ final class Query public function __construct( private readonly string $sql, private readonly array $params, - private readonly array $types + private readonly array $types, ) { } @@ -31,17 +31,13 @@ public function getSQL(): string return $this->sql; } - /** - * @return array - */ + /** @return array */ public function getParams(): array { return $this->params; } - /** - * @return array - */ + /** @return array */ public function getTypes(): array { return $this->types; diff --git a/src/Query/Exception/NonUniqueAlias.php b/src/Query/Exception/NonUniqueAlias.php index 6deca800b0e..8aab6026f3e 100644 --- a/src/Query/Exception/NonUniqueAlias.php +++ b/src/Query/Exception/NonUniqueAlias.php @@ -9,14 +9,10 @@ use function implode; use function sprintf; -/** - * @psalm-immutable - */ +/** @psalm-immutable */ final class NonUniqueAlias extends QueryException { - /** - * @param string[] $registeredAliases - */ + /** @param string[] $registeredAliases */ public static function new(string $alias, array $registeredAliases): self { return new self( @@ -24,8 +20,8 @@ public static function new(string $alias, array $registeredAliases): self 'The given alias "%s" is not unique in FROM and JOIN clause table. ' . 'The currently registered aliases are: %s.', $alias, - implode(', ', $registeredAliases) - ) + implode(', ', $registeredAliases), + ), ); } } diff --git a/src/Query/Exception/UnknownAlias.php b/src/Query/Exception/UnknownAlias.php index 512884eb22b..7b08d512299 100644 --- a/src/Query/Exception/UnknownAlias.php +++ b/src/Query/Exception/UnknownAlias.php @@ -9,14 +9,10 @@ use function implode; use function sprintf; -/** - * @psalm-immutable - */ +/** @psalm-immutable */ final class UnknownAlias extends QueryException { - /** - * @param string[] $registeredAliases - */ + /** @param string[] $registeredAliases */ public static function new(string $alias, array $registeredAliases): self { return new self( @@ -24,8 +20,8 @@ public static function new(string $alias, array $registeredAliases): self 'The given alias "%s" is not part of any FROM or JOIN clause table. ' . 'The currently registered aliases are: %s.', $alias, - implode(', ', $registeredAliases) - ) + implode(', ', $registeredAliases), + ), ); } } diff --git a/src/Query/Expression/CompositeExpression.php b/src/Query/Expression/CompositeExpression.php index e3c00dea04c..22c59b6bfcf 100644 --- a/src/Query/Expression/CompositeExpression.php +++ b/src/Query/Expression/CompositeExpression.php @@ -35,13 +35,11 @@ class CompositeExpression implements Countable */ private array $parts; - /** - * @internal Use the and() / or() factory methods. - */ + /** @internal Use the and() / or() factory methods. */ public function __construct( private readonly string $type, self|string $part, - self|string ...$parts + self|string ...$parts, ) { $this->parts = array_merge([$part], array_values($parts)); } diff --git a/src/Query/Expression/ExpressionBuilder.php b/src/Query/Expression/ExpressionBuilder.php index 44363f430c7..14942b2f975 100644 --- a/src/Query/Expression/ExpressionBuilder.php +++ b/src/Query/Expression/ExpressionBuilder.php @@ -35,7 +35,7 @@ public function __construct(private readonly Connection $connection) */ public function and( string|CompositeExpression $expression, - string|CompositeExpression ...$expressions + string|CompositeExpression ...$expressions, ): CompositeExpression { return CompositeExpression::and($expression, ...$expressions); } @@ -45,7 +45,7 @@ public function and( */ public function or( string|CompositeExpression $expression, - string|CompositeExpression ...$expressions + string|CompositeExpression ...$expressions, ): CompositeExpression { return CompositeExpression::or($expression, ...$expressions); } diff --git a/src/Query/From.php b/src/Query/From.php index 86088350088..71ff50dfb0a 100644 --- a/src/Query/From.php +++ b/src/Query/From.php @@ -4,9 +4,7 @@ namespace Doctrine\DBAL\Query; -/** - * @internal - */ +/** @internal */ final class From { public function __construct( diff --git a/src/Query/Join.php b/src/Query/Join.php index 8264c3dcf10..df0e2ed9eb1 100644 --- a/src/Query/Join.php +++ b/src/Query/Join.php @@ -4,9 +4,7 @@ namespace Doctrine\DBAL\Query; -/** - * @internal - */ +/** @internal */ final class Join { private function __construct( diff --git a/src/Query/QueryBuilder.php b/src/Query/QueryBuilder.php index 110b030d0c4..ff34f51ce9f 100644 --- a/src/Query/QueryBuilder.php +++ b/src/Query/QueryBuilder.php @@ -300,7 +300,7 @@ public function executeQuery(): Result $this->getSQL(), $this->params, $this->types, - $this->resultCacheProfile + $this->resultCacheProfile, ); } @@ -362,7 +362,7 @@ public function getSQL(): string public function setParameter( int|string $key, mixed $value, - string|ParameterType|Type $type = ParameterType::STRING + string|ParameterType|Type $type = ParameterType::STRING, ): self { $this->params[$key] = $value; $this->types[$key] = $type; @@ -863,7 +863,7 @@ public function andWhere(string|CompositeExpression $predicate, string|Composite $this->where, CompositeExpression::TYPE_AND, $predicate, - ...$predicates + ...$predicates, ); $this->sql = null; @@ -1036,7 +1036,7 @@ public function andHaving(string|CompositeExpression $predicate, string|Composit $this->having, CompositeExpression::TYPE_AND, $predicate, - ...$predicates + ...$predicates, ); $this->sql = null; @@ -1059,7 +1059,7 @@ public function orHaving(string|CompositeExpression $predicate, string|Composite $this->having, CompositeExpression::TYPE_OR, $predicate, - ...$predicates + ...$predicates, ); $this->sql = null; @@ -1072,7 +1072,7 @@ public function orHaving(string|CompositeExpression $predicate, string|Composite */ private function createPredicate( string|CompositeExpression $predicate, - string|CompositeExpression ...$predicates + string|CompositeExpression ...$predicates, ): string|CompositeExpression { if (count($predicates) === 0) { return $predicate; @@ -1087,7 +1087,7 @@ private function createPredicate( private function appendToPredicate( string|CompositeExpression|null $currentPredicate, string $type, - string|CompositeExpression ...$predicates + string|CompositeExpression ...$predicates, ): string|CompositeExpression { if ($currentPredicate instanceof CompositeExpression && $currentPredicate->getType() === $type) { return $currentPredicate->with(...$predicates); @@ -1149,9 +1149,7 @@ public function addOrderBy(string $sort, ?string $order = null): self return $this; } - /** - * @throws QueryException - */ + /** @throws QueryException */ private function getSQLForSelect(): string { if (count($this->select) === 0) { @@ -1190,7 +1188,7 @@ private function getSQLForSelect(): string return $this->connection->getDatabasePlatform()->modifyLimitQuery( $query, $this->maxResults, - $this->firstResult + $this->firstResult, ); } @@ -1322,7 +1320,7 @@ public function __toString(): string public function createNamedParameter( mixed $value, string|ParameterType|Type $type = ParameterType::STRING, - ?string $placeHolder = null + ?string $placeHolder = null, ): string { if ($placeHolder === null) { $this->boundCounter++; @@ -1353,7 +1351,7 @@ public function createNamedParameter( */ public function createPositionalParameter( mixed $value, - string|ParameterType|Type $type = ParameterType::STRING + string|ParameterType|Type $type = ParameterType::STRING, ): string { $this->setParameter($this->boundCounter, $value, $type); $this->boundCounter++; diff --git a/src/Query/QueryException.php b/src/Query/QueryException.php index 491514b3a17..c7d4dad634f 100644 --- a/src/Query/QueryException.php +++ b/src/Query/QueryException.php @@ -6,9 +6,7 @@ use Doctrine\DBAL\Exception; -/** - * @psalm-immutable - */ +/** @psalm-immutable */ class QueryException extends Exception { } diff --git a/src/Query/QueryType.php b/src/Query/QueryType.php index 5544ffd8bd4..632c4959fc9 100644 --- a/src/Query/QueryType.php +++ b/src/Query/QueryType.php @@ -4,9 +4,7 @@ namespace Doctrine\DBAL\Query; -/** - * @internal - */ +/** @internal */ enum QueryType { case SELECT; diff --git a/src/Result.php b/src/Result.php index 01ac5140f8a..259b9399f50 100644 --- a/src/Result.php +++ b/src/Result.php @@ -15,9 +15,7 @@ class Result { - /** - * @internal The result can be only instantiated by {@see Connection} or {@see Statement}. - */ + /** @internal The result can be only instantiated by {@see Connection} or {@see Statement}. */ public function __construct(private readonly DriverResult $result, private readonly Connection $connection) { } @@ -218,9 +216,7 @@ public function iterateColumn(): Traversable } } - /** - * @throws Exception - */ + /** @throws Exception */ public function rowCount(): int { try { @@ -230,9 +226,7 @@ public function rowCount(): int } } - /** - * @throws Exception - */ + /** @throws Exception */ public function columnCount(): int { try { @@ -247,9 +241,7 @@ public function free(): void $this->result->free(); } - /** - * @throws Exception - */ + /** @throws Exception */ private function ensureHasKeyValue(): void { $columnCount = $this->columnCount(); diff --git a/src/SQL/Builder/CreateSchemaObjectsSQLBuilder.php b/src/SQL/Builder/CreateSchemaObjectsSQLBuilder.php index 55cce5d837e..726c7be379e 100644 --- a/src/SQL/Builder/CreateSchemaObjectsSQLBuilder.php +++ b/src/SQL/Builder/CreateSchemaObjectsSQLBuilder.php @@ -28,7 +28,7 @@ public function buildSQL(Schema $schema): array return array_merge( $this->buildNamespaceStatements($schema->getNamespaces()), $this->buildSequenceStatements($schema->getSequences()), - $this->buildTableStatements($schema->getTables()) + $this->buildTableStatements($schema->getTables()), ); } diff --git a/src/Schema/AbstractSchemaManager.php b/src/Schema/AbstractSchemaManager.php index 9eebfa1699c..ded6e20ead9 100644 --- a/src/Schema/AbstractSchemaManager.php +++ b/src/Schema/AbstractSchemaManager.php @@ -31,9 +31,7 @@ */ abstract class AbstractSchemaManager { - /** - * @param T $platform - */ + /** @param T $platform */ public function __construct(protected Connection $connection, protected AbstractPlatform $platform) { } @@ -50,7 +48,7 @@ public function listDatabases(): array return array_map(function (array $row): string { return $this->_getPortableDatabaseDefinition($row); }, $this->connection->fetchAllAssociative( - $this->platform->getListDatabasesSQL() + $this->platform->getListDatabasesSQL(), )); } @@ -80,9 +78,9 @@ public function listSequences(): array return $this->_getPortableSequenceDefinition($row); }, $this->connection->fetchAllAssociative( $this->platform->getListSequencesSQL( - $this->getDatabase(__METHOD__) - ) - )) + $this->getDatabase(__METHOD__), + ), + )), ); } @@ -108,7 +106,7 @@ public function listTableColumns(string $table): array $table, $database, $this->selectTableColumns($database, $this->normalizeName($table)) - ->fetchAllAssociative() + ->fetchAllAssociative(), ); } @@ -129,9 +127,9 @@ public function listTableIndexes(string $table): array return $this->_getPortableTableIndexesList( $this->selectIndexColumns( $database, - $table + $table, )->fetchAllAssociative(), - $table + $table, ); } @@ -167,8 +165,8 @@ public function listTableNames(): array array_map(function (array $row): string { return $this->_getPortableTableDefinition($row); }, $this->selectTableNames( - $this->getDatabase(__METHOD__) - )->fetchAllAssociative()) + $this->getDatabase(__METHOD__), + )->fetchAllAssociative()), ); } @@ -217,7 +215,7 @@ public function listTables(): array $this->_getPortableTableIndexesList($indexColumnsByTable[$tableName] ?? [], $tableName), [], $this->_getPortableTableForeignKeysList($foreignKeyColumnsByTable[$tableName] ?? []), - $tableOptionsByTable[$tableName] ?? [] + $tableOptionsByTable[$tableName] ?? [], ); } @@ -301,7 +299,7 @@ protected function fetchIndexColumnsByTable(string $databaseName): array protected function fetchForeignKeyColumnsByTable(string $databaseName): array { return $this->fetchAllAssociativeGrouped( - $this->selectForeignKeyColumns($databaseName) + $this->selectForeignKeyColumns($databaseName), ); } @@ -334,7 +332,7 @@ public function introspectTable(string $name): Table $this->listTableIndexes($name), [], $this->listTableForeignKeys($name), - $this->getTableOptions($name) + $this->getTableOptions($name), ); } @@ -351,8 +349,8 @@ public function listViews(): array return $this->_getPortableViewDefinition($row); }, $this->connection->fetchAllAssociative( $this->platform->getListViewsSQL( - $this->getDatabase(__METHOD__) - ) + $this->getDatabase(__METHOD__), + ), )); } @@ -370,8 +368,8 @@ public function listTableForeignKeys(string $table): array return $this->_getPortableTableForeignKeysList( $this->selectForeignKeyColumns( $database, - $this->normalizeName($table) - )->fetchAllAssociative() + $this->normalizeName($table), + )->fetchAllAssociative(), ); } @@ -386,7 +384,7 @@ private function getTableOptions(string $name): array return $this->fetchTableOptionsByTable( $this->getDatabase(__METHOD__), - $normalizedName + $normalizedName, )[$normalizedName] ?? []; } @@ -402,7 +400,7 @@ private function getTableOptions(string $name): array public function dropDatabase(string $database): void { $this->connection->executeStatement( - $this->platform->getDropDatabaseSQL($database) + $this->platform->getDropDatabaseSQL($database), ); } @@ -414,7 +412,7 @@ public function dropDatabase(string $database): void public function dropSchema(string $schemaName): void { $this->connection->executeStatement( - $this->platform->getDropSchemaSQL($schemaName) + $this->platform->getDropSchemaSQL($schemaName), ); } @@ -426,7 +424,7 @@ public function dropSchema(string $schemaName): void public function dropTable(string $name): void { $this->connection->executeStatement( - $this->platform->getDropTableSQL($name) + $this->platform->getDropTableSQL($name), ); } @@ -438,7 +436,7 @@ public function dropTable(string $name): void public function dropIndex(string $index, string $table): void { $this->connection->executeStatement( - $this->platform->getDropIndexSQL($index, $table) + $this->platform->getDropIndexSQL($index, $table), ); } @@ -450,7 +448,7 @@ public function dropIndex(string $index, string $table): void public function dropForeignKey(string $name, string $table): void { $this->connection->executeStatement( - $this->platform->getDropForeignKeySQL($name, $table) + $this->platform->getDropForeignKeySQL($name, $table), ); } @@ -462,7 +460,7 @@ public function dropForeignKey(string $name, string $table): void public function dropSequence(string $name): void { $this->connection->executeStatement( - $this->platform->getDropSequenceSQL($name) + $this->platform->getDropSequenceSQL($name), ); } @@ -474,7 +472,7 @@ public function dropSequence(string $name): void public function dropUniqueConstraint(string $name, string $tableName): void { $this->connection->executeStatement( - $this->platform->getDropUniqueConstraintSQL($name, $tableName) + $this->platform->getDropUniqueConstraintSQL($name, $tableName), ); } @@ -486,15 +484,13 @@ public function dropUniqueConstraint(string $name, string $tableName): void public function dropView(string $name): void { $this->connection->executeStatement( - $this->platform->getDropViewSQL($name) + $this->platform->getDropViewSQL($name), ); } /* create*() Methods */ - /** - * @throws Exception - */ + /** @throws Exception */ public function createSchemaObjects(Schema $schema): void { $this->_execSql($schema->toSql($this->platform)); @@ -508,7 +504,7 @@ public function createSchemaObjects(Schema $schema): void public function createDatabase(string $database): void { $this->connection->executeStatement( - $this->platform->getCreateDatabaseSQL($database) + $this->platform->getCreateDatabaseSQL($database), ); } @@ -530,7 +526,7 @@ public function createTable(Table $table): void public function createSequence(Sequence $sequence): void { $this->connection->executeStatement( - $this->platform->getCreateSequenceSQL($sequence) + $this->platform->getCreateSequenceSQL($sequence), ); } @@ -544,7 +540,7 @@ public function createSequence(Sequence $sequence): void public function createIndex(Index $index, string $table): void { $this->connection->executeStatement( - $this->platform->getCreateIndexSQL($index, $table) + $this->platform->getCreateIndexSQL($index, $table), ); } @@ -559,7 +555,7 @@ public function createIndex(Index $index, string $table): void public function createForeignKey(ForeignKeyConstraint $foreignKey, string $table): void { $this->connection->executeStatement( - $this->platform->getCreateForeignKeySQL($foreignKey, $table) + $this->platform->getCreateForeignKeySQL($foreignKey, $table), ); } @@ -571,7 +567,7 @@ public function createForeignKey(ForeignKeyConstraint $foreignKey, string $table public function createUniqueConstraint(UniqueConstraint $uniqueConstraint, string $tableName): void { $this->connection->executeStatement( - $this->platform->getCreateUniqueConstraintSQL($uniqueConstraint, $tableName) + $this->platform->getCreateUniqueConstraintSQL($uniqueConstraint, $tableName), ); } @@ -585,14 +581,12 @@ public function createView(View $view): void $this->connection->executeStatement( $this->platform->getCreateViewSQL( $view->getQuotedName($this->platform), - $view->getSql() - ) + $view->getSql(), + ), ); } - /** - * @throws Exception - */ + /** @throws Exception */ public function dropSchemaObjects(Schema $schema): void { $this->_execSql($schema->toDropSql($this->platform)); @@ -787,7 +781,7 @@ protected function _getPortableTableIndexesList(array $tableIndexes, string $tab $data['unique'], $data['primary'], $data['flags'], - $data['options'] + $data['options'], ); } @@ -801,14 +795,10 @@ protected function _getPortableTableIndexesList(array $tableIndexes, string $tab return $indexes; } - /** - * @param array $table - */ + /** @param array $table */ abstract protected function _getPortableTableDefinition(array $table): string; - /** - * @param array $view - */ + /** @param array $view */ abstract protected function _getPortableViewDefinition(array $view): View; /** @@ -827,9 +817,7 @@ protected function _getPortableTableForeignKeysList(array $tableForeignKeys): ar return $list; } - /** - * @param array $tableForeignKey - */ + /** @param array $tableForeignKey */ abstract protected function _getPortableTableForeignKeyDefinition(array $tableForeignKey): ForeignKeyConstraint; /** @@ -859,7 +847,7 @@ public function createSchema(): Schema 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5613', '%s is deprecated. Use introspectSchema() instead.', - __METHOD__ + __METHOD__, ); $schemaNames = []; @@ -913,9 +901,7 @@ public function createSchemaConfig(): SchemaConfig return $schemaConfig; } - /** - * @throws Exception - */ + /** @throws Exception */ private function getDatabase(string $methodName): string { $database = $this->connection->getDatabase(); diff --git a/src/Schema/Column.php b/src/Schema/Column.php index 9e59b0ff7a9..d48eefc249c 100644 --- a/src/Schema/Column.php +++ b/src/Schema/Column.php @@ -130,9 +130,7 @@ public function setDefault(mixed $default): self return $this; } - /** - * @param array $platformOptions - */ + /** @param array $platformOptions */ public function setPlatformOptions(array $platformOptions): self { $this->_platformOptions = $platformOptions; @@ -194,9 +192,7 @@ public function getDefault(): mixed return $this->_default; } - /** - * @return array - */ + /** @return array */ public function getPlatformOptions(): array { return $this->_platformOptions; @@ -241,9 +237,7 @@ public function getComment(): string return $this->_comment; } - /** - * @return array - */ + /** @return array */ public function toArray(): array { return array_merge([ diff --git a/src/Schema/ColumnDiff.php b/src/Schema/ColumnDiff.php index 1fb1ecd3c5d..635c33ebd5b 100644 --- a/src/Schema/ColumnDiff.php +++ b/src/Schema/ColumnDiff.php @@ -13,14 +13,12 @@ */ class ColumnDiff { - /** - * @param array $changedProperties - */ + /** @param array $changedProperties */ public function __construct( public string $oldColumnName, public Column $column, public array $changedProperties, - public Column $fromColumn + public Column $fromColumn, ) { } @@ -29,16 +27,14 @@ public function hasChanged(string $propertyName): bool return in_array($propertyName, $this->changedProperties, true); } - /** - * @deprecated Use {@see $fromColumn} instead. - */ + /** @deprecated Use {@see $fromColumn} instead. */ public function getOldColumnName(): Identifier { Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5622', '%s is deprecated. Use $fromColumn instead.', - __METHOD__ + __METHOD__, ); return new Identifier($this->oldColumnName, $this->fromColumn->isQuoted()); diff --git a/src/Schema/Comparator.php b/src/Schema/Comparator.php index 598d455907c..ab238f419ec 100644 --- a/src/Schema/Comparator.php +++ b/src/Schema/Comparator.php @@ -21,9 +21,7 @@ */ class Comparator { - /** - * @internal The comparator can be only instantiated by a schema manager. - */ + /** @internal The comparator can be only instantiated by a schema manager. */ public function __construct(private readonly AbstractPlatform $platform) { } @@ -67,7 +65,7 @@ public function compareSchemas(Schema $fromSchema, Schema $toSchema): SchemaDiff } else { $tableDifferences = $this->diffTable( $fromSchema->getTable($tableName), - $toSchema->getTable($tableName) + $toSchema->getTable($tableName), ); if ($tableDifferences !== null) { @@ -224,7 +222,7 @@ public function diffTable(Table $fromTable, Table $toTable): ?TableDiff $column->getName(), $toColumn, $this->diffColumn($column, $toColumn), - $column + $column, ); $changes++; @@ -334,7 +332,7 @@ private function detectColumnRenamings(TableDiff $tableDifferences): void $tableDifferences->renamedColumns[$removedColumnName] = $addedColumn; unset( $tableDifferences->addedColumns[$addedColumnName], - $tableDifferences->removedColumns[strtolower($removedColumnName)] + $tableDifferences->removedColumns[strtolower($removedColumnName)], ); } } @@ -379,7 +377,7 @@ private function detectIndexRenamings(TableDiff $tableDifferences): void $tableDifferences->renamedIndexes[$removedIndexName] = $addedIndex; unset( $tableDifferences->addedIndexes[$addedIndexName], - $tableDifferences->removedIndexes[$removedIndexName] + $tableDifferences->removedIndexes[$removedIndexName], ); } } diff --git a/src/Schema/DB2SchemaManager.php b/src/Schema/DB2SchemaManager.php index 9d371d48433..e00678b9973 100644 --- a/src/Schema/DB2SchemaManager.php +++ b/src/Schema/DB2SchemaManager.php @@ -136,7 +136,7 @@ protected function _getPortableTableForeignKeyDefinition(array $tableForeignKey) $tableForeignKey['foreign_table'], $tableForeignKey['foreign_columns'], $tableForeignKey['name'], - $tableForeignKey['options'] + $tableForeignKey['options'], ); } diff --git a/src/Schema/Exception/ColumnAlreadyExists.php b/src/Schema/Exception/ColumnAlreadyExists.php index 5ceb72573b3..cc7acea0397 100644 --- a/src/Schema/Exception/ColumnAlreadyExists.php +++ b/src/Schema/Exception/ColumnAlreadyExists.php @@ -8,16 +8,14 @@ use function sprintf; -/** - * @psalm-immutable - */ +/** @psalm-immutable */ final class ColumnAlreadyExists extends SchemaException { public static function new(string $tableName, string $columnName): self { return new self( sprintf('The column "%s" on table "%s" already exists.', $columnName, $tableName), - self::COLUMN_ALREADY_EXISTS + self::COLUMN_ALREADY_EXISTS, ); } } diff --git a/src/Schema/Exception/ColumnDoesNotExist.php b/src/Schema/Exception/ColumnDoesNotExist.php index 1b530ddce4d..c9036a07ceb 100644 --- a/src/Schema/Exception/ColumnDoesNotExist.php +++ b/src/Schema/Exception/ColumnDoesNotExist.php @@ -8,16 +8,14 @@ use function sprintf; -/** - * @psalm-immutable - */ +/** @psalm-immutable */ final class ColumnDoesNotExist extends SchemaException { public static function new(string $columnName, string $table): self { return new self( sprintf('There is no column with name "%s" on table "%s".', $columnName, $table), - self::COLUMN_DOESNT_EXIST + self::COLUMN_DOESNT_EXIST, ); } } diff --git a/src/Schema/Exception/ForeignKeyDoesNotExist.php b/src/Schema/Exception/ForeignKeyDoesNotExist.php index ac070670c03..bf57cd4ff31 100644 --- a/src/Schema/Exception/ForeignKeyDoesNotExist.php +++ b/src/Schema/Exception/ForeignKeyDoesNotExist.php @@ -8,16 +8,14 @@ use function sprintf; -/** - * @psalm-immutable - */ +/** @psalm-immutable */ final class ForeignKeyDoesNotExist extends SchemaException { public static function new(string $foreignKeyName, string $table): self { return new self( sprintf('There exists no foreign key with the name "%s" on table "%s".', $foreignKeyName, $table), - self::FOREIGNKEY_DOESNT_EXIST + self::FOREIGNKEY_DOESNT_EXIST, ); } } diff --git a/src/Schema/Exception/IndexAlreadyExists.php b/src/Schema/Exception/IndexAlreadyExists.php index 86859738664..25facb58ab2 100644 --- a/src/Schema/Exception/IndexAlreadyExists.php +++ b/src/Schema/Exception/IndexAlreadyExists.php @@ -8,16 +8,14 @@ use function sprintf; -/** - * @psalm-immutable - */ +/** @psalm-immutable */ final class IndexAlreadyExists extends SchemaException { public static function new(string $indexName, string $table): self { return new self( sprintf('An index with name "%s" was already defined on table "%s".', $indexName, $table), - self::INDEX_ALREADY_EXISTS + self::INDEX_ALREADY_EXISTS, ); } } diff --git a/src/Schema/Exception/IndexDoesNotExist.php b/src/Schema/Exception/IndexDoesNotExist.php index f80793efadf..9f4024185a2 100644 --- a/src/Schema/Exception/IndexDoesNotExist.php +++ b/src/Schema/Exception/IndexDoesNotExist.php @@ -8,16 +8,14 @@ use function sprintf; -/** - * @psalm-immutable - */ +/** @psalm-immutable */ final class IndexDoesNotExist extends SchemaException { public static function new(string $indexName, string $table): self { return new self( sprintf('Index "%s" does not exist on table "%s".', $indexName, $table), - self::INDEX_DOESNT_EXIST + self::INDEX_DOESNT_EXIST, ); } } diff --git a/src/Schema/Exception/IndexNameInvalid.php b/src/Schema/Exception/IndexNameInvalid.php index 6a2bee93d7a..5230f506e82 100644 --- a/src/Schema/Exception/IndexNameInvalid.php +++ b/src/Schema/Exception/IndexNameInvalid.php @@ -8,16 +8,14 @@ use function sprintf; -/** - * @psalm-immutable - */ +/** @psalm-immutable */ final class IndexNameInvalid extends SchemaException { public static function new(string $indexName): self { return new self( sprintf('Invalid index name "%s" given, has to be [a-zA-Z0-9_].', $indexName), - self::INDEX_INVALID_NAME + self::INDEX_INVALID_NAME, ); } } diff --git a/src/Schema/Exception/InvalidTableName.php b/src/Schema/Exception/InvalidTableName.php index 440e60785b6..50e2d3af9b9 100644 --- a/src/Schema/Exception/InvalidTableName.php +++ b/src/Schema/Exception/InvalidTableName.php @@ -8,9 +8,7 @@ use function sprintf; -/** - * @psalm-immutable - */ +/** @psalm-immutable */ final class InvalidTableName extends SchemaException { public static function new(string $tableName): self diff --git a/src/Schema/Exception/NamedForeignKeyRequired.php b/src/Schema/Exception/NamedForeignKeyRequired.php index addab21a8cd..bd5b8aff3e2 100644 --- a/src/Schema/Exception/NamedForeignKeyRequired.php +++ b/src/Schema/Exception/NamedForeignKeyRequired.php @@ -11,9 +11,7 @@ use function implode; use function sprintf; -/** - * @psalm-immutable - */ +/** @psalm-immutable */ final class NamedForeignKeyRequired extends SchemaException { public static function new(Table $localTable, ForeignKeyConstraint $foreignKey): self @@ -25,8 +23,8 @@ public static function new(Table $localTable, ForeignKeyConstraint $foreignKey): $localTable->getName(), implode(', ', $foreignKey->getLocalColumns()), $foreignKey->getForeignTableName(), - implode(', ', $foreignKey->getForeignColumns()) - ) + implode(', ', $foreignKey->getForeignColumns()), + ), ); } } diff --git a/src/Schema/Exception/NamespaceAlreadyExists.php b/src/Schema/Exception/NamespaceAlreadyExists.php index 256ae1dbed7..008bd5f0e08 100644 --- a/src/Schema/Exception/NamespaceAlreadyExists.php +++ b/src/Schema/Exception/NamespaceAlreadyExists.php @@ -8,16 +8,14 @@ use function sprintf; -/** - * @psalm-immutable - */ +/** @psalm-immutable */ final class NamespaceAlreadyExists extends SchemaException { public static function new(string $namespaceName): self { return new self( sprintf('The namespace with name "%s" already exists.', $namespaceName), - self::NAMESPACE_ALREADY_EXISTS + self::NAMESPACE_ALREADY_EXISTS, ); } } diff --git a/src/Schema/Exception/SequenceAlreadyExists.php b/src/Schema/Exception/SequenceAlreadyExists.php index 34939bfbb83..d719c6a0695 100644 --- a/src/Schema/Exception/SequenceAlreadyExists.php +++ b/src/Schema/Exception/SequenceAlreadyExists.php @@ -8,16 +8,14 @@ use function sprintf; -/** - * @psalm-immutable - */ +/** @psalm-immutable */ final class SequenceAlreadyExists extends SchemaException { public static function new(string $sequenceName): self { return new self( sprintf('The sequence "%s" already exists.', $sequenceName), - self::SEQUENCE_ALREADY_EXISTS + self::SEQUENCE_ALREADY_EXISTS, ); } } diff --git a/src/Schema/Exception/SequenceDoesNotExist.php b/src/Schema/Exception/SequenceDoesNotExist.php index de0a22d9a08..3f948835c60 100644 --- a/src/Schema/Exception/SequenceDoesNotExist.php +++ b/src/Schema/Exception/SequenceDoesNotExist.php @@ -8,16 +8,14 @@ use function sprintf; -/** - * @psalm-immutable - */ +/** @psalm-immutable */ final class SequenceDoesNotExist extends SchemaException { public static function new(string $sequenceName): self { return new self( sprintf('There exists no sequence with the name "%s".', $sequenceName), - self::SEQUENCE_DOENST_EXIST + self::SEQUENCE_DOENST_EXIST, ); } } diff --git a/src/Schema/Exception/TableAlreadyExists.php b/src/Schema/Exception/TableAlreadyExists.php index ed6fde66cc5..d7b23593794 100644 --- a/src/Schema/Exception/TableAlreadyExists.php +++ b/src/Schema/Exception/TableAlreadyExists.php @@ -8,16 +8,14 @@ use function sprintf; -/** - * @psalm-immutable - */ +/** @psalm-immutable */ final class TableAlreadyExists extends SchemaException { public static function new(string $tableName): self { return new self( sprintf('The table with name "%s" already exists.', $tableName), - self::TABLE_ALREADY_EXISTS + self::TABLE_ALREADY_EXISTS, ); } } diff --git a/src/Schema/Exception/TableDoesNotExist.php b/src/Schema/Exception/TableDoesNotExist.php index 0ab3b7b653e..7c6dda9ab5d 100644 --- a/src/Schema/Exception/TableDoesNotExist.php +++ b/src/Schema/Exception/TableDoesNotExist.php @@ -8,16 +8,14 @@ use function sprintf; -/** - * @psalm-immutable - */ +/** @psalm-immutable */ final class TableDoesNotExist extends SchemaException { public static function new(string $tableName): self { return new self( sprintf('There is no table with name "%s" in the schema.', $tableName), - self::TABLE_DOESNT_EXIST + self::TABLE_DOESNT_EXIST, ); } } diff --git a/src/Schema/Exception/UniqueConstraintDoesNotExist.php b/src/Schema/Exception/UniqueConstraintDoesNotExist.php index dbbff266974..dad6116c6cb 100644 --- a/src/Schema/Exception/UniqueConstraintDoesNotExist.php +++ b/src/Schema/Exception/UniqueConstraintDoesNotExist.php @@ -8,16 +8,14 @@ use function sprintf; -/** - * @psalm-immutable - */ +/** @psalm-immutable */ final class UniqueConstraintDoesNotExist extends SchemaException { public static function new(string $constraintName, string $table): self { return new self( sprintf('There exists no unique constraint with the name "%s" on table "%s".', $constraintName, $table), - self::CONSTRAINT_DOESNT_EXIST + self::CONSTRAINT_DOESNT_EXIST, ); } } diff --git a/src/Schema/Exception/UnknownColumnOption.php b/src/Schema/Exception/UnknownColumnOption.php index 8cf5ac14872..7a7c6f87a17 100644 --- a/src/Schema/Exception/UnknownColumnOption.php +++ b/src/Schema/Exception/UnknownColumnOption.php @@ -8,15 +8,13 @@ use function sprintf; -/** - * @psalm-immutable - */ +/** @psalm-immutable */ final class UnknownColumnOption extends SchemaException { public static function new(string $name): self { return new self( - sprintf('The "%s" column option is not supported.', $name) + sprintf('The "%s" column option is not supported.', $name), ); } } diff --git a/src/Schema/ForeignKeyConstraint.php b/src/Schema/ForeignKeyConstraint.php index 0e3133b659a..bb5ef7f0433 100644 --- a/src/Schema/ForeignKeyConstraint.php +++ b/src/Schema/ForeignKeyConstraint.php @@ -51,7 +51,7 @@ public function __construct( string $foreignTableName, array $foreignColumnNames, string $name = '', - protected array $options = [] + protected array $options = [], ) { $this->_setName($name); diff --git a/src/Schema/Index.php b/src/Schema/Index.php index 2b040ba7500..19c54119b78 100644 --- a/src/Schema/Index.php +++ b/src/Schema/Index.php @@ -45,7 +45,7 @@ public function __construct( bool $isUnique = false, bool $isPrimary = false, array $flags = [], - private readonly array $options = [] + private readonly array $options = [], ) { $isUnique = $isUnique || $isPrimary; @@ -103,9 +103,7 @@ public function getQuotedColumns(AbstractPlatform $platform): array return $columns; } - /** - * @return array - */ + /** @return array */ public function getUnquotedColumns(): array { return array_map($this->trimQuotes(...), $this->getColumns()); @@ -269,9 +267,7 @@ public function getOption(string $name): mixed return $this->options[strtolower($name)]; } - /** - * @return array - */ + /** @return array */ public function getOptions(): array { return $this->options; diff --git a/src/Schema/MySQLSchemaManager.php b/src/Schema/MySQLSchemaManager.php index 3642968e50b..d18a1f69e6b 100644 --- a/src/Schema/MySQLSchemaManager.php +++ b/src/Schema/MySQLSchemaManager.php @@ -36,9 +36,7 @@ */ class MySQLSchemaManager extends AbstractSchemaManager { - /** - * @see https://mariadb.com/kb/en/library/string-literals/#escape-sequences - */ + /** @see https://mariadb.com/kb/en/library/string-literals/#escape-sequences */ private const MARIADB_ESCAPE_SEQUENCES = [ '\\0' => "\0", "\\'" => "'", @@ -151,7 +149,7 @@ protected function _getPortableTableColumnDefinition(array $tableColumn): Column preg_match( '([A-Za-z]+\(([0-9]+),([0-9]+)\))', $tableColumn['type'], - $match + $match, ) === 1 ) { $precision = (int) $match[1]; @@ -311,24 +309,22 @@ protected function _getPortableTableForeignKeyDefinition(array $tableForeignKey) [ 'onDelete' => $tableForeignKey['onDelete'], 'onUpdate' => $tableForeignKey['onUpdate'], - ] + ], ); } - /** - * @throws Exception - */ + /** @throws Exception */ public function createComparator(): Comparator { return new MySQL\Comparator( $this->platform, new CachingCharsetMetadataProvider( - new ConnectionCharsetMetadataProvider($this->connection) + new ConnectionCharsetMetadataProvider($this->connection), ), new CachingCollationMetadataProvider( - new ConnectionCollationMetadataProvider($this->connection) + new ConnectionCollationMetadataProvider($this->connection), ), - $this->getDefaultTableOptions() + $this->getDefaultTableOptions(), ); } @@ -501,9 +497,7 @@ protected function fetchTableOptionsByTable(string $databaseName, ?string $table return $tableOptions; } - /** - * @return array|array - */ + /** @return array|array */ private function parseCreateOptions(?string $string): array { $options = []; @@ -521,9 +515,7 @@ private function parseCreateOptions(?string $string): array return $options; } - /** - * @throws Exception - */ + /** @throws Exception */ private function getDefaultTableOptions(): DefaultTableOptions { if ($this->defaultTableOptions === null) { diff --git a/src/Schema/OracleSchemaManager.php b/src/Schema/OracleSchemaManager.php index 54fe24889ed..d2e9d9e20f3 100644 --- a/src/Schema/OracleSchemaManager.php +++ b/src/Schema/OracleSchemaManager.php @@ -222,7 +222,7 @@ protected function _getPortableTableForeignKeyDefinition(array $tableForeignKey) $this->getQuotedIdentifierName($tableForeignKey['foreignTable']), array_values($tableForeignKey['foreign']), $this->getQuotedIdentifierName($tableForeignKey['name']), - ['onDelete' => $tableForeignKey['onDelete']] + ['onDelete' => $tableForeignKey['onDelete']], ); } @@ -236,7 +236,7 @@ protected function _getPortableSequenceDefinition(array $sequence): Sequence return new Sequence( $this->getQuotedIdentifierName($sequence['sequence_name']), (int) $sequence['increment_by'], - (int) $sequence['min_value'] + (int) $sequence['min_value'], ); } @@ -266,9 +266,7 @@ public function createDatabase(string $database): void $this->connection->executeStatement($statement); } - /** - * @throws Exception - */ + /** @throws Exception */ protected function dropAutoincrement(string $table): bool { $sql = $this->platform->getDropAutoincrementSql($table); diff --git a/src/Schema/PostgreSQLSchemaManager.php b/src/Schema/PostgreSQLSchemaManager.php index 9b9e61dd435..4989a0b53d1 100644 --- a/src/Schema/PostgreSQLSchemaManager.php +++ b/src/Schema/PostgreSQLSchemaManager.php @@ -47,7 +47,7 @@ public function listSchemaNames(): array FROM information_schema.schemata WHERE schema_name NOT LIKE 'pg\_%' AND schema_name != 'information_schema' -SQL +SQL, ); } @@ -95,7 +95,7 @@ protected function _getPortableTableForeignKeyDefinition(array $tableForeignKey) preg_match( '(ON UPDATE ([a-zA-Z0-9]+( (NULL|ACTION|DEFAULT))?))', $tableForeignKey['condef'], - $match + $match, ) === 1 ) { $onUpdate = $match[1]; @@ -105,7 +105,7 @@ protected function _getPortableTableForeignKeyDefinition(array $tableForeignKey) preg_match( '(ON DELETE ([a-zA-Z0-9]+( (NULL|ACTION|DEFAULT))?))', $tableForeignKey['condef'], - $match + $match, ) === 1 ) { $onDelete = $match[1]; @@ -125,7 +125,7 @@ protected function _getPortableTableForeignKeyDefinition(array $tableForeignKey) $foreignTable, $foreignColumns, $tableForeignKey['conname'], - ['onUpdate' => $onUpdate, 'onDelete' => $onDelete] + ['onUpdate' => $onUpdate, 'onDelete' => $onDelete], ); } @@ -164,7 +164,7 @@ protected function _getPortableTableIndexesList(array $tableIndexes, string $tab $columnNameSql = sprintf( 'SELECT attnum, attname FROM pg_attribute WHERE attrelid=%d AND attnum IN (%s) ORDER BY attnum ASC', $row['indrelid'], - implode(' ,', $colNumbers) + implode(' ,', $colNumbers), ); $indexColumns = $this->connection->fetchAllAssociative($columnNameSql); @@ -318,7 +318,7 @@ protected function _getPortableTableColumnDefinition(array $tableColumn): Column preg_match( '([A-Za-z]+\(([0-9]+),([0-9]+)\))', $tableColumn['complete_type'], - $match + $match, ) === 1 ) { $precision = (int) $match[1]; @@ -342,7 +342,7 @@ protected function _getPortableTableColumnDefinition(array $tableColumn): Column is_string($tableColumn['default']) && preg_match( "('([^']+)'::)", $tableColumn['default'], - $match + $match, ) === 1 ) { $tableColumn['default'] = $match[1]; @@ -535,9 +535,7 @@ protected function fetchTableOptionsByTable(string $databaseName, ?string $table return $this->connection->fetchAllAssociativeIndexed($sql); } - /** - * @return list - */ + /** @return list */ private function buildQueryConditions(?string $tableName): array { $conditions = []; diff --git a/src/Schema/SQLServerSchemaManager.php b/src/Schema/SQLServerSchemaManager.php index d527b978c82..c1493521497 100644 --- a/src/Schema/SQLServerSchemaManager.php +++ b/src/Schema/SQLServerSchemaManager.php @@ -43,7 +43,7 @@ public function listSchemaNames(): array SELECT name FROM sys.schemas WHERE name NOT IN('guest', 'INFORMATION_SCHEMA', 'sys') -SQL +SQL, ); } @@ -217,7 +217,7 @@ protected function _getPortableTableForeignKeyDefinition(array $tableForeignKey) $tableForeignKey['foreign_table'], $tableForeignKey['foreign_columns'], $tableForeignKey['name'], - $tableForeignKey['options'] + $tableForeignKey['options'], ); } @@ -259,8 +259,8 @@ public function alterTable(TableDiff $tableDiff): void sprintf( 'ALTER TABLE %s DROP CONSTRAINT %s', $tableDiff->name, - $constraint - ) + $constraint, + ), ); } } @@ -294,21 +294,17 @@ private function getColumnConstraints(string $table, string $column): iterable AND c.name = ? SQL , - [$table, $column] + [$table, $column], ); } - /** - * @throws Exception - */ + /** @throws Exception */ public function createComparator(): Comparator { return new SQLServer\Comparator($this->platform, $this->getDatabaseCollation()); } - /** - * @throws Exception - */ + /** @throws Exception */ private function getDatabaseCollation(): string { if ($this->databaseCollation === null) { @@ -465,7 +461,7 @@ protected function selectForeignKeyColumns(string $databaseName, ?string $tableN $conditions[] = $this->getTableWhereClause( $tableName, 'SCHEMA_NAME(f.schema_id)', - 'OBJECT_NAME(f.parent_object_id)' + 'OBJECT_NAME(f.parent_object_id)', ); $sql .= ' WHERE ' . implode(' AND ', $conditions); diff --git a/src/Schema/SQLiteSchemaManager.php b/src/Schema/SQLiteSchemaManager.php index c1ba1fb4e18..1e7186ab567 100644 --- a/src/Schema/SQLiteSchemaManager.php +++ b/src/Schema/SQLiteSchemaManager.php @@ -134,7 +134,7 @@ static function (array $a, array $b): int { } return $a['pk'] - $b['pk']; - } + }, ); foreach ($indexArray as $indexColumnRow) { @@ -217,7 +217,7 @@ protected function _getPortableTableColumnList(string $table, string $database, if ($type instanceof StringType || $type instanceof TextType) { $column->setPlatformOption( 'collation', - $this->parseColumnCollationFromSQL($columnName, $createSql) ?? 'BINARY' + $this->parseColumnCollationFromSQL($columnName, $createSql) ?? 'BINARY', ); } @@ -356,7 +356,7 @@ protected function _getPortableTableForeignKeyDefinition(array $tableForeignKey) 'onUpdate' => $tableForeignKey['onUpdate'], 'deferrable' => $tableForeignKey['deferrable'], 'deferred' => $tableForeignKey['deferred'], - ] + ], ); } @@ -415,9 +415,7 @@ private function parseColumnCommentFromSQL(string $column, string $sql): string return $comment; } - /** - * @throws Exception - */ + /** @throws Exception */ private function getCreateTableSQL(string $table): string { $sql = $this->connection->fetchOne( @@ -434,7 +432,7 @@ private function getCreateTableSQL(string $table): string AND name = ? SQL , - [$table] + [$table], ); if ($sql !== false) { @@ -485,7 +483,7 @@ private function getForeignKeyDetails(string $table) (?:\s+INITIALLY\s+(DEFERRED|IMMEDIATE))? )?#isx', $createSql, - $match + $match, ) === 0 ) { return []; @@ -533,7 +531,7 @@ protected function selectTableNames(string $databaseName): Result protected function selectTableColumns(string $databaseName, ?string $tableName = null): Result { - $sql = <<getNamespaceName(); @@ -119,9 +117,7 @@ protected function _addTable(Table $table): void $table->setSchemaConfig($this->_schemaConfig); } - /** - * @throws SchemaException - */ + /** @throws SchemaException */ protected function _addSequence(Sequence $sequence): void { $namespaceName = $sequence->getNamespaceName(); @@ -162,9 +158,7 @@ public function getTables(): array return array_values($this->_tables); } - /** - * @throws SchemaException - */ + /** @throws SchemaException */ public function getTable(string $name): Table { $name = $this->getFullQualifiedAssetName($name); @@ -244,9 +238,7 @@ public function hasSequence(string $name): bool return isset($this->_sequences[$name]); } - /** - * @throws SchemaException - */ + /** @throws SchemaException */ public function getSequence(string $name): Sequence { $name = $this->getFullQualifiedAssetName($name); @@ -257,9 +249,7 @@ public function getSequence(string $name): Sequence return $this->_sequences[$name]; } - /** - * @return list - */ + /** @return list */ public function getSequences(): array { return array_values($this->_sequences); @@ -349,9 +339,7 @@ public function createSequence(string $name, int $allocationSize = 1, int $initi return $seq; } - /** - * @return $this - */ + /** @return $this */ public function dropSequence(string $name): self { $name = $this->getFullQualifiedAssetName($name); diff --git a/src/Schema/SchemaConfig.php b/src/Schema/SchemaConfig.php index 1e19f8d02d4..86cc84f9806 100644 --- a/src/Schema/SchemaConfig.php +++ b/src/Schema/SchemaConfig.php @@ -53,9 +53,7 @@ public function getDefaultTableOptions(): array return $this->defaultTableOptions; } - /** - * @param array $defaultTableOptions - */ + /** @param array $defaultTableOptions */ public function setDefaultTableOptions(array $defaultTableOptions): void { $this->defaultTableOptions = $defaultTableOptions; diff --git a/src/Schema/SchemaDiff.php b/src/Schema/SchemaDiff.php index f15202fa739..43a0596d491 100644 --- a/src/Schema/SchemaDiff.php +++ b/src/Schema/SchemaDiff.php @@ -60,7 +60,7 @@ public function __construct( public array $newTables = [], public array $changedTables = [], public array $removedTables = [], - public ?Schema $fromSchema = null + public ?Schema $fromSchema = null, ) { } @@ -80,17 +80,13 @@ public function toSaveSql(AbstractPlatform $platform): array return $this->_toSql($platform, true); } - /** - * @return list - */ + /** @return list */ public function toSql(AbstractPlatform $platform): array { return $this->_toSql($platform, false); } - /** - * @return list - */ + /** @return list */ protected function _toSql(AbstractPlatform $platform, bool $saveMode = false): array { $sql = []; @@ -106,7 +102,7 @@ protected function _toSql(AbstractPlatform $platform, bool $saveMode = false): a foreach ($tableOrphanedForeignKey as $orphanedForeignKey) { $sql[] = $platform->getDropForeignKeySQL( $orphanedForeignKey->getQuotedName($platform), - $localTableName + $localTableName, ); } } diff --git a/src/Schema/SchemaException.php b/src/Schema/SchemaException.php index 6a541a29f7f..e7858348c01 100644 --- a/src/Schema/SchemaException.php +++ b/src/Schema/SchemaException.php @@ -6,9 +6,7 @@ use Doctrine\DBAL\Exception; -/** - * @psalm-immutable - */ +/** @psalm-immutable */ class SchemaException extends Exception { public const TABLE_DOESNT_EXIST = 10; diff --git a/src/Schema/Sequence.php b/src/Schema/Sequence.php index d2f518f27ec..32a5e67bd24 100644 --- a/src/Schema/Sequence.php +++ b/src/Schema/Sequence.php @@ -20,7 +20,7 @@ public function __construct( string $name, int $allocationSize = 1, int $initialValue = 1, - protected ?int $cache = null + protected ?int $cache = null, ) { $this->_setName($name); $this->setAllocationSize($allocationSize); diff --git a/src/Schema/Table.php b/src/Schema/Table.php index 646e6445451..79307499c51 100644 --- a/src/Schema/Table.php +++ b/src/Schema/Table.php @@ -71,7 +71,7 @@ public function __construct( array $indexes = [], array $uniqueConstraints = [], array $fkConstraints = [], - array $options = [] + array $options = [], ) { if ($name === '') { throw InvalidTableName::new($name); @@ -137,12 +137,12 @@ public function addUniqueConstraint( array $columnNames, ?string $indexName = null, array $flags = [], - array $options = [] + array $options = [], ): self { $indexName ??= $this->_generateIdentifierName( array_merge([$this->getName()], $columnNames), 'uniq', - $this->_getMaxIdentifierLength() + $this->_getMaxIdentifierLength(), ); return $this->_addUniqueConstraint($this->_createUniqueConstraint($columnNames, $indexName, $flags, $options)); @@ -157,12 +157,12 @@ public function addIndex( array $columnNames, ?string $indexName = null, array $flags = [], - array $options = [] + array $options = [], ): self { $indexName ??= $this->_generateIdentifierName( array_merge([$this->getName()], $columnNames), 'idx', - $this->_getMaxIdentifierLength() + $this->_getMaxIdentifierLength(), ); return $this->_addIndex($this->_createIndex($columnNames, $indexName, false, false, $flags, $options)); @@ -210,7 +210,7 @@ public function addUniqueIndex(array $columnNames, ?string $indexName = null, ar $indexName ??= $this->_generateIdentifierName( array_merge([$this->getName()], $columnNames), 'uniq', - $this->_getMaxIdentifierLength() + $this->_getMaxIdentifierLength(), ); return $this->_addIndex($this->_createIndex($columnNames, $indexName, true, false, [], $options)); @@ -333,12 +333,12 @@ public function addForeignKeyConstraint( array $localColumnNames, array $foreignColumnNames, array $options = [], - ?string $name = null + ?string $name = null, ): self { $name ??= $this->_generateIdentifierName( array_merge([$this->getName()], $localColumnNames), 'fk', - $this->_getMaxIdentifierLength() + $this->_getMaxIdentifierLength(), ); foreach ($localColumnNames as $columnName) { @@ -352,7 +352,7 @@ public function addForeignKeyConstraint( $foreignTableName, $foreignColumnNames, $name, - $options + $options, ); return $this->_addForeignKeyConstraint($constraint); @@ -563,9 +563,7 @@ public function getIndex(string $name): Index return $this->_indexes[$name]; } - /** - * @return array - */ + /** @return array */ public function getIndexes(): array { return $this->_indexes; @@ -601,9 +599,7 @@ public function getOption(string $name): mixed return $this->_options[$name] ?? null; } - /** - * @return array - */ + /** @return array */ public function getOptions(): array { return $this->_options; @@ -634,9 +630,7 @@ protected function _getMaxIdentifierLength(): int : 63; } - /** - * @throws SchemaException - */ + /** @throws SchemaException */ protected function _addColumn(Column $column): void { $columnName = $column->getName(); @@ -695,7 +689,7 @@ protected function _addUniqueConstraint(UniqueConstraint $constraint): self : $this->_generateIdentifierName( array_merge((array) $this->getName(), $constraint->getColumns()), 'fk', - $this->_getMaxIdentifierLength() + $this->_getMaxIdentifierLength(), ); $name = $this->normalizeIdentifier($name); @@ -708,7 +702,7 @@ protected function _addUniqueConstraint(UniqueConstraint $constraint): self $indexName = $this->_generateIdentifierName( array_merge([$this->getName()], $constraint->getColumns()), 'idx', - $this->_getMaxIdentifierLength() + $this->_getMaxIdentifierLength(), ); $indexCandidate = $this->_createIndex($constraint->getColumns(), $indexName, true, false); @@ -731,7 +725,7 @@ protected function _addForeignKeyConstraint(ForeignKeyConstraint $constraint): s : $this->_generateIdentifierName( array_merge((array) $this->getName(), $constraint->getLocalColumns()), 'fk', - $this->_getMaxIdentifierLength() + $this->_getMaxIdentifierLength(), ); $name = $this->normalizeIdentifier($name); @@ -745,7 +739,7 @@ protected function _addForeignKeyConstraint(ForeignKeyConstraint $constraint): s $indexName = $this->_generateIdentifierName( array_merge([$this->getName()], $constraint->getLocalColumns()), 'idx', - $this->_getMaxIdentifierLength() + $this->_getMaxIdentifierLength(), ); $indexCandidate = $this->_createIndex($constraint->getLocalColumns(), $indexName, false, false); @@ -800,7 +794,7 @@ private function _createUniqueConstraint( array $columns, string $indexName, array $flags = [], - array $options = [] + array $options = [], ): UniqueConstraint { if (preg_match('(([^a-zA-Z0-9_]+))', $this->normalizeIdentifier($indexName)) === 1) { throw IndexNameInvalid::new($indexName); @@ -834,7 +828,7 @@ private function _createIndex( bool $isUnique, bool $isPrimary, array $flags = [], - array $options = [] + array $options = [], ): Index { if (preg_match('(([^a-zA-Z0-9_]+))', $this->normalizeIdentifier($indexName)) === 1) { throw IndexNameInvalid::new($indexName); diff --git a/src/Schema/TableDiff.php b/src/Schema/TableDiff.php index de4ee594d1f..b26b7cbf1d0 100644 --- a/src/Schema/TableDiff.php +++ b/src/Schema/TableDiff.php @@ -68,17 +68,15 @@ public function __construct( public array $addedIndexes = [], public array $changedIndexes = [], public array $removedIndexes = [], - public ?Table $fromTable = null + public ?Table $fromTable = null, ) { } - /** - * @param AbstractPlatform $platform The platform to use for retrieving this table diff's name. - */ + /** @param AbstractPlatform $platform The platform to use for retrieving this table diff's name. */ public function getName(AbstractPlatform $platform): Identifier { return new Identifier( - $this->fromTable instanceof Table ? $this->fromTable->getQuotedName($platform) : $this->name + $this->fromTable instanceof Table ? $this->fromTable->getQuotedName($platform) : $this->name, ); } diff --git a/src/Schema/UniqueConstraint.php b/src/Schema/UniqueConstraint.php index 237cf4dc301..5057b5cfb77 100644 --- a/src/Schema/UniqueConstraint.php +++ b/src/Schema/UniqueConstraint.php @@ -38,7 +38,7 @@ public function __construct( string $name, array $columns, array $flags = [], - private readonly array $options = [] + private readonly array $options = [], ) { $this->_setName($name); @@ -73,9 +73,7 @@ public function getQuotedColumns(AbstractPlatform $platform): array return $columns; } - /** - * @return array - */ + /** @return array */ public function getUnquotedColumns(): array { return array_map($this->trimQuotes(...), $this->getColumns()); @@ -131,9 +129,7 @@ public function getOption(string $name): mixed return $this->options[strtolower($name)]; } - /** - * @return array - */ + /** @return array */ public function getOptions(): array { return $this->options; diff --git a/src/Statement.php b/src/Statement.php index 163f0061f01..fa357065793 100644 --- a/src/Statement.php +++ b/src/Statement.php @@ -47,7 +47,7 @@ class Statement public function __construct( protected Connection $conn, protected Driver\Statement $stmt, - protected string $sql + protected string $sql, ) { $this->platform = $conn->getDatabasePlatform(); } @@ -73,7 +73,7 @@ public function __construct( public function bindValue( string|int $param, mixed $value, - string|ParameterType|Type $type = ParameterType::STRING + string|ParameterType|Type $type = ParameterType::STRING, ): void { $this->params[$param] = $value; $this->types[$param] = $type; @@ -96,15 +96,13 @@ public function bindValue( } } - /** - * @throws Exception - */ + /** @throws Exception */ private function execute(): Result { try { return new Result( $this->stmt->execute(), - $this->conn + $this->conn, ); } catch (Driver\Exception $ex) { throw $this->conn->convertExceptionDuringQuery($ex, $this->sql, $this->params, $this->types); diff --git a/src/Tools/Console/Command/RunSqlCommand.php b/src/Tools/Console/Command/RunSqlCommand.php index 3b6513a08e5..8c424415e78 100644 --- a/src/Tools/Console/Command/RunSqlCommand.php +++ b/src/Tools/Console/Command/RunSqlCommand.php @@ -44,13 +44,12 @@ protected function configure(): void new InputOption('depth', null, InputOption::VALUE_REQUIRED, 'Dumping depth of result set (deprecated).'), new InputOption('force-fetch', null, InputOption::VALUE_NONE, 'Forces fetching the result.'), ]) - ->setHelp(<<setHelp(<<<'EOT' The %command.name% command executes the given SQL query and outputs the results: php %command.full_name% "SELECT * FROM users" -EOT - ); +EOT); } /** @@ -99,9 +98,7 @@ private function getConnection(InputInterface $input): Connection return $this->connectionProvider->getDefaultConnection(); } - /** - * @throws Exception - */ + /** @throws Exception */ private function runQuery(SymfonyStyle $io, Connection $conn, string $sql): void { $resultSet = $conn->fetchAllAssociative($sql); @@ -114,9 +111,7 @@ private function runQuery(SymfonyStyle $io, Connection $conn, string $sql): void $io->table(array_keys($resultSet[0]), $resultSet); } - /** - * @throws Exception - */ + /** @throws Exception */ private function runStatement(SymfonyStyle $io, Connection $conn, string $sql): void { $io->success(sprintf('%d rows affected.', $conn->executeStatement($sql))); diff --git a/src/Tools/Console/ConnectionProvider.php b/src/Tools/Console/ConnectionProvider.php index 55bda081f10..0ae28c55da5 100644 --- a/src/Tools/Console/ConnectionProvider.php +++ b/src/Tools/Console/ConnectionProvider.php @@ -10,8 +10,6 @@ interface ConnectionProvider { public function getDefaultConnection(): Connection; - /** - * @throws ConnectionNotFound in case a connection with the given name does not exist. - */ + /** @throws ConnectionNotFound in case a connection with the given name does not exist. */ public function getConnection(string $name): Connection; } diff --git a/src/Tools/Console/ConnectionProvider/SingleConnectionProvider.php b/src/Tools/Console/ConnectionProvider/SingleConnectionProvider.php index b390f5317c5..12b40c02cff 100644 --- a/src/Tools/Console/ConnectionProvider/SingleConnectionProvider.php +++ b/src/Tools/Console/ConnectionProvider/SingleConnectionProvider.php @@ -14,7 +14,7 @@ class SingleConnectionProvider implements ConnectionProvider { public function __construct( private readonly Connection $connection, - private readonly string $defaultConnectionName = 'default' + private readonly string $defaultConnectionName = 'default', ) { } diff --git a/src/Types/DateImmutableType.php b/src/Types/DateImmutableType.php index 26664a2cedb..34666c8e3c0 100644 --- a/src/Types/DateImmutableType.php +++ b/src/Types/DateImmutableType.php @@ -27,7 +27,7 @@ public function convertToDatabaseValue(mixed $value, AbstractPlatform $platform) throw InvalidType::new( $value, static::class, - ['null', DateTimeImmutable::class] + ['null', DateTimeImmutable::class], ); } @@ -43,7 +43,7 @@ public function convertToPHPValue(mixed $value, AbstractPlatform $platform): ?Da throw InvalidFormat::new( $value, static::class, - $platform->getDateFormatString() + $platform->getDateFormatString(), ); } diff --git a/src/Types/DateTimeImmutableType.php b/src/Types/DateTimeImmutableType.php index dce154e7ef8..e208ee4783b 100644 --- a/src/Types/DateTimeImmutableType.php +++ b/src/Types/DateTimeImmutableType.php @@ -29,7 +29,7 @@ public function convertToDatabaseValue(mixed $value, AbstractPlatform $platform) throw InvalidType::new( $value, static::class, - ['null', DateTimeImmutable::class] + ['null', DateTimeImmutable::class], ); } @@ -49,7 +49,7 @@ public function convertToPHPValue(mixed $value, AbstractPlatform $platform): ?Da throw InvalidFormat::new( $value, static::class, - $platform->getDateTimeFormatString() + $platform->getDateTimeFormatString(), ); } diff --git a/src/Types/DateTimeType.php b/src/Types/DateTimeType.php index faed0b60921..a58479430e3 100644 --- a/src/Types/DateTimeType.php +++ b/src/Types/DateTimeType.php @@ -54,7 +54,7 @@ public function convertToPHPValue(mixed $value, AbstractPlatform $platform): ?Da throw InvalidFormat::new( $value, static::class, - $platform->getDateTimeFormatString() + $platform->getDateTimeFormatString(), ); } diff --git a/src/Types/DateTimeTzImmutableType.php b/src/Types/DateTimeTzImmutableType.php index c9dac14448f..f0da3d72cc4 100644 --- a/src/Types/DateTimeTzImmutableType.php +++ b/src/Types/DateTimeTzImmutableType.php @@ -27,7 +27,7 @@ public function convertToDatabaseValue(mixed $value, AbstractPlatform $platform) throw InvalidType::new( $value, static::class, - ['null', DateTimeImmutable::class] + ['null', DateTimeImmutable::class], ); } @@ -43,7 +43,7 @@ public function convertToPHPValue(mixed $value, AbstractPlatform $platform): ?Da throw InvalidFormat::new( $value, static::class, - $platform->getDateTimeTzFormatString() + $platform->getDateTimeTzFormatString(), ); } diff --git a/src/Types/DateTimeTzType.php b/src/Types/DateTimeTzType.php index b7315380dda..f1ebf2aca7d 100644 --- a/src/Types/DateTimeTzType.php +++ b/src/Types/DateTimeTzType.php @@ -49,7 +49,7 @@ public function convertToDatabaseValue(mixed $value, AbstractPlatform $platform) throw InvalidType::new( $value, static::class, - ['null', 'DateTime'] + ['null', 'DateTime'], ); } @@ -64,7 +64,7 @@ public function convertToPHPValue(mixed $value, AbstractPlatform $platform): ?Da throw InvalidFormat::new( $value, static::class, - $platform->getDateTimeTzFormatString() + $platform->getDateTimeTzFormatString(), ); } diff --git a/src/Types/DateType.php b/src/Types/DateType.php index 1412369cb0d..ef661100604 100644 --- a/src/Types/DateType.php +++ b/src/Types/DateType.php @@ -47,7 +47,7 @@ public function convertToPHPValue(mixed $value, AbstractPlatform $platform): ?Da throw InvalidFormat::new( $value, static::class, - $platform->getDateFormatString() + $platform->getDateFormatString(), ); } diff --git a/src/Types/Exception/InvalidFormat.php b/src/Types/Exception/InvalidFormat.php index 4d6e09e0b7a..e7cd6395366 100644 --- a/src/Types/Exception/InvalidFormat.php +++ b/src/Types/Exception/InvalidFormat.php @@ -23,17 +23,17 @@ public static function new( string $value, string $toType, ?string $expectedFormat, - ?Throwable $previous = null + ?Throwable $previous = null, ): self { return new self( sprintf( 'Could not convert database value "%s" to Doctrine Type %s. Expected format "%s".', strlen($value) > 32 ? substr($value, 0, 20) . '...' : $value, $toType, - $expectedFormat ?? '' + $expectedFormat ?? '', ), 0, - $previous + $previous, ); } } diff --git a/src/Types/Exception/InvalidType.php b/src/Types/Exception/InvalidType.php index adc89dede88..96899ca536e 100644 --- a/src/Types/Exception/InvalidType.php +++ b/src/Types/Exception/InvalidType.php @@ -33,14 +33,14 @@ public static function new(mixed $value, string $toType, array $possibleTypes, ? 'Could not convert PHP value %s to type %s. Expected one of the following types: %s.', var_export($value, true), $toType, - implode(', ', $possibleTypes) + implode(', ', $possibleTypes), ); } else { $message = sprintf( 'Could not convert PHP value of type %s to type %s. Expected one of the following types: %s.', get_debug_type($value), $toType, - implode(', ', $possibleTypes) + implode(', ', $possibleTypes), ); } diff --git a/src/Types/Exception/SerializationFailed.php b/src/Types/Exception/SerializationFailed.php index 1ba5cc6fa25..6c4de7cb2a8 100644 --- a/src/Types/Exception/SerializationFailed.php +++ b/src/Types/Exception/SerializationFailed.php @@ -10,9 +10,7 @@ use function get_debug_type; use function sprintf; -/** - * @psalm-immutable - */ +/** @psalm-immutable */ final class SerializationFailed extends ConversionException implements TypesException { public static function new(mixed $value, string $format, string $error, ?Throwable $previous = null): self @@ -22,10 +20,10 @@ public static function new(mixed $value, string $format, string $error, ?Throwab 'Could not convert PHP type "%s" to "%s". An error was triggered by the serialization: %s', get_debug_type($value), $format, - $error + $error, ), 0, - $previous + $previous, ); } } diff --git a/src/Types/Exception/TypeNotFound.php b/src/Types/Exception/TypeNotFound.php index fbe23b1d581..13c9d11a6a5 100644 --- a/src/Types/Exception/TypeNotFound.php +++ b/src/Types/Exception/TypeNotFound.php @@ -8,9 +8,7 @@ use function sprintf; -/** - * @psalm-immutable - */ +/** @psalm-immutable */ final class TypeNotFound extends Exception implements TypesException { public static function new(string $name): self diff --git a/src/Types/Exception/TypeNotRegistered.php b/src/Types/Exception/TypeNotRegistered.php index 9a65d2e8615..c09e7ae840c 100644 --- a/src/Types/Exception/TypeNotRegistered.php +++ b/src/Types/Exception/TypeNotRegistered.php @@ -11,9 +11,7 @@ use function spl_object_hash; use function sprintf; -/** - * @psalm-immutable - */ +/** @psalm-immutable */ final class TypeNotRegistered extends Exception implements TypesException { public static function new(Type $type): self @@ -21,7 +19,7 @@ public static function new(Type $type): self return new self(sprintf( 'Type of the class %s@%s is not registered.', get_debug_type($type), - spl_object_hash($type) + spl_object_hash($type), )); } } diff --git a/src/Types/Exception/TypesAlreadyExists.php b/src/Types/Exception/TypesAlreadyExists.php index a98e5fd8b34..2bfe5234977 100644 --- a/src/Types/Exception/TypesAlreadyExists.php +++ b/src/Types/Exception/TypesAlreadyExists.php @@ -8,9 +8,7 @@ use function sprintf; -/** - * @psalm-immutable - */ +/** @psalm-immutable */ final class TypesAlreadyExists extends Exception implements TypesException { public static function new(string $name): self diff --git a/src/Types/Exception/UnknownColumnType.php b/src/Types/Exception/UnknownColumnType.php index 5daeb9b2d93..c1d05997316 100644 --- a/src/Types/Exception/UnknownColumnType.php +++ b/src/Types/Exception/UnknownColumnType.php @@ -8,9 +8,7 @@ use function sprintf; -/** - * @psalm-immutable - */ +/** @psalm-immutable */ final class UnknownColumnType extends Exception implements TypesException { public static function new(string $name): self @@ -24,8 +22,8 @@ public static function new(string $name): self . 'Use AbstractPlatform#registerDoctrineTypeMapping() or have your custom types implement ' . 'Type#getMappedDatabaseTypes(). If the type name is empty you might ' . 'have a problem with the cache or forgot some mapping information.', - $name - ) + $name, + ), ); } } diff --git a/src/Types/Exception/ValueNotConvertible.php b/src/Types/Exception/ValueNotConvertible.php index 91fd16ee944..406ac69e7a2 100644 --- a/src/Types/Exception/ValueNotConvertible.php +++ b/src/Types/Exception/ValueNotConvertible.php @@ -25,13 +25,13 @@ public static function new(mixed $value, string $toType, ?string $message = null $message = sprintf( 'Could not convert database value to "%s" as an error was triggered by the unserialization: %s', $toType, - $message + $message, ); } else { $message = sprintf( 'Could not convert database value "%s" to Doctrine Type "%s".', is_string($value) && strlen($value) > 32 ? substr($value, 0, 20) . '...' : $value, - $toType + $toType, ); } diff --git a/src/Types/TimeImmutableType.php b/src/Types/TimeImmutableType.php index cb620d029ab..aab251c31c2 100644 --- a/src/Types/TimeImmutableType.php +++ b/src/Types/TimeImmutableType.php @@ -27,7 +27,7 @@ public function convertToDatabaseValue(mixed $value, AbstractPlatform $platform) throw InvalidType::new( $value, static::class, - ['null', DateTimeImmutable::class] + ['null', DateTimeImmutable::class], ); } @@ -43,7 +43,7 @@ public function convertToPHPValue(mixed $value, AbstractPlatform $platform): ?Da throw InvalidFormat::new( $value, static::class, - $platform->getTimeFormatString() + $platform->getTimeFormatString(), ); } diff --git a/src/Types/TimeType.php b/src/Types/TimeType.php index ed8fec3c05e..9f317bfd27e 100644 --- a/src/Types/TimeType.php +++ b/src/Types/TimeType.php @@ -47,7 +47,7 @@ public function convertToPHPValue(mixed $value, AbstractPlatform $platform): ?Da throw InvalidFormat::new( $value, static::class, - $platform->getTimeFormatString() + $platform->getTimeFormatString(), ); } diff --git a/src/Types/Type.php b/src/Types/Type.php index 4a43c255bf3..b25c4f792f7 100644 --- a/src/Types/Type.php +++ b/src/Types/Type.php @@ -48,9 +48,7 @@ abstract class Type private static ?TypeRegistry $typeRegistry = null; - /** - * @internal Do not instantiate directly - use {@see Type::addType()} method instead. - */ + /** @internal Do not instantiate directly - use {@see Type::addType()} method instead. */ final public function __construct() { } @@ -183,7 +181,7 @@ public static function getTypesMap(): array static function (Type $type): string { return $type::class; }, - self::getTypeRegistry()->getMap() + self::getTypeRegistry()->getMap(), ); } diff --git a/src/Types/TypeRegistry.php b/src/Types/TypeRegistry.php index 3fe02c86f7e..f1949b246ff 100644 --- a/src/Types/TypeRegistry.php +++ b/src/Types/TypeRegistry.php @@ -17,9 +17,7 @@ */ final class TypeRegistry { - /** - * @param array $instances - */ + /** @param array $instances */ public function __construct(private array $instances = []) { } diff --git a/src/Types/Types.php b/src/Types/Types.php index 7b4f93d31a7..54b0dfecc8d 100644 --- a/src/Types/Types.php +++ b/src/Types/Types.php @@ -9,9 +9,7 @@ */ final class Types { - /** - * @deprecated Use {@link Types::JSON} instead. - */ + /** @deprecated Use {@link Types::JSON} instead. */ public const ARRAY = 'array'; public const ASCII_STRING = 'ascii_string'; @@ -32,9 +30,7 @@ final class Types public const INTEGER = 'integer'; public const JSON = 'json'; - /** - * @deprecated Use {@link Types::JSON} instead. - */ + /** @deprecated Use {@link Types::JSON} instead. */ public const OBJECT = 'object'; public const SIMPLE_ARRAY = 'simple_array'; @@ -44,9 +40,7 @@ final class Types public const TIME_MUTABLE = 'time'; public const TIME_IMMUTABLE = 'time_immutable'; - /** - * @codeCoverageIgnore - */ + /** @codeCoverageIgnore */ private function __construct() { } diff --git a/src/Types/VarDateTimeImmutableType.php b/src/Types/VarDateTimeImmutableType.php index 4710d0f794f..fb68eafee03 100644 --- a/src/Types/VarDateTimeImmutableType.php +++ b/src/Types/VarDateTimeImmutableType.php @@ -29,7 +29,7 @@ public function convertToDatabaseValue(mixed $value, AbstractPlatform $platform) throw InvalidType::new( $value, static::class, - ['null', DateTimeImmutable::class] + ['null', DateTimeImmutable::class], ); } diff --git a/tests/Cache/QueryCacheProfileTest.php b/tests/Cache/QueryCacheProfileTest.php index 086eaa17e1d..c466d318510 100644 --- a/tests/Cache/QueryCacheProfileTest.php +++ b/tests/Cache/QueryCacheProfileTest.php @@ -44,7 +44,7 @@ public function testShouldUseTheGivenCacheKeyIfPresent(): void $this->query, $this->params, $this->types, - $this->connectionParams + $this->connectionParams, ); self::assertEquals(self::CACHE_KEY, $cacheKey, 'The returned cache key should match the given one'); @@ -58,13 +58,13 @@ public function testShouldGenerateAnAutomaticKeyIfNoKeyHasBeenGiven(): void $this->query, $this->params, $this->types, - $this->connectionParams + $this->connectionParams, ); self::assertNotEquals( self::CACHE_KEY, $cacheKey, - 'The returned cache key should be generated automatically' + 'The returned cache key should be generated automatically', ); self::assertNotEmpty($cacheKey, 'The generated cache key should not be empty'); @@ -78,7 +78,7 @@ public function testShouldGenerateDifferentKeysForSameQueryAndParamsAndDifferent $this->query, $this->params, $this->types, - $this->connectionParams + $this->connectionParams, ); $this->connectionParams['host'] = 'a_different_host'; @@ -87,7 +87,7 @@ public function testShouldGenerateDifferentKeysForSameQueryAndParamsAndDifferent $this->query, $this->params, $this->types, - $this->connectionParams + $this->connectionParams, ); self::assertNotEquals($firstCacheKey, $secondCacheKey, 'Cache keys should be different'); @@ -101,7 +101,7 @@ public function testConnectionParamsShouldBeHashed(): void $this->query, $this->params, $this->types, - $this->connectionParams + $this->connectionParams, ); $params = []; @@ -122,14 +122,14 @@ public function testShouldGenerateSameKeysIfNoneOfTheParamsChanges(): void $this->query, $this->params, $this->types, - $this->connectionParams + $this->connectionParams, ); [$secondCacheKey] = $this->queryCacheProfile->generateCacheKeys( $this->query, $this->params, $this->types, - $this->connectionParams + $this->connectionParams, ); self::assertEquals($firstCacheKey, $secondCacheKey, 'Cache keys should be the same'); @@ -144,7 +144,7 @@ public function testShouldGenerateDifferentPasswordInTheParams(): void [ 'user' => 'database_user', 'password' => 'first-password', - ] + ], ); [, $secondRealCacheKey] = $this->queryCacheProfile->generateCacheKeys( @@ -154,13 +154,13 @@ public function testShouldGenerateDifferentPasswordInTheParams(): void [ 'user' => 'database_user', 'password' => 'second-password', - ] + ], ); self::assertEquals( $firstRealCacheKey, $secondRealCacheKey, - 'Cache keys for different password should be the same' + 'Cache keys for different password should be the same', ); } } diff --git a/tests/Connection/CachedQueryTest.php b/tests/Connection/CachedQueryTest.php index a14b710b328..ae82a3c8c25 100644 --- a/tests/Connection/CachedQueryTest.php +++ b/tests/Connection/CachedQueryTest.php @@ -37,20 +37,18 @@ public function testCachedQueryWithChangedImplementationIsExecutedTwice(): void 'SELECT 1', [], [], - new QueryCacheProfile(0, __FUNCTION__, new ArrayAdapter()) + new QueryCacheProfile(0, __FUNCTION__, new ArrayAdapter()), )->fetchAllAssociative()); self::assertSame($data, $connection->executeCacheQuery( 'SELECT 1', [], [], - new QueryCacheProfile(0, __FUNCTION__, new ArrayAdapter()) + new QueryCacheProfile(0, __FUNCTION__, new ArrayAdapter()), )->fetchAllAssociative()); } - /** - * @param list> $data - */ + /** @param list> $data */ private function createConnection(int $expectedQueryCount, array $data): Connection { $connection = $this->createMock(Driver\Connection::class); diff --git a/tests/Connection/ExpandArrayParametersTest.php b/tests/Connection/ExpandArrayParametersTest.php index f69bf5703fb..fca6c84c08f 100644 --- a/tests/Connection/ExpandArrayParametersTest.php +++ b/tests/Connection/ExpandArrayParametersTest.php @@ -15,9 +15,7 @@ class ExpandArrayParametersTest extends TestCase { - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function dataExpandListParameters(): iterable { return [ @@ -331,7 +329,7 @@ public function testExpandListParameters( array $types, string $expectedQuery, array $expectedParams, - array $expectedTypes + array $expectedTypes, ): void { [$query, $params, $types] = $this->expandArrayParameters($query, $params, $types); @@ -340,9 +338,7 @@ public function testExpandListParameters( self::assertEquals($expectedTypes, $types, 'Types dont match'); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function missingNamedParameterProvider(): iterable { return [ @@ -394,9 +390,7 @@ public function testMissingPositionalParameter(string $query, array $params): vo $this->expandArrayParameters($query, $params, []); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function missingPositionalParameterProvider(): iterable { return [ diff --git a/tests/ConnectionTest.php b/tests/ConnectionTest.php index 38b139dc4a6..e7878182a08 100644 --- a/tests/ConnectionTest.php +++ b/tests/ConnectionTest.php @@ -53,10 +53,7 @@ protected function setUp(): void $this->connection = DriverManager::getConnection($this->params); } - /** - * @return Connection&MockObject - */ - private function getExecuteStatementMockConnection() + private function getExecuteStatementMockConnection(): Connection&MockObject { $driverMock = $this->createMock(Driver::class); @@ -136,8 +133,8 @@ public function testTransactionBeginDispatchEvent(): void self::callback( static function (TransactionBeginEventArgs $eventArgs) use ($conn): bool { return $eventArgs->getConnection() === $conn; - } - ) + }, + ), ); $eventManager->addEventListener([Events::onTransactionBegin], $listenerMock); @@ -157,8 +154,8 @@ public function testTransactionCommitDispatchEvent(): void self::callback( static function (TransactionCommitEventArgs $eventArgs) use ($conn): bool { return $eventArgs->getConnection() === $conn; - } - ) + }, + ), ); $eventManager->addEventListener([Events::onTransactionCommit], $listenerMock); @@ -189,8 +186,8 @@ public function testTransactionCommitEventCalledAfterRollBack(): void self::callback( static function (TransactionRollBackEventArgs $eventArgs) use ($conn): bool { return $eventArgs->getConnection() === $conn; - } - ) + }, + ), ); $eventManager->addEventListener([Events::onTransactionRollBack], $rollBackListenerMock); @@ -220,8 +217,8 @@ public function testTransactionRollBackDispatchEvent(): void self::callback( static function (TransactionRollBackEventArgs $eventArgs) use ($conn): bool { return $eventArgs->getConnection() === $conn; - } - ) + }, + ), ); $eventManager->addEventListener([Events::onTransactionRollBack], $listenerMock); @@ -256,7 +253,7 @@ public function testDriverExceptionIsWrapped(callable $callback): void { $this->expectException(Exception::class); $this->expectExceptionMessage( - 'An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1 near "MUUHAAAAHAAAA"' + 'An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1 near "MUUHAAAAHAAAA"', ); $connection = DriverManager::getConnection([ @@ -267,9 +264,7 @@ public function testDriverExceptionIsWrapped(callable $callback): void $callback($connection, 'MUUHAAAAHAAAA'); } - /** - * @return iterable> - */ + /** @return iterable> */ public static function getQueryMethods(): iterable { yield 'executeQuery' => [ @@ -330,9 +325,7 @@ public function testCommitStartsTransactionInNoAutoCommitMode(): void self::assertTrue($conn->isTransactionActive()); } - /** - * @return bool[][] - */ + /** @return bool[][] */ public function resultProvider(): array { return [[true], [false]]; @@ -408,7 +401,7 @@ public function testUpdateWithDifferentColumnsInDataAndIdentifiers(): void 'boolean', 'integer', 'string', - ] + ], ); $conn->update( @@ -426,7 +419,7 @@ public function testUpdateWithDifferentColumnsInDataAndIdentifiers(): void 'is_edited' => 'boolean', 'id' => 'integer', 'name' => 'string', - ] + ], ); } @@ -449,7 +442,7 @@ public function testUpdateWithSameColumnInDataAndIdentifiers(): void 'boolean', 'integer', 'boolean', - ] + ], ); $conn->update( @@ -466,7 +459,7 @@ public function testUpdateWithSameColumnInDataAndIdentifiers(): void 'text' => 'string', 'is_edited' => 'boolean', 'id' => 'integer', - ] + ], ); } @@ -487,7 +480,7 @@ public function testUpdateWithIsNull(): void 'string', 'boolean', 'string', - ] + ], ); $conn->update( @@ -505,7 +498,7 @@ public function testUpdateWithIsNull(): void 'is_edited' => 'boolean', 'id' => 'integer', 'name' => 'string', - ] + ], ); } @@ -518,7 +511,7 @@ public function testDeleteWithIsNull(): void ->with( 'DELETE FROM TestTable WHERE id IS NULL AND name = ?', ['foo'], - ['string'] + ['string'], ); $conn->delete( @@ -530,13 +523,11 @@ public function testDeleteWithIsNull(): void [ 'id' => 'integer', 'name' => 'string', - ] + ], ); } - /** - * @dataProvider fetchModeProvider - */ + /** @dataProvider fetchModeProvider */ public function testFetch(string $method, callable $invoke, mixed $expected): void { $query = 'SELECT * FROM foo WHERE bar = ?'; @@ -565,9 +556,7 @@ public function testFetch(string $method, callable $invoke, mixed $expected): vo self::assertSame($expected, $invoke($conn, $query, $params, $types)); } - /** - * @return iterable> - */ + /** @return iterable> */ public static function fetchModeProvider(): iterable { yield 'numeric' => [ @@ -760,9 +749,7 @@ public function testShouldNotPassPlatformInParamsToTheQueryCacheProfileInExecute (new Connection($connectionParams, $driver))->executeCacheQuery($query, [], [], $queryCacheProfileMock); } - /** - * @psalm-suppress InvalidArgument - */ + /** @psalm-suppress InvalidArgument */ public function testThrowsExceptionWhenInValidPlatformSpecified(): void { $connectionParams = $this->params; diff --git a/tests/Driver/AbstractDB2DriverTest.php b/tests/Driver/AbstractDB2DriverTest.php index e91a53bfa15..02953bd7cb6 100644 --- a/tests/Driver/AbstractDB2DriverTest.php +++ b/tests/Driver/AbstractDB2DriverTest.php @@ -14,9 +14,7 @@ use Doctrine\DBAL\Schema\AbstractSchemaManager; use Doctrine\DBAL\Schema\DB2SchemaManager; -/** - * @extends AbstractDriverTest - */ +/** @extends AbstractDriverTest */ class AbstractDB2DriverTest extends AbstractDriverTest { protected function createDriver(): Driver diff --git a/tests/Driver/AbstractDriverTest.php b/tests/Driver/AbstractDriverTest.php index 7e5856b7546..e2526466ce8 100644 --- a/tests/Driver/AbstractDriverTest.php +++ b/tests/Driver/AbstractDriverTest.php @@ -14,9 +14,7 @@ use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; -/** - * @template P of AbstractPlatform - */ +/** @template P of AbstractPlatform */ abstract class AbstractDriverTest extends TestCase { /** @@ -29,13 +27,11 @@ protected function setUp(): void $this->driver = $this->createDriver(); } - /** - * @dataProvider platformVersionProvider - */ + /** @dataProvider platformVersionProvider */ public function testCreatesDatabasePlatformForVersion(string $version, string $expectedClass): void { $platform = $this->driver->getDatabasePlatform( - new StaticServerVersionProvider($version) + new StaticServerVersionProvider($version), ); self::assertSame($expectedClass, $platform::class); @@ -45,7 +41,7 @@ public function testThrowsExceptionOnCreatingDatabasePlatformsForInvalidVersion( { $this->expectException(Exception::class); $this->driver->getDatabasePlatform( - new StaticServerVersionProvider('foo') + new StaticServerVersionProvider('foo'), ); } @@ -81,16 +77,12 @@ abstract protected function createSchemaManager(Connection $connection): Abstrac abstract protected function createExceptionConverter(): ExceptionConverter; - /** - * @return Connection&MockObject - */ + /** @return Connection&MockObject */ protected function getConnectionMock(): Connection { return $this->createMock(Connection::class); } - /** - * @return array> - */ + /** @return array> */ abstract public static function platformVersionProvider(): array; } diff --git a/tests/Driver/AbstractMySQLDriverTest.php b/tests/Driver/AbstractMySQLDriverTest.php index 3444e44c7a2..ebda4338c7d 100644 --- a/tests/Driver/AbstractMySQLDriverTest.php +++ b/tests/Driver/AbstractMySQLDriverTest.php @@ -16,9 +16,7 @@ use Doctrine\DBAL\Schema\AbstractSchemaManager; use Doctrine\DBAL\Schema\MySQLSchemaManager; -/** - * @extends AbstractDriverTest - */ +/** @extends AbstractDriverTest */ class AbstractMySQLDriverTest extends AbstractDriverTest { protected function createDriver(): Driver @@ -35,7 +33,7 @@ protected function createSchemaManager(Connection $connection): AbstractSchemaMa { return new MySQLSchemaManager( $connection, - $this->createPlatform() + $this->createPlatform(), ); } diff --git a/tests/Driver/AbstractOracleDriver/EasyConnectStringTest.php b/tests/Driver/AbstractOracleDriver/EasyConnectStringTest.php index 263c05b2d74..a9e3bb016e0 100644 --- a/tests/Driver/AbstractOracleDriver/EasyConnectStringTest.php +++ b/tests/Driver/AbstractOracleDriver/EasyConnectStringTest.php @@ -21,9 +21,7 @@ public function testFromConnectionParameters(array $params, string $expected): v self::assertSame($expected, (string) $string); } - /** - * @return iterable> - */ + /** @return iterable> */ public static function connectionParametersProvider(): iterable { return [ diff --git a/tests/Driver/AbstractOracleDriverTest.php b/tests/Driver/AbstractOracleDriverTest.php index d2f6309f231..be3f945777a 100644 --- a/tests/Driver/AbstractOracleDriverTest.php +++ b/tests/Driver/AbstractOracleDriverTest.php @@ -14,9 +14,7 @@ use Doctrine\DBAL\Schema\AbstractSchemaManager; use Doctrine\DBAL\Schema\OracleSchemaManager; -/** - * @extends AbstractDriverTest - */ +/** @extends AbstractDriverTest */ class AbstractOracleDriverTest extends AbstractDriverTest { protected function createDriver(): Driver @@ -33,7 +31,7 @@ protected function createSchemaManager(Connection $connection): AbstractSchemaMa { return new OracleSchemaManager( $connection, - $this->createPlatform() + $this->createPlatform(), ); } diff --git a/tests/Driver/AbstractPostgreSQLDriverTest.php b/tests/Driver/AbstractPostgreSQLDriverTest.php index 1fd50bd95ce..06ae9105e6c 100644 --- a/tests/Driver/AbstractPostgreSQLDriverTest.php +++ b/tests/Driver/AbstractPostgreSQLDriverTest.php @@ -14,9 +14,7 @@ use Doctrine\DBAL\Schema\AbstractSchemaManager; use Doctrine\DBAL\Schema\PostgreSQLSchemaManager; -/** - * @extends AbstractDriverTest - */ +/** @extends AbstractDriverTest */ class AbstractPostgreSQLDriverTest extends AbstractDriverTest { public function testThrowsExceptionOnCreatingDatabasePlatformsForInvalidVersion(): void @@ -38,7 +36,7 @@ protected function createSchemaManager(Connection $connection): AbstractSchemaMa { return new PostgreSQLSchemaManager( $connection, - $this->createPlatform() + $this->createPlatform(), ); } diff --git a/tests/Driver/AbstractSQLServerDriverTest.php b/tests/Driver/AbstractSQLServerDriverTest.php index cb8371e7a60..69851af1bb3 100644 --- a/tests/Driver/AbstractSQLServerDriverTest.php +++ b/tests/Driver/AbstractSQLServerDriverTest.php @@ -13,9 +13,7 @@ use Doctrine\DBAL\Schema\AbstractSchemaManager; use Doctrine\DBAL\Schema\SQLServerSchemaManager; -/** - * @extends AbstractDriverTest - */ +/** @extends AbstractDriverTest */ abstract class AbstractSQLServerDriverTest extends AbstractDriverTest { protected function createPlatform(): AbstractPlatform @@ -27,7 +25,7 @@ protected function createSchemaManager(Connection $connection): AbstractSchemaMa { return new SQLServerSchemaManager( $connection, - $this->createPlatform() + $this->createPlatform(), ); } diff --git a/tests/Driver/AbstractSQLiteDriverTest.php b/tests/Driver/AbstractSQLiteDriverTest.php index e002a14ba68..3b13b79cd42 100644 --- a/tests/Driver/AbstractSQLiteDriverTest.php +++ b/tests/Driver/AbstractSQLiteDriverTest.php @@ -14,9 +14,7 @@ use Doctrine\DBAL\Schema\AbstractSchemaManager; use Doctrine\DBAL\Schema\SQLiteSchemaManager; -/** - * @extends AbstractDriverTest - */ +/** @extends AbstractDriverTest */ class AbstractSQLiteDriverTest extends AbstractDriverTest { protected function createDriver(): Driver @@ -33,7 +31,7 @@ protected function createSchemaManager(Connection $connection): AbstractSchemaMa { return new SQLiteSchemaManager( $connection, - $this->createPlatform() + $this->createPlatform(), ); } diff --git a/tests/Driver/IBMDB2/DataSourceNameTest.php b/tests/Driver/IBMDB2/DataSourceNameTest.php index 976093ca8ec..484f9e573ac 100644 --- a/tests/Driver/IBMDB2/DataSourceNameTest.php +++ b/tests/Driver/IBMDB2/DataSourceNameTest.php @@ -21,9 +21,7 @@ public function testFromConnectionParameters(array $params, string $expected): v self::assertSame($expected, $dsn->toString()); } - /** - * @return iterable> - */ + /** @return iterable> */ public static function connectionParametersProvider(): iterable { yield 'empty-params' => [[], '']; diff --git a/tests/Driver/Middleware/AbstractConnectionMiddlewareTest.php b/tests/Driver/Middleware/AbstractConnectionMiddlewareTest.php index 3e03ec4cddc..ef7831d06bb 100644 --- a/tests/Driver/Middleware/AbstractConnectionMiddlewareTest.php +++ b/tests/Driver/Middleware/AbstractConnectionMiddlewareTest.php @@ -46,7 +46,7 @@ public function testExec(): void self::assertSame( 42, - $this->createMiddleware($connection)->exec('UPDATE foo SET bar=\'baz\' WHERE some_field > 0') + $this->createMiddleware($connection)->exec('UPDATE foo SET bar=\'baz\' WHERE some_field > 0'), ); } diff --git a/tests/Driver/Mysqli/ConnectionTest.php b/tests/Driver/Mysqli/ConnectionTest.php index 2393c51d473..00fcaa5574b 100644 --- a/tests/Driver/Mysqli/ConnectionTest.php +++ b/tests/Driver/Mysqli/ConnectionTest.php @@ -8,9 +8,7 @@ use Doctrine\DBAL\Driver\Mysqli\Exception\HostRequired; use Doctrine\DBAL\Tests\FunctionalTestCase; -/** - * @requires extension mysqli - */ +/** @requires extension mysqli */ class ConnectionTest extends FunctionalTestCase { public function testHostnameIsRequiredForPersistentConnection(): void diff --git a/tests/Driver/OCI8/ConvertPositionalToNamedPlaceholdersTest.php b/tests/Driver/OCI8/ConvertPositionalToNamedPlaceholdersTest.php index b406936407e..8015580f936 100644 --- a/tests/Driver/OCI8/ConvertPositionalToNamedPlaceholdersTest.php +++ b/tests/Driver/OCI8/ConvertPositionalToNamedPlaceholdersTest.php @@ -18,7 +18,7 @@ class ConvertPositionalToNamedPlaceholdersTest extends TestCase public function testConvertPositionalToNamedParameters( string $inputSQL, string $expectedOutputSQL, - array $expectedOutputParamsMap + array $expectedOutputParamsMap, ): void { $parser = new Parser(false); $visitor = new ConvertPositionalToNamedPlaceholders(); @@ -29,9 +29,7 @@ public function testConvertPositionalToNamedParameters( self::assertEquals($expectedOutputParamsMap, $visitor->getParameterMap()); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function positionalToNamedPlaceholdersProvider(): iterable { return [ diff --git a/tests/Driver/PDO/ExceptionTest.php b/tests/Driver/PDO/ExceptionTest.php index af2343f6e22..1c6f5eccd9c 100644 --- a/tests/Driver/PDO/ExceptionTest.php +++ b/tests/Driver/PDO/ExceptionTest.php @@ -8,9 +8,7 @@ use PDOException; use PHPUnit\Framework\TestCase; -/** - * @requires extension pdo - */ +/** @requires extension pdo */ class ExceptionTest extends TestCase { private const ERROR_CODE = 666; diff --git a/tests/Driver/PDO/PgSQL/DriverTest.php b/tests/Driver/PDO/PgSQL/DriverTest.php index 769cb8588c2..30cb15366de 100644 --- a/tests/Driver/PDO/PgSQL/DriverTest.php +++ b/tests/Driver/PDO/PgSQL/DriverTest.php @@ -32,31 +32,31 @@ public function testConnectionDisablesPrepares(): void self::assertInstanceOf(PDO\Connection::class, $connection); self::assertTrue( - $connection->getNativeConnection()->getAttribute(\PDO::PGSQL_ATTR_DISABLE_PREPARES) + $connection->getNativeConnection()->getAttribute(\PDO::PGSQL_ATTR_DISABLE_PREPARES), ); } public function testConnectionDoesNotDisablePreparesWhenAttributeDefined(): void { $connection = $this->connect( - [\PDO::PGSQL_ATTR_DISABLE_PREPARES => false] + [\PDO::PGSQL_ATTR_DISABLE_PREPARES => false], ); self::assertInstanceOf(PDO\Connection::class, $connection); self::assertNotTrue( - $connection->getNativeConnection()->getAttribute(\PDO::PGSQL_ATTR_DISABLE_PREPARES) + $connection->getNativeConnection()->getAttribute(\PDO::PGSQL_ATTR_DISABLE_PREPARES), ); } public function testConnectionDisablePreparesWhenDisablePreparesIsExplicitlyDefined(): void { $connection = $this->connect( - [\PDO::PGSQL_ATTR_DISABLE_PREPARES => true] + [\PDO::PGSQL_ATTR_DISABLE_PREPARES => true], ); self::assertInstanceOf(PDO\Connection::class, $connection); self::assertTrue( - $connection->getNativeConnection()->getAttribute(\PDO::PGSQL_ATTR_DISABLE_PREPARES) + $connection->getNativeConnection()->getAttribute(\PDO::PGSQL_ATTR_DISABLE_PREPARES), ); } @@ -65,16 +65,14 @@ protected function createDriver(): DriverInterface return new Driver(); } - /** - * @param array $driverOptions - */ + /** @param array $driverOptions */ private function connect(array $driverOptions): Connection { return $this->createDriver()->connect( array_merge( TestUtil::getConnectionParams(), - ['driverOptions' => $driverOptions] - ) + ['driverOptions' => $driverOptions], + ), ); } } diff --git a/tests/DriverManagerTest.php b/tests/DriverManagerTest.php index d5044de0a07..6fc0d616569 100644 --- a/tests/DriverManagerTest.php +++ b/tests/DriverManagerTest.php @@ -29,9 +29,7 @@ public function testCheckParams(): void DriverManager::getConnection([]); } - /** - * @psalm-suppress InvalidArgument - */ + /** @psalm-suppress InvalidArgument */ public function testInvalidDriver(): void { $this->expectException(Exception::class); @@ -39,9 +37,7 @@ public function testInvalidDriver(): void DriverManager::getConnection(['driver' => 'invalid_driver']); } - /** - * @requires extension pdo_sqlite - */ + /** @requires extension pdo_sqlite */ public function testCustomPlatform(): void { $platform = $this->createMock(AbstractPlatform::class); @@ -54,9 +50,7 @@ public function testCustomPlatform(): void self::assertSame($platform, $conn->getDatabasePlatform()); } - /** - * @requires extension pdo_sqlite - */ + /** @requires extension pdo_sqlite */ public function testCustomWrapper(): void { $wrapper = $this->createMock(Connection::class); @@ -87,9 +81,7 @@ public function testInvalidWrapperClass(): void DriverManager::getConnection($options); } - /** - * @psalm-suppress InvalidArgument - */ + /** @psalm-suppress InvalidArgument */ public function testInvalidDriverClass(): void { $this->expectException(Exception::class); @@ -142,11 +134,11 @@ public function testDatabaseUrlPrimaryReplica(): void [ 'dbname' => 'baz_replica', 'url' => 'mysql://foo:bar@localhost:11211/baz_replica', - ] + ], ), ], ], - array_intersect_key($params, ['primary' => null, 'replica' => null]) + array_intersect_key($params, ['primary' => null, 'replica' => null]), ); } @@ -177,9 +169,7 @@ public function testDatabaseUrl(array|string $url, array|false $expected): void } } - /** - * @return array> - */ + /** @return array> */ public function databaseUrls(): iterable { $driver = $this->createMock(Driver::class); diff --git a/tests/Events/OracleSessionInitTest.php b/tests/Events/OracleSessionInitTest.php index ee7332308ef..35ebad729a1 100644 --- a/tests/Events/OracleSessionInitTest.php +++ b/tests/Events/OracleSessionInitTest.php @@ -27,9 +27,7 @@ public function testPostConnect(): void $listener->postConnect($eventArgs); } - /** - * @dataProvider getPostConnectWithSessionParameterValuesData - */ + /** @dataProvider getPostConnectWithSessionParameterValuesData */ public function testPostConnectQuotesSessionParameterValues(string $name, string $value): void { $connectionMock = $this->getMockBuilder(Connection::class) @@ -45,9 +43,7 @@ public function testPostConnectQuotesSessionParameterValues(string $name, string $listener->postConnect($eventArgs); } - /** - * @return array> - */ + /** @return array> */ public static function getPostConnectWithSessionParameterValuesData(): iterable { return [ diff --git a/tests/Exception/DriverRequiredTest.php b/tests/Exception/DriverRequiredTest.php index b28adf63d8e..6fb69fba21e 100644 --- a/tests/Exception/DriverRequiredTest.php +++ b/tests/Exception/DriverRequiredTest.php @@ -20,9 +20,9 @@ public function testDriverRequiredWithUrl(): void sprintf( 'The options "driver" or "driverClass" are mandatory if a connection URL without scheme ' . 'is given to DriverManager::getConnection(). Given URL "%s".', - $url + $url, ), - $exception->getMessage() + $exception->getMessage(), ); } } diff --git a/tests/Exception/InvalidPlatformTypeTest.php b/tests/Exception/InvalidPlatformTypeTest.php index c83a2dccb82..0c3b1a6c7e0 100644 --- a/tests/Exception/InvalidPlatformTypeTest.php +++ b/tests/Exception/InvalidPlatformTypeTest.php @@ -11,29 +11,25 @@ class InvalidPlatformTypeTest extends TestCase { - /** - * @group #2821 - */ + /** @group #2821 */ public function testInvalidPlatformTypeObject(): void { $exception = InvalidPlatformType::new(new stdClass()); self::assertSame( 'Option "platform" must be a subtype of ' . AbstractPlatform::class . ', instance of stdClass given.', - $exception->getMessage() + $exception->getMessage(), ); } - /** - * @group #2821 - */ + /** @group #2821 */ public function testInvalidPlatformTypeScalar(): void { $exception = InvalidPlatformType::new('some string'); self::assertSame( 'Option "platform" must be an object and subtype of ' . AbstractPlatform::class . '. Got string.', - $exception->getMessage() + $exception->getMessage(), ); } } diff --git a/tests/ExceptionTest.php b/tests/ExceptionTest.php index fd4123d7be4..ffea14412b0 100644 --- a/tests/ExceptionTest.php +++ b/tests/ExceptionTest.php @@ -23,9 +23,9 @@ public function testDriverRequiredWithUrl(): void sprintf( 'The options "driver" or "driverClass" are mandatory if a connection URL without scheme ' . 'is given to DriverManager::getConnection(). Given URL "%s".', - $url + $url, ), - $exception->getMessage() + $exception->getMessage(), ); } @@ -36,7 +36,7 @@ public function testInvalidPlatformTypeObject(): void self::assertSame( 'Option "platform" must be a subtype of Doctrine\DBAL\Platforms\AbstractPlatform, ' . 'instance of stdClass given.', - $exception->getMessage() + $exception->getMessage(), ); } @@ -46,7 +46,7 @@ public function testInvalidPlatformTypeScalar(): void self::assertSame( 'Option "platform" must be an object and subtype of ' . AbstractPlatform::class . '. Got string.', - $exception->getMessage() + $exception->getMessage(), ); } } diff --git a/tests/Functional/BlobTest.php b/tests/Functional/BlobTest.php index 917de4e0936..5aa54ff42ee 100644 --- a/tests/Functional/BlobTest.php +++ b/tests/Functional/BlobTest.php @@ -158,7 +158,7 @@ public function testBindParamProcessesStream(): void } $stmt = $this->connection->prepare( - "INSERT INTO blob_table(id, clobcolumn, blobcolumn) VALUES (1, 'ignored', ?)" + "INSERT INTO blob_table(id, clobcolumn, blobcolumn) VALUES (1, 'ignored', ?)", ); $stream = fopen('data://text/plain,test', 'r'); @@ -179,9 +179,7 @@ private function assertBlobContains(string $text): void self::assertEquals($text, stream_get_contents($blobValue)); } - /** - * @return list - */ + /** @return list */ private function fetchRow(): array { $rows = $this->connection->fetchAllNumeric('SELECT clobcolumn, blobcolumn FROM blob_table'); diff --git a/tests/Functional/Connection/FetchEmptyTest.php b/tests/Functional/Connection/FetchEmptyTest.php index 0f96f4ee6b2..f8b6d85e45a 100644 --- a/tests/Functional/Connection/FetchEmptyTest.php +++ b/tests/Functional/Connection/FetchEmptyTest.php @@ -17,7 +17,7 @@ public function setUp(): void $this->query = sprintf( 'SELECT * FROM (%s) t WHERE 1 = 0', $this->connection->getDatabasePlatform() - ->getDummySelectSQL('1 c') + ->getDummySelectSQL('1 c'), ); } diff --git a/tests/Functional/ConnectionTest.php b/tests/Functional/ConnectionTest.php index 7f955c1ea9f..43272a39fb4 100644 --- a/tests/Functional/ConnectionTest.php +++ b/tests/Functional/ConnectionTest.php @@ -90,7 +90,7 @@ public function testTransactionNestingLevelIsResetOnReconnect(): void $connection = DriverManager::getConnection( $params, $this->connection->getConfiguration(), - $this->connection->getEventManager() + $this->connection->getEventManager(), ); } else { $connection = $this->connection; @@ -283,11 +283,11 @@ public function testConnectWithoutExplicitDatabaseName(): void $connection = DriverManager::getConnection( $params, $this->connection->getConfiguration(), - $this->connection->getEventManager() + $this->connection->getEventManager(), ); self::assertEquals(1, $connection->fetchOne( - $platform->getDummySelectSQL() + $platform->getDummySelectSQL(), )); } @@ -306,7 +306,7 @@ public function testDeterminesDatabasePlatformWhenConnectingToNonExistentDatabas $connection = DriverManager::getConnection( $params, $this->connection->getConfiguration(), - $this->connection->getEventManager() + $this->connection->getEventManager(), ); self::assertFalse($connection->isConnected()); diff --git a/tests/Functional/DataAccessTest.php b/tests/Functional/DataAccessTest.php index 1d0b58e5c61..54f2f9d4a6d 100644 --- a/tests/Functional/DataAccessTest.php +++ b/tests/Functional/DataAccessTest.php @@ -111,7 +111,7 @@ public function testFetchAllWithTypes(): void $data = $this->connection->fetchAllAssociative( $sql, [1, $datetime], - [ParameterType::STRING, Types::DATETIME_MUTABLE] + [ParameterType::STRING, Types::DATETIME_MUTABLE], ); self::assertCount(1, $data); @@ -146,7 +146,7 @@ public function testFetchAssocWithTypes(): void $row = $this->connection->fetchAssociative( $sql, [1, $datetime], - [ParameterType::STRING, Types::DATETIME_MUTABLE] + [ParameterType::STRING, Types::DATETIME_MUTABLE], ); self::assertNotFalse($row); @@ -176,7 +176,7 @@ public function testFetchArrayWithTypes(): void $row = $this->connection->fetchNumeric( $sql, [1, $datetime], - [ParameterType::STRING, Types::DATETIME_MUTABLE] + [ParameterType::STRING, Types::DATETIME_MUTABLE], ); self::assertNotFalse($row); @@ -209,7 +209,7 @@ public function testFetchOneWithTypes(): void $column = $this->connection->fetchOne( $sql, [1, $datetime], - [ParameterType::STRING, Types::DATETIME_MUTABLE] + [ParameterType::STRING, Types::DATETIME_MUTABLE], ); self::assertIsString($column); @@ -222,7 +222,7 @@ public function testExecuteQueryBindDateTimeType(): void $value = $this->connection->fetchOne( 'SELECT count(*) AS c FROM fetch_table WHERE test_datetime = ?', [new DateTime('2010-01-01 10:10:10')], - [Types::DATETIME_MUTABLE] + [Types::DATETIME_MUTABLE], ); self::assertEquals(1, $value); @@ -247,7 +247,7 @@ public function testExecuteStatementBindDateTimeType(): void self::assertEquals(1, $this->connection->executeQuery( 'SELECT count(*) AS c FROM fetch_table WHERE test_datetime = ?', [$datetime], - [Types::DATETIME_MUTABLE] + [Types::DATETIME_MUTABLE], )->fetchOne()); } @@ -275,7 +275,7 @@ public function testNativeArrayListSupport(): void $result = $this->connection->executeQuery( 'SELECT test_int FROM fetch_table WHERE test_int IN (?)', [[100, 101, 102, 103, 104]], - [Connection::PARAM_INT_ARRAY] + [Connection::PARAM_INT_ARRAY], ); $data = $result->fetchAllNumeric(); @@ -285,7 +285,7 @@ public function testNativeArrayListSupport(): void $result = $this->connection->executeQuery( 'SELECT test_int FROM fetch_table WHERE test_string IN (?)', [['foo100', 'foo101', 'foo102', 'foo103', 'foo104']], - [Connection::PARAM_STR_ARRAY] + [Connection::PARAM_STR_ARRAY], ); $data = $result->fetchAllNumeric(); @@ -293,9 +293,7 @@ public function testNativeArrayListSupport(): void self::assertEquals([[100], [101], [102], [103], [104]], $data); } - /** - * @dataProvider getTrimExpressionData - */ + /** @dataProvider getTrimExpressionData */ public function testTrimExpression(string $value, TrimMode $mode, ?string $char, string $expectedResult): void { $sql = 'SELECT ' . @@ -309,9 +307,7 @@ public function testTrimExpression(string $value, TrimMode $mode, ?string $char, self::assertEquals($expectedResult, $row['trimmed']); } - /** - * @return array> - */ + /** @return array> */ public static function getTrimExpressionData(): iterable { return [ @@ -354,9 +350,7 @@ public static function getTrimExpressionData(): iterable ]; } - /** - * @dataProvider modeProvider - */ + /** @dataProvider modeProvider */ public function testDateAddSeconds(callable $buildQuery, callable $bindParams): void { $this->assertDateExpression( @@ -366,13 +360,11 @@ static function (AbstractPlatform $platform, string $interval): string { return $platform->getDateAddSecondsExpression('test_datetime', $interval); }, 1, - '2010-01-01 10:10:11' + '2010-01-01 10:10:11', ); } - /** - * @dataProvider modeProvider - */ + /** @dataProvider modeProvider */ public function testDateSubSeconds(callable $buildQuery, callable $bindParams): void { $this->assertDateExpression( @@ -382,13 +374,11 @@ static function (AbstractPlatform $platform, string $interval): string { return $platform->getDateSubSecondsExpression('test_datetime', $interval); }, 1, - '2010-01-01 10:10:09' + '2010-01-01 10:10:09', ); } - /** - * @dataProvider modeProvider - */ + /** @dataProvider modeProvider */ public function testDateAddMinutes(callable $buildQuery, callable $bindParams): void { $this->assertDateExpression( @@ -398,13 +388,11 @@ static function (AbstractPlatform $platform, string $interval): string { return $platform->getDateAddMinutesExpression('test_datetime', $interval); }, 5, - '2010-01-01 10:15:10' + '2010-01-01 10:15:10', ); } - /** - * @dataProvider modeProvider - */ + /** @dataProvider modeProvider */ public function testDateSubMinutes(callable $buildQuery, callable $bindParams): void { $this->assertDateExpression( @@ -414,13 +402,11 @@ static function (AbstractPlatform $platform, string $interval): string { return $platform->getDateSubMinutesExpression('test_datetime', $interval); }, 5, - '2010-01-01 10:05:10' + '2010-01-01 10:05:10', ); } - /** - * @dataProvider modeProvider - */ + /** @dataProvider modeProvider */ public function testDateAddHours(callable $buildQuery, callable $bindParams): void { $this->assertDateExpression( @@ -430,13 +416,11 @@ static function (AbstractPlatform $platform, string $interval): string { return $platform->getDateAddHourExpression('test_datetime', $interval); }, 3, - '2010-01-01 13:10:10' + '2010-01-01 13:10:10', ); } - /** - * @dataProvider modeProvider - */ + /** @dataProvider modeProvider */ public function testDateSubHours(callable $buildQuery, callable $bindParams): void { $this->assertDateExpression( @@ -446,13 +430,11 @@ static function (AbstractPlatform $platform, string $interval): string { return $platform->getDateSubHourExpression('test_datetime', $interval); }, 3, - '2010-01-01 07:10:10' + '2010-01-01 07:10:10', ); } - /** - * @dataProvider modeProvider - */ + /** @dataProvider modeProvider */ public function testDateAddDays(callable $buildQuery, callable $bindParams): void { $this->assertDateExpression( @@ -462,13 +444,11 @@ static function (AbstractPlatform $platform, string $interval): string { return $platform->getDateAddDaysExpression('test_datetime', $interval); }, 10, - '2010-01-11 10:10:10' + '2010-01-11 10:10:10', ); } - /** - * @dataProvider modeProvider - */ + /** @dataProvider modeProvider */ public function testDateSubDays(callable $buildQuery, callable $bindParams): void { $this->assertDateExpression( @@ -478,13 +458,11 @@ static function (AbstractPlatform $platform, string $interval): string { return $platform->getDateSubDaysExpression('test_datetime', $interval); }, 10, - '2009-12-22 10:10:10' + '2009-12-22 10:10:10', ); } - /** - * @dataProvider modeProvider - */ + /** @dataProvider modeProvider */ public function testDateAddWeeks(callable $buildQuery, callable $bindParams): void { $this->assertDateExpression( @@ -494,13 +472,11 @@ static function (AbstractPlatform $platform, string $interval): string { return $platform->getDateAddWeeksExpression('test_datetime', $interval); }, 1, - '2010-01-08 10:10:10' + '2010-01-08 10:10:10', ); } - /** - * @dataProvider modeProvider - */ + /** @dataProvider modeProvider */ public function testDateSubWeeks(callable $buildQuery, callable $bindParams): void { $this->assertDateExpression( @@ -510,13 +486,11 @@ static function (AbstractPlatform $platform, string $interval): string { return $platform->getDateSubWeeksExpression('test_datetime', $interval); }, 1, - '2009-12-25 10:10:10' + '2009-12-25 10:10:10', ); } - /** - * @dataProvider modeProvider - */ + /** @dataProvider modeProvider */ public function testDateAddMonths(callable $buildQuery, callable $bindParams): void { $this->assertDateExpression( @@ -526,13 +500,11 @@ static function (AbstractPlatform $platform, string $interval): string { return $platform->getDateAddMonthExpression('test_datetime', $interval); }, 2, - '2010-03-01 10:10:10' + '2010-03-01 10:10:10', ); } - /** - * @dataProvider modeProvider - */ + /** @dataProvider modeProvider */ public function testDateSubMonths(callable $buildQuery, callable $bindParams): void { $this->assertDateExpression( @@ -542,13 +514,11 @@ static function (AbstractPlatform $platform, string $interval): string { return $platform->getDateSubMonthExpression('test_datetime', $interval); }, 2, - '2009-11-01 10:10:10' + '2009-11-01 10:10:10', ); } - /** - * @dataProvider modeProvider - */ + /** @dataProvider modeProvider */ public function testDateAddQuarters(callable $buildQuery, callable $bindParams): void { $this->assertDateExpression( @@ -558,13 +528,11 @@ static function (AbstractPlatform $platform, string $interval): string { return $platform->getDateAddQuartersExpression('test_datetime', $interval); }, 3, - '2010-10-01 10:10:10' + '2010-10-01 10:10:10', ); } - /** - * @dataProvider modeProvider - */ + /** @dataProvider modeProvider */ public function testDateSubQuarters(callable $buildQuery, callable $bindParams): void { $this->assertDateExpression( @@ -574,13 +542,11 @@ static function (AbstractPlatform $platform, string $interval): string { return $platform->getDateSubQuartersExpression('test_datetime', $interval); }, 3, - '2009-04-01 10:10:10' + '2009-04-01 10:10:10', ); } - /** - * @dataProvider modeProvider - */ + /** @dataProvider modeProvider */ public function testDateAddYears(callable $buildQuery, callable $bindParams): void { $this->assertDateExpression( @@ -590,13 +556,11 @@ static function (AbstractPlatform $platform, string $interval): string { return $platform->getDateAddYearsExpression('test_datetime', $interval); }, 6, - '2016-01-01 10:10:10' + '2016-01-01 10:10:10', ); } - /** - * @dataProvider modeProvider - */ + /** @dataProvider modeProvider */ public function testDateSubYears(callable $buildQuery, callable $bindParams): void { $this->assertDateExpression( @@ -606,7 +570,7 @@ static function (AbstractPlatform $platform, string $interval): string { return $platform->getDateSubYearsExpression('test_datetime', $interval); }, 6, - '2004-01-01 10:10:10' + '2004-01-01 10:10:10', ); } @@ -622,7 +586,7 @@ private function assertDateExpression( callable $bindParams, callable $expression, int $interval, - string $expected + string $expected, ): void { $connection = $this->connection; $platform = $connection->getDatabasePlatform(); @@ -637,9 +601,7 @@ private function assertDateExpression( self::assertEquals($expected, date('Y-m-d H:i:s', strtotime($date))); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function modeProvider(): array { return [ @@ -726,23 +688,19 @@ public function testLocateExpression(): void self::assertEquals(0, $row['locate9']); } - /** - * @dataProvider substringExpressionProvider - */ + /** @dataProvider substringExpressionProvider */ public function testSubstringExpression(string $string, string $start, ?string $length, string $expected): void { $platform = $this->connection->getDatabasePlatform(); $query = $platform->getDummySelectSQL( - $platform->getSubstringExpression($string, $start, $length) + $platform->getSubstringExpression($string, $start, $length), ); self::assertEquals($expected, $this->connection->fetchOne($query)); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function substringExpressionProvider(): iterable { return [ diff --git a/tests/Functional/Driver/AbstractDriverTest.php b/tests/Functional/Driver/AbstractDriverTest.php index 3b0e64c17ac..2105ed15496 100644 --- a/tests/Functional/Driver/AbstractDriverTest.php +++ b/tests/Functional/Driver/AbstractDriverTest.php @@ -39,12 +39,12 @@ public function testReturnsDatabaseNameWithoutDatabaseNameParameter(): void $params, $this->connection->getDriver(), $this->connection->getConfiguration(), - $this->connection->getEventManager() + $this->connection->getEventManager(), ); self::assertSame( static::getDatabaseNameForConnectionWithoutDatabaseNameParameter(), - $connection->getDatabase() + $connection->getDatabase(), ); } @@ -54,7 +54,7 @@ public function testProvidesAccessToTheNativeConnection(): void self::assertThat($nativeConnection, self::logicalOr( new IsType(IsType::TYPE_OBJECT), - new IsType(IsType::TYPE_RESOURCE) + new IsType(IsType::TYPE_RESOURCE), )); } diff --git a/tests/Functional/Driver/IBMDB2/DriverTest.php b/tests/Functional/Driver/IBMDB2/DriverTest.php index 61009bacf7c..4b1da389b21 100644 --- a/tests/Functional/Driver/IBMDB2/DriverTest.php +++ b/tests/Functional/Driver/IBMDB2/DriverTest.php @@ -9,9 +9,7 @@ use Doctrine\DBAL\Tests\Functional\Driver\AbstractDriverTest; use Doctrine\DBAL\Tests\TestUtil; -/** - * @requires extension ibm_db2 - */ +/** @requires extension ibm_db2 */ class DriverTest extends AbstractDriverTest { protected function setUp(): void diff --git a/tests/Functional/Driver/Mysqli/ConnectionTest.php b/tests/Functional/Driver/Mysqli/ConnectionTest.php index d7cd4ccf29e..418453658b9 100644 --- a/tests/Functional/Driver/Mysqli/ConnectionTest.php +++ b/tests/Functional/Driver/Mysqli/ConnectionTest.php @@ -14,9 +14,7 @@ use const MYSQLI_OPT_CONNECT_TIMEOUT; -/** - * @require extension mysqli - */ +/** @require extension mysqli */ class ConnectionTest extends FunctionalTestCase { protected function setUp(): void @@ -49,14 +47,12 @@ public function testInvalidCharset(): void (new Driver())->connect( array_merge( $params, - ['charset' => 'invalid'] - ) + ['charset' => 'invalid'], + ), ); } - /** - * @param mixed[] $driverOptions - */ + /** @param mixed[] $driverOptions */ private function getConnection(array $driverOptions): Connection { $params = TestUtil::getConnectionParams(); @@ -72,8 +68,8 @@ private function getConnection(array $driverOptions): Connection return (new Driver())->connect( array_merge( $params, - ['driverOptions' => $driverOptions] - ) + ['driverOptions' => $driverOptions], + ), ); } } diff --git a/tests/Functional/Driver/Mysqli/DriverTest.php b/tests/Functional/Driver/Mysqli/DriverTest.php index d83ba29be4e..b2f4b914b7a 100644 --- a/tests/Functional/Driver/Mysqli/DriverTest.php +++ b/tests/Functional/Driver/Mysqli/DriverTest.php @@ -9,9 +9,7 @@ use Doctrine\DBAL\Tests\Functional\Driver\AbstractDriverTest; use Doctrine\DBAL\Tests\TestUtil; -/** - * @requires extension mysqli - */ +/** @requires extension mysqli */ class DriverTest extends AbstractDriverTest { protected function setUp(): void diff --git a/tests/Functional/Driver/OCI8/DriverTest.php b/tests/Functional/Driver/OCI8/DriverTest.php index 7d1b184ce7f..37dd67f85c7 100644 --- a/tests/Functional/Driver/OCI8/DriverTest.php +++ b/tests/Functional/Driver/OCI8/DriverTest.php @@ -9,9 +9,7 @@ use Doctrine\DBAL\Tests\Functional\Driver\AbstractDriverTest; use Doctrine\DBAL\Tests\TestUtil; -/** - * @requires extension oci8 - */ +/** @requires extension oci8 */ class DriverTest extends AbstractDriverTest { protected function setUp(): void diff --git a/tests/Functional/Driver/OCI8/ResultTest.php b/tests/Functional/Driver/OCI8/ResultTest.php index 64922e6986d..976f2b24cc4 100644 --- a/tests/Functional/Driver/OCI8/ResultTest.php +++ b/tests/Functional/Driver/OCI8/ResultTest.php @@ -15,9 +15,7 @@ use const E_ALL; use const E_WARNING; -/** - * @requires extension oci8 - */ +/** @requires extension oci8 */ class ResultTest extends FunctionalTestCase { /** @@ -55,7 +53,7 @@ protected function tearDown(): void * @dataProvider dataProviderForTestTruncatedFetch */ public function testTruncatedFetch( - bool $invalidateDataMidFetch + bool $invalidateDataMidFetch, ): void { if ($invalidateDataMidFetch) { // prevent the PHPUnit error handler from handling the warnings that oci_*() functions may trigger @@ -78,7 +76,7 @@ public function testTruncatedFetch( // Query the pipelined function to get initial dataset $statement = $separateConnection->prepare(sprintf( 'SELECT * FROM TABLE(%s.test_oracle_fetch_failure())', - $this->connectionParams['user'] + $this->connectionParams['user'], )); $result = $statement->executeQuery(); @@ -114,8 +112,8 @@ public function testTruncatedFetch( sprintf( 'Expected to have %s total rows fetched but only found %s rows fetched', $expectedTotalRowCount, - $result->rowCount() - ) + $result->rowCount(), + ), ); } @@ -131,7 +129,7 @@ public function dataProviderForTestTruncatedFetch(): Generator private function createReturnTypeNeededForPipelinedFunction(): void { $this->connection->executeQuery( - 'CREATE TYPE return_numbers AS TABLE OF NUMBER(11)' + 'CREATE TYPE return_numbers AS TABLE OF NUMBER(11)', ); } @@ -160,7 +158,7 @@ private function createOrReplacePipelinedFunction(int $totalRowCount): void RETURN; END;', - $totalRowCount + $totalRowCount, )); } } diff --git a/tests/Functional/Driver/OCI8/StatementTest.php b/tests/Functional/Driver/OCI8/StatementTest.php index 6a96ed1f5f9..3050346e32f 100644 --- a/tests/Functional/Driver/OCI8/StatementTest.php +++ b/tests/Functional/Driver/OCI8/StatementTest.php @@ -7,9 +7,7 @@ use Doctrine\DBAL\Tests\FunctionalTestCase; use Doctrine\DBAL\Tests\TestUtil; -/** - * @requires extension oci8 - */ +/** @requires extension oci8 */ class StatementTest extends FunctionalTestCase { protected function setUp(): void @@ -31,13 +29,11 @@ public function testQueryConversion(string $query, array $params, array $expecte { self::assertEquals( $expected, - $this->connection->executeQuery($query, $params)->fetchAssociative() + $this->connection->executeQuery($query, $params)->fetchAssociative(), ); } - /** - * @return array> - */ + /** @return array> */ public static function queryConversionProvider(): iterable { return [ @@ -97,7 +93,7 @@ public function testBindPositionalParameter(): void self::assertEquals( ['COL1' => 1], $statement->executeQuery() - ->fetchAssociative() + ->fetchAssociative(), ); } } diff --git a/tests/Functional/Driver/PDO/MySQL/DriverTest.php b/tests/Functional/Driver/PDO/MySQL/DriverTest.php index 17f4056687b..d8214c376fc 100644 --- a/tests/Functional/Driver/PDO/MySQL/DriverTest.php +++ b/tests/Functional/Driver/PDO/MySQL/DriverTest.php @@ -9,9 +9,7 @@ use Doctrine\DBAL\Tests\Functional\Driver\AbstractDriverTest; use Doctrine\DBAL\Tests\TestUtil; -/** - * @requires extension pdo_mysql - */ +/** @requires extension pdo_mysql */ class DriverTest extends AbstractDriverTest { protected function setUp(): void diff --git a/tests/Functional/Driver/PDO/OCI/DriverTest.php b/tests/Functional/Driver/PDO/OCI/DriverTest.php index 9f3178b6cec..3fab909199e 100644 --- a/tests/Functional/Driver/PDO/OCI/DriverTest.php +++ b/tests/Functional/Driver/PDO/OCI/DriverTest.php @@ -9,9 +9,7 @@ use Doctrine\DBAL\Tests\Functional\Driver\AbstractDriverTest; use Doctrine\DBAL\Tests\TestUtil; -/** - * @requires extension pdo_oci - */ +/** @requires extension pdo_oci */ class DriverTest extends AbstractDriverTest { protected function setUp(): void diff --git a/tests/Functional/Driver/PDO/PgSQL/ConnectionTest.php b/tests/Functional/Driver/PDO/PgSQL/ConnectionTest.php index 1ccb7607723..fc80de40aee 100644 --- a/tests/Functional/Driver/PDO/PgSQL/ConnectionTest.php +++ b/tests/Functional/Driver/PDO/PgSQL/ConnectionTest.php @@ -8,9 +8,7 @@ use Doctrine\DBAL\Tests\FunctionalTestCase; use Doctrine\DBAL\Tests\TestUtil; -/** - * @requires extension pdo_pgsql - */ +/** @requires extension pdo_pgsql */ class ConnectionTest extends FunctionalTestCase { protected function setUp(): void @@ -22,9 +20,7 @@ protected function setUp(): void self::markTestSkipped('This test requires the pdo_pgsql driver.'); } - /** - * @dataProvider getValidCharsets - */ + /** @dataProvider getValidCharsets */ public function testConnectsWithValidCharsetOption(string $charset): void { $params = $this->connection->getParams(); @@ -33,18 +29,16 @@ public function testConnectsWithValidCharsetOption(string $charset): void $connection = DriverManager::getConnection( $params, $this->connection->getConfiguration(), - $this->connection->getEventManager() + $this->connection->getEventManager(), ); self::assertEquals( $charset, - $connection->fetchOne('SHOW client_encoding') + $connection->fetchOne('SHOW client_encoding'), ); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function getValidCharsets(): iterable { return [ diff --git a/tests/Functional/Driver/PDO/PgSQL/DriverTest.php b/tests/Functional/Driver/PDO/PgSQL/DriverTest.php index bd1913fe4d4..cbfcd3a4f8b 100644 --- a/tests/Functional/Driver/PDO/PgSQL/DriverTest.php +++ b/tests/Functional/Driver/PDO/PgSQL/DriverTest.php @@ -14,9 +14,7 @@ use function microtime; use function sprintf; -/** - * @requires extension pdo_pgsql - */ +/** @requires extension pdo_pgsql */ class DriverTest extends AbstractDriverTest { protected function setUp(): void @@ -30,13 +28,11 @@ protected function setUp(): void self::markTestSkipped('This test requires the pdo_pgsql driver.'); } - /** - * @dataProvider getDatabaseParameter - */ + /** @dataProvider getDatabaseParameter */ public function testDatabaseParameters( ?string $databaseName, ?string $defaultDatabaseName, - ?string $expectedDatabaseName + ?string $expectedDatabaseName, ): void { $params = $this->connection->getParams(); @@ -54,18 +50,16 @@ public function testDatabaseParameters( $params, $this->connection->getDriver(), $this->connection->getConfiguration(), - $this->connection->getEventManager() + $this->connection->getEventManager(), ); self::assertSame( $expectedDatabaseName, - $connection->getDatabase() + $connection->getDatabase(), ); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function getDatabaseParameter(): iterable { $params = TestUtil::getConnectionParams(); diff --git a/tests/Functional/Driver/PDO/SQLSrv/DriverTest.php b/tests/Functional/Driver/PDO/SQLSrv/DriverTest.php index 32b8f9e4ff3..38e81b42528 100644 --- a/tests/Functional/Driver/PDO/SQLSrv/DriverTest.php +++ b/tests/Functional/Driver/PDO/SQLSrv/DriverTest.php @@ -13,9 +13,7 @@ use function array_merge; -/** - * @requires extension pdo_sqlsrv - */ +/** @requires extension pdo_sqlsrv */ class DriverTest extends AbstractDriverTest { protected function setUp(): void @@ -39,9 +37,7 @@ protected static function getDatabaseNameForConnectionWithoutDatabaseNameParamet return 'master'; } - /** - * @param int[]|string[] $driverOptions - */ + /** @param int[]|string[] $driverOptions */ private function getConnection(array $driverOptions): Connection { $params = TestUtil::getConnectionParams(); @@ -53,8 +49,8 @@ private function getConnection(array $driverOptions): Connection return (new Driver())->connect( array_merge( $params, - ['driverOptions' => $driverOptions] - ) + ['driverOptions' => $driverOptions], + ), ); } @@ -74,7 +70,7 @@ public function testDriverOptions(): void PDO::CASE_UPPER, $connection ->getNativeConnection() - ->getAttribute(PDO::ATTR_CASE) + ->getAttribute(PDO::ATTR_CASE), ); } } diff --git a/tests/Functional/Driver/PDO/SQLite/DriverTest.php b/tests/Functional/Driver/PDO/SQLite/DriverTest.php index e311da34ac2..c6bc983579b 100644 --- a/tests/Functional/Driver/PDO/SQLite/DriverTest.php +++ b/tests/Functional/Driver/PDO/SQLite/DriverTest.php @@ -9,9 +9,7 @@ use Doctrine\DBAL\Tests\Functional\Driver\AbstractDriverTest; use Doctrine\DBAL\Tests\TestUtil; -/** - * @requires extension pdo_sqlite - */ +/** @requires extension pdo_sqlite */ class DriverTest extends AbstractDriverTest { protected function setUp(): void diff --git a/tests/Functional/Driver/SQLSrv/DriverTest.php b/tests/Functional/Driver/SQLSrv/DriverTest.php index a29423498db..e1200b6b6f3 100644 --- a/tests/Functional/Driver/SQLSrv/DriverTest.php +++ b/tests/Functional/Driver/SQLSrv/DriverTest.php @@ -9,9 +9,7 @@ use Doctrine\DBAL\Tests\Functional\Driver\AbstractDriverTest; use Doctrine\DBAL\Tests\TestUtil; -/** - * @requires extension sqlsrv - */ +/** @requires extension sqlsrv */ class DriverTest extends AbstractDriverTest { protected function setUp(): void diff --git a/tests/Functional/ExceptionTest.php b/tests/Functional/ExceptionTest.php index 6ad09c1fa9e..d16e4d89c15 100644 --- a/tests/Functional/ExceptionTest.php +++ b/tests/Functional/ExceptionTest.php @@ -27,9 +27,7 @@ use const E_WARNING; use const PHP_OS_FAMILY; -/** - * @psalm-import-type Params from DriverManager - */ +/** @psalm-import-type Params from DriverManager */ class ExceptionTest extends FunctionalTestCase { public function testPrimaryConstraintViolationException(): void @@ -166,7 +164,7 @@ public function testConnectionExceptionSqLite(): void $this->expectException(Exception\ReadOnlyException::class); $this->expectExceptionMessage( 'An exception occurred while executing a query: SQLSTATE[HY000]: ' . - 'General error: 8 attempt to write a readonly database' + 'General error: 8 attempt to write a readonly database', ); try { @@ -192,7 +190,7 @@ public function testInvalidHost(): void { if (TestUtil::isDriverOneOf('pdo_sqlsrv', 'sqlsrv')) { self::markTestSkipped( - 'Some sqlsrv and pdo_sqlsrv versions do not provide the exception code or SQLSTATE for login timeout' + 'Some sqlsrv and pdo_sqlsrv versions do not provide the exception code or SQLSTATE for login timeout', ); } @@ -221,9 +219,7 @@ private function testConnectionException(array $params): void $conn->executeQuery($platform->getDummySelectSQL()); } - /** - * @return array> - */ + /** @return array> */ public static function getConnectionParams(): iterable { return [ diff --git a/tests/Functional/FetchBooleanTest.php b/tests/Functional/FetchBooleanTest.php index 690784f5209..f51b3c8239d 100644 --- a/tests/Functional/FetchBooleanTest.php +++ b/tests/Functional/FetchBooleanTest.php @@ -18,20 +18,16 @@ protected function setUp(): void self::markTestSkipped('Only PostgreSQL supports boolean values natively'); } - /** - * @dataProvider booleanLiteralProvider - */ + /** @dataProvider booleanLiteralProvider */ public function testBooleanConversionSqlLiteral(string $literal, bool $expected): void { self::assertSame([$expected], $this->connection->fetchNumeric( $this->connection->getDatabasePlatform() - ->getDummySelectSQL($literal) + ->getDummySelectSQL($literal), )); } - /** - * @return iterable - */ + /** @return iterable */ public function booleanLiteralProvider(): iterable { yield ['true', true]; diff --git a/tests/Functional/LegacyAPITest.php b/tests/Functional/LegacyAPITest.php index fcd4e482fdb..1d85f4f2d79 100644 --- a/tests/Functional/LegacyAPITest.php +++ b/tests/Functional/LegacyAPITest.php @@ -144,7 +144,7 @@ public function testExecuteUpdate(): void $this->connection->executeUpdate( 'INSERT INTO legacy_table (test_int, test_string) VALUES (?, ?)', [2, 'bar'], - ['integer', 'string'] + ['integer', 'string'], ); $sql = 'SELECT test_string FROM legacy_table'; diff --git a/tests/Functional/LikeWildcardsEscapingTest.php b/tests/Functional/LikeWildcardsEscapingTest.php index 9e6b8707e8c..0facc69d4b6 100644 --- a/tests/Functional/LikeWildcardsEscapingTest.php +++ b/tests/Functional/LikeWildcardsEscapingTest.php @@ -22,9 +22,9 @@ public function testFetchLikeExpressionResult(): void "(CASE WHEN '%s' LIKE '%s' ESCAPE '%s' THEN 1 ELSE 0 END)", $string, $databasePlatform->escapeStringForLike($string, $escapeChar), - $escapeChar - ) - ) + $escapeChar, + ), + ), )->executeQuery(); self::assertTrue((bool) $result->fetchOne()); diff --git a/tests/Functional/ModifyLimitQueryTest.php b/tests/Functional/ModifyLimitQueryTest.php index fa968424d72..82549385c34 100644 --- a/tests/Functional/ModifyLimitQueryTest.php +++ b/tests/Functional/ModifyLimitQueryTest.php @@ -138,7 +138,7 @@ public function testModifyLimitQueryLineBreaks(): void $this->connection->insert('modify_limit_table', ['test_int' => 2]); $this->connection->insert('modify_limit_table', ['test_int' => 3]); - $sql = <<assertLimitResult([1, 2], $sql, null, 0); } - /** - * @param array $expectedResults - */ + /** @param array $expectedResults */ private function assertLimitResult( array $expectedResults, string $sql, ?int $limit, int $offset, - bool $deterministic = true + bool $deterministic = true, ): void { $p = $this->connection->getDatabasePlatform(); $data = []; diff --git a/tests/Functional/NamedParametersTest.php b/tests/Functional/NamedParametersTest.php index f5d3e9d0624..cff5346792f 100644 --- a/tests/Functional/NamedParametersTest.php +++ b/tests/Functional/NamedParametersTest.php @@ -16,9 +16,7 @@ class NamedParametersTest extends FunctionalTestCase { - /** - * @return iterable> - */ + /** @return iterable> */ public static function ticketProvider(): iterable { return [ diff --git a/tests/Functional/Platform/AlterDecimalColumnTest.php b/tests/Functional/Platform/AlterDecimalColumnTest.php index 157def52227..8d9c8676fb1 100644 --- a/tests/Functional/Platform/AlterDecimalColumnTest.php +++ b/tests/Functional/Platform/AlterDecimalColumnTest.php @@ -10,9 +10,7 @@ class AlterDecimalColumnTest extends FunctionalTestCase { - /** - * @dataProvider scaleAndPrecisionProvider - */ + /** @dataProvider scaleAndPrecisionProvider */ public function testAlterPrecisionAndScale(int $newPrecision, int $newScale): void { $table = new Table('decimal_table'); @@ -37,9 +35,7 @@ public function testAlterPrecisionAndScale(int $newPrecision, int $newScale): vo self::assertSame($newScale, $column->getScale()); } - /** - * @return iterable - */ + /** @return iterable */ public function scaleAndPrecisionProvider(): iterable { yield 'Precision' => [12, 6]; diff --git a/tests/Functional/Platform/ColumnTest.php b/tests/Functional/Platform/ColumnTest.php index b9abf86a594..2f6bb536dfe 100644 --- a/tests/Functional/Platform/ColumnTest.php +++ b/tests/Functional/Platform/ColumnTest.php @@ -19,25 +19,19 @@ public function testVariableLengthStringNoLength(): void $this->assertColumn(Types::STRING, [], 'Test', ParameterType::STRING); } - /** - * @dataProvider string8Provider - */ + /** @dataProvider string8Provider */ public function testVariableLengthStringWithLength(string $value): void { $this->assertColumn(Types::STRING, ['length' => 8], $value, ParameterType::STRING); } - /** - * @dataProvider string1Provider - */ + /** @dataProvider string1Provider */ public function testFixedLengthStringNoLength(string $value): void { $this->assertColumn(Types::STRING, ['fixed' => true], $value, ParameterType::STRING); } - /** - * @dataProvider string8Provider - */ + /** @dataProvider string8Provider */ public function testFixedLengthStringWithLength(string $value): void { $this->assertColumn(Types::STRING, [ @@ -46,9 +40,7 @@ public function testFixedLengthStringWithLength(string $value): void ], $value, ParameterType::STRING); } - /** - * @return iterable> - */ + /** @return iterable> */ public static function string1Provider(): iterable { return [ @@ -57,9 +49,7 @@ public static function string1Provider(): iterable ]; } - /** - * @return iterable> - */ + /** @return iterable> */ public static function string8Provider(): iterable { return [ @@ -100,9 +90,7 @@ protected function requirePlatform(string $class): void self::markTestSkipped(sprintf('The test requires %s', $class)); } - /** - * @param array $column - */ + /** @param array $column */ protected function assertColumn(string $type, array $column, string $value, ParameterType $bindType): void { $table = new Table('column_test'); @@ -114,7 +102,7 @@ protected function assertColumn(string $type, array $column, string $value, Para self::assertSame($value, Type::getType($type)->convertToPHPValue( $this->connection->fetchOne('SELECT val FROM column_test'), - $this->connection->getDatabasePlatform() + $this->connection->getDatabasePlatform(), )); } } diff --git a/tests/Functional/Platform/ConcatExpressionTest.php b/tests/Functional/Platform/ConcatExpressionTest.php index 87f158bebfb..33f47038a86 100644 --- a/tests/Functional/Platform/ConcatExpressionTest.php +++ b/tests/Functional/Platform/ConcatExpressionTest.php @@ -21,9 +21,7 @@ public function testConcatExpression(array $arguments, string $expected): void self::assertEquals($expected, $this->connection->fetchOne($query)); } - /** - * @return iterable,string}> - */ + /** @return iterable,string}> */ public static function expressionProvider(): iterable { yield 'strings' => [["'foo'", "'bar'"], 'foobar']; diff --git a/tests/Functional/Platform/DateExpressionTest.php b/tests/Functional/Platform/DateExpressionTest.php index bd2a155aa3c..a3d9b5f83d4 100644 --- a/tests/Functional/Platform/DateExpressionTest.php +++ b/tests/Functional/Platform/DateExpressionTest.php @@ -12,9 +12,7 @@ class DateExpressionTest extends FunctionalTestCase { - /** - * @dataProvider differenceProvider - */ + /** @dataProvider differenceProvider */ public function testDifference(string $date1, string $date2, int $expected): void { $table = new Table('date_expr_test'); @@ -34,15 +32,13 @@ public function testDifference(string $date1, string $date2, int $expected): voi self::assertEquals($expected, $diff); } - /** - * @return array> - */ + /** @return array> */ public static function differenceProvider(): iterable { $date1 = new DateTimeImmutable(); $date2 = new DateTimeImmutable('2018-04-10 10:10:10'); $expected = $date1->modify('midnight')->diff( - $date2->modify('midnight') + $date2->modify('midnight'), )->days; return [ diff --git a/tests/Functional/Platform/DefaultExpressionTest.php b/tests/Functional/Platform/DefaultExpressionTest.php index 540ef6db88b..edc955ca3a5 100644 --- a/tests/Functional/Platform/DefaultExpressionTest.php +++ b/tests/Functional/Platform/DefaultExpressionTest.php @@ -65,8 +65,8 @@ private function assertDefaultExpression(string $type, callable $expression): vo $this->connection->executeStatement( sprintf( 'INSERT INTO default_expr_test (actual_value) VALUES (%s)', - $defaultSql - ) + $defaultSql, + ), ); $row = $this->connection->fetchNumeric('SELECT default_value, actual_value FROM default_expr_test'); diff --git a/tests/Functional/Platform/LengthExpressionTest.php b/tests/Functional/Platform/LengthExpressionTest.php index 36c53d450ec..1c15f5a1e8b 100644 --- a/tests/Functional/Platform/LengthExpressionTest.php +++ b/tests/Functional/Platform/LengthExpressionTest.php @@ -32,9 +32,7 @@ public function testLengthExpression(string $value, int $expected, bool $isMulti self::assertEquals($expected, $this->connection->fetchOne($query, [$value])); } - /** - * @return iterable - */ + /** @return iterable */ public static function expressionProvider(): iterable { yield '1-byte' => ['Hello, world!', 13, false]; diff --git a/tests/Functional/Platform/QuotingTest.php b/tests/Functional/Platform/QuotingTest.php index 7f6ec7fb43c..7018b8d27f3 100644 --- a/tests/Functional/Platform/QuotingTest.php +++ b/tests/Functional/Platform/QuotingTest.php @@ -11,22 +11,18 @@ class QuotingTest extends FunctionalTestCase { - /** - * @dataProvider stringLiteralProvider - */ + /** @dataProvider stringLiteralProvider */ public function testQuoteStringLiteral(string $string): void { $platform = $this->connection->getDatabasePlatform(); $query = $platform->getDummySelectSQL( - $platform->quoteStringLiteral($string) + $platform->quoteStringLiteral($string), ); self::assertSame($string, $this->connection->fetchOne($query)); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function stringLiteralProvider(): iterable { return [ @@ -35,22 +31,18 @@ public static function stringLiteralProvider(): iterable ]; } - /** - * @dataProvider identifierProvider - */ + /** @dataProvider identifierProvider */ public function testQuoteIdentifier(string $identifier): void { $platform = $this->connection->getDatabasePlatform(); - /** - * @link https://docs.oracle.com/cd/B19306_01/server.102/b14200/sql_elements008.htm - */ + /** @link https://docs.oracle.com/cd/B19306_01/server.102/b14200/sql_elements008.htm */ if ($platform instanceof OraclePlatform && $identifier === '"') { self::markTestSkipped('Oracle does not support double quotes in identifiers'); } $query = $platform->getDummySelectSQL( - 'NULL AS ' . $platform->quoteIdentifier($identifier) + 'NULL AS ' . $platform->quoteIdentifier($identifier), ); $row = $this->connection->fetchAssociative($query); @@ -59,9 +51,7 @@ public function testQuoteIdentifier(string $identifier): void self::assertSame($identifier, key($row)); } - /** - * @return iterable - */ + /** @return iterable */ public static function identifierProvider(): iterable { return [ diff --git a/tests/Functional/Platform/RenameColumnTest.php b/tests/Functional/Platform/RenameColumnTest.php index a75ed6dc914..f2432438ef6 100644 --- a/tests/Functional/Platform/RenameColumnTest.php +++ b/tests/Functional/Platform/RenameColumnTest.php @@ -9,9 +9,7 @@ class RenameColumnTest extends FunctionalTestCase { - /** - * @dataProvider columnNameProvider - */ + /** @dataProvider columnNameProvider */ public function testColumnPositionRetainedAfterRenaming(string $columnName, string $newColumnName): void { $table = new Table('test_rename'); @@ -38,9 +36,7 @@ public function testColumnPositionRetainedAfterRenaming(string $columnName, stri self::assertEqualsIgnoringCase('c2', $columns[1]->getName()); } - /** - * @return iterable - */ + /** @return iterable */ public static function columnNameProvider(): iterable { yield ['c1', 'c1_x']; diff --git a/tests/Functional/PortabilityTest.php b/tests/Functional/PortabilityTest.php index 2b1a86d7859..ef26ff055fc 100644 --- a/tests/Functional/PortabilityTest.php +++ b/tests/Functional/PortabilityTest.php @@ -63,18 +63,14 @@ public function testCaseConversion(ColumnCase $case, array $expected): void self::assertSame($expected, array_keys($row)); } - /** - * @return iterable}> - */ + /** @return iterable}> */ public static function caseProvider(): iterable { yield 'lower' => [ColumnCase::LOWER, ['test_int', 'test_string', 'test_null']]; yield 'upper' => [ColumnCase::UPPER, ['TEST_INT', 'TEST_STRING', 'TEST_NULL']]; } - /** - * @param array> $rows - */ + /** @param array> $rows */ private function assertFetchResultRows(array $rows): void { self::assertCount(2, $rows); @@ -83,14 +79,12 @@ private function assertFetchResultRows(array $rows): void } } - /** - * @param array $row - */ + /** @param array $row */ public function assertFetchResultRow(array $row): void { self::assertThat($row['test_int'], self::logicalOr( self::equalTo(1), - self::equalTo(2) + self::equalTo(2), )); self::assertArrayHasKey('test_string', $row, 'Case should be lowered.'); @@ -114,9 +108,7 @@ public function testFetchColumn(string $column, array $expected): void self::assertEquals($expected, $result->fetchFirstColumn()); } - /** - * @return iterable> - */ + /** @return iterable> */ public static function fetchColumnProvider(): iterable { return [ @@ -156,8 +148,8 @@ private function connectWithPortability(int $mode, ?ColumnCase $case): void $configuration->setMiddlewares( array_merge( $configuration->getMiddlewares(), - [new Middleware($mode, $case)] - ) + [new Middleware($mode, $case)], + ), ); $this->connection = DriverManager::getConnection($this->connection->getParams(), $configuration); diff --git a/tests/Functional/PrimaryReadReplicaConnectionTest.php b/tests/Functional/PrimaryReadReplicaConnectionTest.php index 27af8c59e66..08f9c180ab2 100644 --- a/tests/Functional/PrimaryReadReplicaConnectionTest.php +++ b/tests/Functional/PrimaryReadReplicaConnectionTest.php @@ -15,9 +15,7 @@ use const CASE_LOWER; -/** - * @psalm-import-type Params from DriverManager - */ +/** @psalm-import-type Params from DriverManager */ class PrimaryReadReplicaConnectionTest extends FunctionalTestCase { protected function setUp(): void diff --git a/tests/Functional/ResultTest.php b/tests/Functional/ResultTest.php index 80fb09436ea..091a60405db 100644 --- a/tests/Functional/ResultTest.php +++ b/tests/Functional/ResultTest.php @@ -11,9 +11,7 @@ class ResultTest extends FunctionalTestCase { - /** - * @dataProvider methodProvider - */ + /** @dataProvider methodProvider */ public function testExceptionHandling(callable $method): void { if (! TestUtil::isDriverOneOf('mysqli', 'ibm_db2')) { @@ -22,7 +20,7 @@ public function testExceptionHandling(callable $method): void $result = $this->connection->executeQuery( $this->connection->getDatabasePlatform() - ->getDummySelectSQL() + ->getDummySelectSQL(), ); $result->free(); @@ -30,9 +28,7 @@ public function testExceptionHandling(callable $method): void $method($result); } - /** - * @return iterable - */ + /** @return iterable */ public static function methodProvider(): iterable { yield 'fetchNumeric' => [ diff --git a/tests/Functional/SQL/Builder/CreateAndDropSchemaObjectsSQLBuilderTest.php b/tests/Functional/SQL/Builder/CreateAndDropSchemaObjectsSQLBuilderTest.php index ed51bf695d4..576ffcfb711 100644 --- a/tests/Functional/SQL/Builder/CreateAndDropSchemaObjectsSQLBuilderTest.php +++ b/tests/Functional/SQL/Builder/CreateAndDropSchemaObjectsSQLBuilderTest.php @@ -42,7 +42,7 @@ private function createTable(Schema $schema, string $name, string $otherName): v private function introspectForeignKey( AbstractSchemaManager $schemaManager, string $tableName, - string $expectedForeignTableName + string $expectedForeignTableName, ): void { $foreignKeys = $schemaManager->listTableForeignKeys($tableName); self::assertCount(1, $foreignKeys); diff --git a/tests/Functional/Schema/ColumnCommentTest.php b/tests/Functional/Schema/ColumnCommentTest.php index eae796a8355..eef286d6302 100644 --- a/tests/Functional/Schema/ColumnCommentTest.php +++ b/tests/Functional/Schema/ColumnCommentTest.php @@ -44,9 +44,7 @@ public function testColumnComment(string $name, string $type, array $options): v $this->assertColumnComment('column_comments', $name, $options['comment'] ?? ''); } - /** - * @return iterable - */ + /** @return iterable */ public static function columnProvider(): iterable { foreach ( @@ -81,9 +79,7 @@ public static function columnProvider(): iterable } } - /** - * @dataProvider alterColumnCommentProvider - */ + /** @dataProvider alterColumnCommentProvider */ public function testAlterColumnComment(string $comment1, string $comment2): void { $table1 = new Table('column_comments'); @@ -105,9 +101,7 @@ public function testAlterColumnComment(string $comment1, string $comment2): void $this->assertColumnComment('column_comments', 'id', $comment2); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function alterColumnCommentProvider(): iterable { return [ @@ -126,7 +120,7 @@ private function assertColumnComment(string $table, string $column, string $expe $this->connection->createSchemaManager() ->introspectTable($table) ->getColumn($column) - ->getComment() + ->getComment(), ); } } diff --git a/tests/Functional/Schema/ComparatorTest.php b/tests/Functional/Schema/ComparatorTest.php index 0065942d105..8a8d821c85b 100644 --- a/tests/Functional/Schema/ComparatorTest.php +++ b/tests/Functional/Schema/ComparatorTest.php @@ -20,9 +20,7 @@ protected function setUp(): void $this->schemaManager = $this->connection->createSchemaManager(); } - /** - * @dataProvider defaultValueProvider - */ + /** @dataProvider defaultValueProvider */ public function testDefaultValueComparison(string $type, mixed $value): void { $platform = $this->connection->getDatabasePlatform(); @@ -43,13 +41,11 @@ public function testDefaultValueComparison(string $type, mixed $value): void self::assertNull( $this->schemaManager->createComparator() - ->diffTable($table, $onlineTable) + ->diffTable($table, $onlineTable), ); } - /** - * @return iterable - */ + /** @return iterable */ public static function defaultValueProvider(): iterable { return [ diff --git a/tests/Functional/Schema/ComparatorTestUtils.php b/tests/Functional/Schema/ComparatorTestUtils.php index b75c3c04c63..30204b401cd 100644 --- a/tests/Functional/Schema/ComparatorTestUtils.php +++ b/tests/Functional/Schema/ComparatorTestUtils.php @@ -14,31 +14,27 @@ final class ComparatorTestUtils { - /** - * @throws Exception - */ + /** @throws Exception */ public static function diffFromActualToDesiredTable( AbstractSchemaManager $schemaManager, Comparator $comparator, - Table $desiredTable + Table $desiredTable, ): ?TableDiff { return $comparator->diffTable( $schemaManager->introspectTable($desiredTable->getName()), - $desiredTable + $desiredTable, ); } - /** - * @throws Exception - */ + /** @throws Exception */ public static function diffFromDesiredToActualTable( AbstractSchemaManager $schemaManager, Comparator $comparator, - Table $desiredTable + Table $desiredTable, ): ?TableDiff { return $comparator->diffTable( $desiredTable, - $schemaManager->introspectTable($desiredTable->getName()) + $schemaManager->introspectTable($desiredTable->getName()), ); } diff --git a/tests/Functional/Schema/DefaultValueTest.php b/tests/Functional/Schema/DefaultValueTest.php index dc9eec8ad4c..36e136bc6d6 100644 --- a/tests/Functional/Schema/DefaultValueTest.php +++ b/tests/Functional/Schema/DefaultValueTest.php @@ -29,9 +29,7 @@ protected function setUp(): void $this->connection->insert('default_value', ['id' => 1]); } - /** - * @dataProvider columnProvider - */ + /** @dataProvider columnProvider */ public function testEscapedDefaultValueCanBeIntrospected(string $name, ?string $expectedDefault): void { self::assertSame( @@ -40,17 +38,15 @@ public function testEscapedDefaultValueCanBeIntrospected(string $name, ?string $ ->createSchemaManager() ->introspectTable('default_value') ->getColumn($name) - ->getDefault() + ->getDefault(), ); } - /** - * @dataProvider columnProvider - */ + /** @dataProvider columnProvider */ public function testEscapedDefaultValueCanBeInserted(string $name, ?string $expectedDefault): void { $value = $this->connection->fetchOne( - sprintf('SELECT %s FROM default_value', $name) + sprintf('SELECT %s FROM default_value', $name), ); self::assertSame($expectedDefault, $value); diff --git a/tests/Functional/Schema/MySQL/ComparatorTest.php b/tests/Functional/Schema/MySQL/ComparatorTest.php index 8b17a4d739c..5c430177f3d 100644 --- a/tests/Functional/Schema/MySQL/ComparatorTest.php +++ b/tests/Functional/Schema/MySQL/ComparatorTest.php @@ -35,9 +35,7 @@ protected function setUp(): void $this->comparator = $this->schemaManager->createComparator(); } - /** - * @dataProvider lobColumnProvider - */ + /** @dataProvider lobColumnProvider */ public function testLobLengthIncrementWithinLimit(string $type, int $length): void { $table = $this->createLobTable($type, $length - 1); @@ -46,19 +44,17 @@ public function testLobLengthIncrementWithinLimit(string $type, int $length): vo self::assertNull(ComparatorTestUtils::diffFromActualToDesiredTable( $this->schemaManager, $this->comparator, - $table + $table, )); self::assertNull(ComparatorTestUtils::diffFromDesiredToActualTable( $this->schemaManager, $this->comparator, - $table + $table, )); } - /** - * @dataProvider lobColumnProvider - */ + /** @dataProvider lobColumnProvider */ public function testLobLengthIncrementOverLimit(string $type, int $length): void { $table = $this->createLobTable($type, $length); @@ -66,9 +62,7 @@ public function testLobLengthIncrementOverLimit(string $type, int $length): void ComparatorTestUtils::assertDiffNotEmpty($this->connection, $this->comparator, $table); } - /** - * @return iterable - */ + /** @return iterable */ public static function lobColumnProvider(): iterable { yield [Types::BLOB, AbstractMySQLPlatform::LENGTH_LIMIT_TINYBLOB]; @@ -80,9 +74,7 @@ public static function lobColumnProvider(): iterable yield [Types::TEXT, AbstractMySQLPlatform::LENGTH_LIMIT_MEDIUMTEXT]; } - /** - * @throws Exception - */ + /** @throws Exception */ private function createLobTable(string $type, int $length): Table { $table = new Table('comparator_test'); @@ -93,9 +85,7 @@ private function createLobTable(string $type, int $length): Table return $table; } - /** - * @throws Exception - */ + /** @throws Exception */ private function setBlobLength(Table $table, int $length): void { $table->getColumn('lob')->setLength($length); @@ -109,13 +99,13 @@ public function testExplicitDefaultCollation(): void self::assertNull(ComparatorTestUtils::diffFromActualToDesiredTable( $this->schemaManager, $this->comparator, - $table + $table, )); self::assertNull(ComparatorTestUtils::diffFromDesiredToActualTable( $this->schemaManager, $this->comparator, - $table + $table, )); } @@ -155,19 +145,17 @@ public function testTableAndColumnOptions(array $tableOptions, array $columnOpti self::assertNull(ComparatorTestUtils::diffFromActualToDesiredTable( $this->schemaManager, $this->comparator, - $table + $table, )); self::assertNull(ComparatorTestUtils::diffFromDesiredToActualTable( $this->schemaManager, $this->comparator, - $table + $table, )); } - /** - * @return iterable,array}> - */ + /** @return iterable,array}> */ public static function tableAndColumnOptionsProvider(): iterable { yield "Column collation explicitly set to its table's default" => [ diff --git a/tests/Functional/Schema/MySQLSchemaManagerTest.php b/tests/Functional/Schema/MySQLSchemaManagerTest.php index 513a9c61603..1a7f22d63aa 100644 --- a/tests/Functional/Schema/MySQLSchemaManagerTest.php +++ b/tests/Functional/Schema/MySQLSchemaManagerTest.php @@ -159,7 +159,7 @@ public function testDoesNotPropagateDefaultValuesForUnsupportedColumnTypes(): vo { if ($this->connection->getDatabasePlatform() instanceof MariaDBPlatform) { self::markTestSkipped( - 'MariaDB supports default values for BLOB and TEXT columns and will propagate values' + 'MariaDB supports default values for BLOB and TEXT columns and will propagate values', ); } @@ -244,7 +244,7 @@ public function testColumnCharsetChange(): void 'ascii', $this->schemaManager->introspectTable('test_column_charset_change') ->getColumn('col_string') - ->getPlatformOption('charset') + ->getPlatformOption('charset'), ); } @@ -291,36 +291,36 @@ public function testListLobTypeColumns(): void self::assertSame( $platform->getClobTypeDeclarationSQL($table->getColumn('col_tinytext')->toArray()), - $platform->getClobTypeDeclarationSQL($onlineColumns['col_tinytext']->toArray()) + $platform->getClobTypeDeclarationSQL($onlineColumns['col_tinytext']->toArray()), ); self::assertSame( $platform->getClobTypeDeclarationSQL($table->getColumn('col_text')->toArray()), - $platform->getClobTypeDeclarationSQL($onlineColumns['col_text']->toArray()) + $platform->getClobTypeDeclarationSQL($onlineColumns['col_text']->toArray()), ); self::assertSame( $platform->getClobTypeDeclarationSQL($table->getColumn('col_mediumtext')->toArray()), - $platform->getClobTypeDeclarationSQL($onlineColumns['col_mediumtext']->toArray()) + $platform->getClobTypeDeclarationSQL($onlineColumns['col_mediumtext']->toArray()), ); self::assertSame( $platform->getClobTypeDeclarationSQL($table->getColumn('col_longtext')->toArray()), - $platform->getClobTypeDeclarationSQL($onlineColumns['col_longtext']->toArray()) + $platform->getClobTypeDeclarationSQL($onlineColumns['col_longtext']->toArray()), ); self::assertSame( $platform->getBlobTypeDeclarationSQL($table->getColumn('col_tinyblob')->toArray()), - $platform->getBlobTypeDeclarationSQL($onlineColumns['col_tinyblob']->toArray()) + $platform->getBlobTypeDeclarationSQL($onlineColumns['col_tinyblob']->toArray()), ); self::assertSame( $platform->getBlobTypeDeclarationSQL($table->getColumn('col_blob')->toArray()), - $platform->getBlobTypeDeclarationSQL($onlineColumns['col_blob']->toArray()) + $platform->getBlobTypeDeclarationSQL($onlineColumns['col_blob']->toArray()), ); self::assertSame( $platform->getBlobTypeDeclarationSQL($table->getColumn('col_mediumblob')->toArray()), - $platform->getBlobTypeDeclarationSQL($onlineColumns['col_mediumblob']->toArray()) + $platform->getBlobTypeDeclarationSQL($onlineColumns['col_mediumblob']->toArray()), ); self::assertSame( $platform->getBlobTypeDeclarationSQL($table->getColumn('col_longblob')->toArray()), - $platform->getBlobTypeDeclarationSQL($onlineColumns['col_longblob']->toArray()) + $platform->getBlobTypeDeclarationSQL($onlineColumns['col_longblob']->toArray()), ); } @@ -335,7 +335,7 @@ public function testDiffListGuidTableColumn(): void self::assertNull( $this->schemaManager->createComparator()->diffTable($onlineTable, $offlineTable), - 'No differences should be detected with the offline vs online schema.' + 'No differences should be detected with the offline vs online schema.', ); } @@ -415,11 +415,11 @@ public function testColumnDefaultsAreValid(): void $this->dropAndCreateTable($table); $this->connection->executeStatement( - 'INSERT INTO test_column_defaults_are_valid () VALUES()' + 'INSERT INTO test_column_defaults_are_valid () VALUES()', ); $row = $this->connection->fetchAssociative( - 'SELECT *, DATEDIFF(CURRENT_TIMESTAMP(), col_datetime) as diff_seconds FROM test_column_defaults_are_valid' + 'SELECT *, DATEDIFF(CURRENT_TIMESTAMP(), col_datetime) as diff_seconds FROM test_column_defaults_are_valid', ); self::assertNotFalse($row); diff --git a/tests/Functional/Schema/Oracle/ComparatorTest.php b/tests/Functional/Schema/Oracle/ComparatorTest.php index 7e3d2ea8a65..4738f375103 100644 --- a/tests/Functional/Schema/Oracle/ComparatorTest.php +++ b/tests/Functional/Schema/Oracle/ComparatorTest.php @@ -51,13 +51,13 @@ public function testChangeBinaryColumnFixed(): void self::assertNull(ComparatorTestUtils::diffFromActualToDesiredTable( $this->schemaManager, $this->comparator, - $table + $table, )); self::assertNull(ComparatorTestUtils::diffFromDesiredToActualTable( $this->schemaManager, $this->comparator, - $table + $table, )); } } diff --git a/tests/Functional/Schema/OracleSchemaManagerTest.php b/tests/Functional/Schema/OracleSchemaManagerTest.php index 932e640bcab..77e0d14732a 100644 --- a/tests/Functional/Schema/OracleSchemaManagerTest.php +++ b/tests/Functional/Schema/OracleSchemaManagerTest.php @@ -88,7 +88,7 @@ public function testListTableDetailsWithDifferentIdentifierQuotingRequirements() $offlinePrimaryTable->addColumn( '"Id"', 'integer', - ['autoincrement' => true] + ['autoincrement' => true], ); $offlinePrimaryTable->addColumn('select', 'integer'); $offlinePrimaryTable->addColumn('foo', 'integer'); @@ -110,7 +110,7 @@ public function testListTableDetailsWithDifferentIdentifierQuotingRequirements() ['"Fk"'], ['"Id"'], [], - '"Primary_Table_Fk"' + '"Primary_Table_Fk"', ); $offlineForeignTable->setPrimaryKey(['id']); @@ -183,15 +183,15 @@ public function testListTableDetailsWithDifferentIdentifierQuotingRequirements() self::assertTrue($onlineForeignTable->hasForeignKey('"Primary_Table_Fk"')); self::assertSame( $primaryTableName, - $onlineForeignTable->getForeignKey('"Primary_Table_Fk"')->getQuotedForeignTableName($platform) + $onlineForeignTable->getForeignKey('"Primary_Table_Fk"')->getQuotedForeignTableName($platform), ); self::assertSame( ['"Fk"'], - $onlineForeignTable->getForeignKey('"Primary_Table_Fk"')->getQuotedLocalColumns($platform) + $onlineForeignTable->getForeignKey('"Primary_Table_Fk"')->getQuotedLocalColumns($platform), ); self::assertSame( ['"Id"'], - $onlineForeignTable->getForeignKey('"Primary_Table_Fk"')->getQuotedForeignColumns($platform) + $onlineForeignTable->getForeignKey('"Primary_Table_Fk"')->getQuotedForeignColumns($platform), ); } @@ -228,7 +228,7 @@ public function testListTableIndexesPrimaryKeyConstraintNameDiffersFromIndexName $this->schemaManager->createIndex( new Index('id_pk_id_index', ['id'], true, true), - 'list_table_indexes_pk_id_test' + 'list_table_indexes_pk_id_test', ); $tableIndexes = $this->schemaManager->listTableIndexes('list_table_indexes_pk_id_test'); @@ -258,7 +258,7 @@ public function testListTableDateTypeColumns(): void public function testCreateAndListSequences(): void { self::markTestSkipped( - "Skipped for uppercase letters are contained in sequences' names. Fix the schema manager in 3.0." + "Skipped for uppercase letters are contained in sequences' names. Fix the schema manager in 3.0.", ); } diff --git a/tests/Functional/Schema/PostgreSQL/SchemaTest.php b/tests/Functional/Schema/PostgreSQL/SchemaTest.php index 5cce3bafcbd..934e19ec4bb 100644 --- a/tests/Functional/Schema/PostgreSQL/SchemaTest.php +++ b/tests/Functional/Schema/PostgreSQL/SchemaTest.php @@ -35,7 +35,7 @@ public function testCreateTableWithSequenceInColumnDefinition(): void $result = $this->connection->fetchAssociative( 'SELECT column_default FROM information_schema.columns WHERE table_name = ?', - ['my_table'] + ['my_table'], ); self::assertNotFalse($result); diff --git a/tests/Functional/Schema/PostgreSQLSchemaManagerTest.php b/tests/Functional/Schema/PostgreSQLSchemaManagerTest.php index 988e8751503..bfa1a205408 100644 --- a/tests/Functional/Schema/PostgreSQLSchemaManagerTest.php +++ b/tests/Functional/Schema/PostgreSQLSchemaManagerTest.php @@ -108,7 +108,7 @@ public function testAlterTableAutoIncrementDrop(): void self::assertEquals( ['ALTER TABLE autoinc_table_drop ALTER id DROP IDENTITY'], - $platform->getAlterTableSQL($diff) + $platform->getAlterTableSQL($diff), ); $this->schemaManager->alterTable($diff); @@ -175,7 +175,7 @@ public function testReturnQuotedAssets(): void 'ALTER TABLE dbal91_something ADD CONSTRAINT something_input FOREIGN KEY ("table")' . ' REFERENCES dbal91_something (id) ON UPDATE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE', ], - $this->connection->getDatabasePlatform()->getCreateTableSQL($table) + $this->connection->getDatabasePlatform()->getCreateTableSQL($table), ); } @@ -191,7 +191,7 @@ public function testListForeignKeys(): void 'test_create_fk2', ['id'], 'foreign_key_test' . $i . '_fk', - ['onDelete' => $fkOptions[$i]] + ['onDelete' => $fkOptions[$i]], ); } @@ -344,7 +344,7 @@ public function testPartialIndexes(): void self::assertNull( $this->schemaManager->createComparator() - ->diffTable($offlineTable, $onlineTable) + ->diffTable($offlineTable, $onlineTable), ); self::assertTrue($onlineTable->hasIndex('simple_partial_index')); self::assertTrue($onlineTable->getIndex('simple_partial_index')->hasOption('where')); @@ -385,9 +385,7 @@ public function testListNegativeColumnDefaultValue(): void self::assertEquals('(-1)', $columns['col_string']->getDefault()); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function serialTypes(): iterable { return [ @@ -396,9 +394,7 @@ public static function serialTypes(): iterable ]; } - /** - * @dataProvider serialTypes - */ + /** @dataProvider serialTypes */ public function testAutoIncrementCreatesSerialDataTypesWithoutADefaultValue(string $type): void { $tableName = 'test_serial_type_' . $type; @@ -413,9 +409,7 @@ public function testAutoIncrementCreatesSerialDataTypesWithoutADefaultValue(stri self::assertNull($columns['id']->getDefault()); } - /** - * @dataProvider serialTypes - */ + /** @dataProvider serialTypes */ public function testAutoIncrementCreatesSerialDataTypesWithoutADefaultValueEvenWhenDefaultIsSet(string $type): void { $tableName = 'test_serial_type_with_default_' . $type; @@ -430,9 +424,7 @@ public function testAutoIncrementCreatesSerialDataTypesWithoutADefaultValueEvenW self::assertNull($columns['id']->getDefault()); } - /** - * @dataProvider autoIncrementTypeMigrations - */ + /** @dataProvider autoIncrementTypeMigrations */ public function testAlterTableAutoIncrementIntToBigInt(string $from, string $to, string $expected): void { $tableFrom = new Table('autoinc_type_modification'); @@ -451,7 +443,7 @@ public function testAlterTableAutoIncrementIntToBigInt(string $from, string $to, self::assertNotNull($diff); self::assertSame( ['ALTER TABLE autoinc_type_modification ALTER id TYPE ' . $expected], - $this->connection->getDatabasePlatform()->getAlterTableSQL($diff) + $this->connection->getDatabasePlatform()->getAlterTableSQL($diff), ); $this->schemaManager->alterTable($diff); @@ -459,9 +451,7 @@ public function testAlterTableAutoIncrementIntToBigInt(string $from, string $to, self::assertTrue($tableFinal->getColumn('id')->getAutoincrement()); } - /** - * @return iterable - */ + /** @return iterable */ public static function autoIncrementTypeMigrations(): iterable { return [ diff --git a/tests/Functional/Schema/SQLServerSchemaManagerTest.php b/tests/Functional/Schema/SQLServerSchemaManagerTest.php index da551f6d7ea..8017e1704e8 100644 --- a/tests/Functional/Schema/SQLServerSchemaManagerTest.php +++ b/tests/Functional/Schema/SQLServerSchemaManagerTest.php @@ -33,7 +33,7 @@ public function testDropColumnConstraints(): void 'sqlsrv_drop_column', [], [], - ['todrop' => new Column('todrop', Type::getType('decimal'))] + ['todrop' => new Column('todrop', Type::getType('decimal'))], ); $this->schemaManager->alterTable($diff); @@ -102,7 +102,7 @@ public function testDefaultConstraints(): void 'df_integer', new Column('df_integer', Type::getType('integer'), ['default' => 0]), ['default'], - new Column('df_integer', Type::getType('integer'), ['default' => 666]) + new Column('df_integer', Type::getType('integer'), ['default' => 666]), ), 'df_string_2' => new ColumnDiff( 'df_string_2', @@ -111,7 +111,7 @@ public function testDefaultConstraints(): void new Column('df_string_2', Type::getType('string'), [ 'length' => 32, 'default' => 'Doctrine rocks!!!', - ]) + ]), ), 'df_string_3' => new ColumnDiff( 'df_string_3', @@ -123,13 +123,13 @@ public function testDefaultConstraints(): void new Column('df_string_3', Type::getType('string'), [ 'length' => 50, 'default' => 'another default value', - ]) + ]), ), 'df_boolean' => new ColumnDiff( 'df_boolean', new Column('df_boolean', Type::getType('boolean'), ['default' => false]), ['default'], - new Column('df_boolean', Type::getType('boolean'), ['default' => true]) + new Column('df_boolean', Type::getType('boolean'), ['default' => true]), ), ], [ @@ -138,13 +138,13 @@ public function testDefaultConstraints(): void [], [], [], - $table + $table, ); $diff->newName = 'sqlsrv_default_constraints'; $diff->renamedColumns['df_string_4'] = new Column( 'df_string_renamed', Type::getType('string'), - ['default' => 'column to rename'] + ['default' => 'column to rename'], ); $this->schemaManager->alterTable($diff); @@ -168,14 +168,14 @@ public function testDefaultConstraints(): void 'df_integer', new Column('df_integer', Type::getType('integer'), ['default' => 666]), ['default'], - new Column('df_integer', Type::getType('integer'), ['default' => 0]) + new Column('df_integer', Type::getType('integer'), ['default' => 0]), ), ], [], [], [], [], - $table + $table, ); $this->schemaManager->alterTable($diff); diff --git a/tests/Functional/Schema/SchemaManagerFunctionalTestCase.php b/tests/Functional/Schema/SchemaManagerFunctionalTestCase.php index 463f0d65ff9..14714f6a089 100644 --- a/tests/Functional/Schema/SchemaManagerFunctionalTestCase.php +++ b/tests/Functional/Schema/SchemaManagerFunctionalTestCase.php @@ -100,9 +100,7 @@ public function testCreateSequence(): void self::assertTrue($this->hasElementWithName($this->schemaManager->listSequences(), $name)); } - /** - * @param AbstractAsset[] $items - */ + /** @param AbstractAsset[] $items */ private function hasElementWithName(array $items, string $name): bool { $filteredList = $this->filterElementsByName($items, $name); @@ -123,7 +121,7 @@ private function filterElementsByName(array $items, string $name): array $items, static function (AbstractAsset $item) use ($name): bool { return $item->getShortestName($item->getNamespaceName()) === $name; - } + }, ); } @@ -136,7 +134,7 @@ public function testListSequences(): void } $this->schemaManager->createSequence( - new Sequence('list_sequences_test_seq', 20, 10) + new Sequence('list_sequences_test_seq', 20, 10), ); foreach ($this->schemaManager->listSequences() as $sequence) { @@ -183,7 +181,7 @@ public function testListSchemaNames(): void self::assertNotContains('test_create_schema', $this->schemaManager->listSchemaNames()); $this->connection->executeStatement( - $platform->getCreateSchemaSQL('test_create_schema') + $platform->getCreateSchemaSQL('test_create_schema'), ); self::assertContains('test_create_schema', $this->schemaManager->listSchemaNames()); @@ -216,9 +214,7 @@ public function testListTablesDoesNotIncludeViews(): void self::assertNull($view); } - /** - * @dataProvider tableFilterProvider - */ + /** @dataProvider tableFilterProvider */ public function testListTablesWithFilter(string $prefix, int $expectedCount): void { $this->createTestTable('filter_test_1'); @@ -229,16 +225,14 @@ public function testListTablesWithFilter(string $prefix, int $expectedCount): vo $this->connection->getConfiguration()->setSchemaAssetsFilter( static function (string $name) use ($prefix): bool { return str_starts_with(strtolower($name), $prefix); - } + }, ); self::assertCount($expectedCount, $this->schemaManager->listTableNames()); self::assertCount($expectedCount, $this->schemaManager->listTables()); } - /** - * @return iterable - */ + /** @return iterable */ public static function tableFilterProvider(): iterable { yield 'One table' => ['filter_test_1', 1]; @@ -315,7 +309,7 @@ public function testListTableColumns(): void self::assertEquals(5, array_search('baz2', $columnsKeys, true)); self::assertContains( $columns['baz2']->getType()::class, - [TimeType::class, DateType::class, DateTimeType::class] + [TimeType::class, DateType::class, DateTimeType::class], ); self::assertEquals(true, $columns['baz2']->getNotnull()); self::assertEquals(null, $columns['baz2']->getDefault()); @@ -324,7 +318,7 @@ public function testListTableColumns(): void self::assertEquals(6, array_search('baz3', $columnsKeys, true)); self::assertContains( $columns['baz3']->getType()::class, - [TimeType::class, DateType::class, DateTimeType::class] + [TimeType::class, DateType::class, DateTimeType::class], ); self::assertEquals(true, $columns['baz3']->getNotnull()); self::assertEquals(null, $columns['baz3']->getDefault()); @@ -391,7 +385,7 @@ public function testDiffListTableColumns(): void { if ($this->connection->getDatabasePlatform() instanceof OraclePlatform) { self::markTestSkipped( - 'Does not work with Oracle, since it cannot detect DateTime, Date and Time differences (at the moment).' + 'Does not work with Oracle, since it cannot detect DateTime, Date and Time differences (at the moment).', ); } @@ -514,7 +508,7 @@ public function testListForeignKeys(): void 'test_create_fk2', ['id'], 'foreign_key_test_fk', - ['onDelete' => 'CASCADE'] + ['onDelete' => 'CASCADE'], ); $this->schemaManager->createForeignKey($foreignKey, 'test_create_fk1'); @@ -622,7 +616,7 @@ public function testAlterTableScenario(): void self::assertTrue($table->hasIndex('foo_idx')); self::assertEquals( ['foo', 'foreign_key_test'], - array_map('strtolower', $table->getIndex('foo_idx')->getColumns()) + array_map('strtolower', $table->getIndex('foo_idx')->getColumns()), ); $tableDiff = new TableDiff('alter_table'); @@ -637,7 +631,7 @@ public function testAlterTableScenario(): void self::assertFalse($table->hasIndex('foo_idx')); self::assertEquals( ['foo', 'foreign_key_test'], - array_map('strtolower', $table->getIndex('bar_idx')->getColumns()) + array_map('strtolower', $table->getIndex('bar_idx')->getColumns()), ); self::assertFalse($table->getIndex('bar_idx')->isPrimary()); self::assertFalse($table->getIndex('bar_idx')->isUnique()); @@ -649,7 +643,7 @@ public function testAlterTableScenario(): void $tableDiff->addedForeignKeys[] = new ForeignKeyConstraint( ['foreign_key_test'], 'alter_table_foreign', - ['id'] + ['id'], ); $this->schemaManager->alterTable($tableDiff); @@ -807,7 +801,7 @@ public function testRenameIndexUsedInForeignKeyConstraint(): void ['fk'], ['id'], [], - 'fk_constraint' + 'fk_constraint', ); $this->dropTableIfExists($foreignTable->getName()); @@ -851,7 +845,7 @@ public function testChangeColumnsTypeWithDefaultValue(): void 'col_int', new Column('col_int', Type::getType('integer'), ['default' => 666]), ['type'], - new Column('col_int', Type::getType('smallint'), ['default' => 666]) + new Column('col_int', Type::getType('smallint'), ['default' => 666]), ); $tableDiff->changedColumns['col_string'] = new ColumnDiff( @@ -865,7 +859,7 @@ public function testChangeColumnsTypeWithDefaultValue(): void new Column('col_string', Type::getType('string'), [ 'length' => 3, 'default' => 'foo', - ]) + ]), ); $this->schemaManager->alterTable($tableDiff); @@ -892,9 +886,7 @@ public function testListTableWithBlob(): void self::assertInstanceOf(BlobType::class, $created->getColumn('binarydata')->getType()); } - /** - * @param mixed[] $data - */ + /** @param mixed[] $data */ protected function createTestTable(string $name = 'test_table', array $data = []): Table { $options = $data['options'] ?? []; @@ -906,9 +898,7 @@ protected function createTestTable(string $name = 'test_table', array $data = [] return $table; } - /** - * @param mixed[] $options - */ + /** @param mixed[] $options */ protected function getTestTable(string $name, array $options = []): Table { $table = new Table($name, [], [], [], [], $options); @@ -933,9 +923,7 @@ protected function getTestCompositeTable(string $name): Table return $table; } - /** - * @param Table[] $tables - */ + /** @param Table[] $tables */ protected function assertHasTable(array $tables): void { $foundTable = false; @@ -960,7 +948,7 @@ public function testListForeignKeysComposite(): void ['id', 'foreign_key_test'], 'test_create_fk4', ['id', 'other_id'], - 'foreign_key_test_fk2' + 'foreign_key_test_fk2', ); $this->schemaManager->createForeignKey($foreignKey, 'test_create_fk3'); @@ -1096,15 +1084,15 @@ public function testListTableDetailsWithFullQualifiedTableName(): void self::assertEquals( $this->schemaManager->listTableColumns($primaryTableName), - $this->schemaManager->listTableColumns($defaultSchemaName . '.' . $primaryTableName) + $this->schemaManager->listTableColumns($defaultSchemaName . '.' . $primaryTableName), ); self::assertEquals( $this->schemaManager->listTableIndexes($primaryTableName), - $this->schemaManager->listTableIndexes($defaultSchemaName . '.' . $primaryTableName) + $this->schemaManager->listTableIndexes($defaultSchemaName . '.' . $primaryTableName), ); self::assertEquals( $this->schemaManager->listTableForeignKeys($primaryTableName), - $this->schemaManager->listTableForeignKeys($defaultSchemaName . '.' . $primaryTableName) + $this->schemaManager->listTableForeignKeys($defaultSchemaName . '.' . $primaryTableName), ); } @@ -1192,8 +1180,8 @@ public function testComparisonWithAutoDetectedSequenceDefinition(): void $this->schemaManager->listSequences(), static function (Sequence $sequence) use ($sequenceName): bool { return strcasecmp($sequence->getName(), $sequenceName) === 0; - } - ) + }, + ), )[0] ?? null; self::assertNotNull($createdSequence); @@ -1215,7 +1203,7 @@ public function testPrimaryKeyAutoIncrement(): void $this->connection->insert('test_pk_auto_increment', ['text' => '1']); $lastUsedIdBeforeDelete = (int) $this->connection->fetchOne( - "SELECT id FROM test_pk_auto_increment WHERE text = '1'" + "SELECT id FROM test_pk_auto_increment WHERE text = '1'", ); $this->connection->executeStatement('DELETE FROM test_pk_auto_increment'); @@ -1223,7 +1211,7 @@ public function testPrimaryKeyAutoIncrement(): void $this->connection->insert('test_pk_auto_increment', ['text' => '2']); $lastUsedIdAfterDelete = (int) $this->connection->fetchOne( - "SELECT id FROM test_pk_auto_increment WHERE text = '2'" + "SELECT id FROM test_pk_auto_increment WHERE text = '2'", ); self::assertGreaterThan($lastUsedIdBeforeDelete, $lastUsedIdAfterDelete); @@ -1233,7 +1221,7 @@ public function testGenerateAnIndexWithPartialColumnLength(): void { if (! $this->connection->getDatabasePlatform()->supportsColumnLengthIndexes()) { self::markTestSkipped( - 'This test is only supported on platforms that support indexes with column length definitions.' + 'This test is only supported on platforms that support indexes with column length definitions.', ); } @@ -1293,7 +1281,7 @@ public function testCreatedCompositeForeignKeyOrderIsCorrectAfterCreation(): voi $localColumns, $foreignColumns, [], - $foreignKey + $foreignKey, ); $this->schemaManager->createTable($table); @@ -1352,9 +1340,7 @@ private function createReservedKeywordTables(): void $schemaManager->createSchemaObjects($schema); } - /** - * @param list $tables - */ + /** @param list
$tables */ protected function findTableByName(array $tables, string $name): ?Table { foreach ($tables as $table) { diff --git a/tests/Functional/Schema/SqliteSchemaManagerTest.php b/tests/Functional/Schema/SqliteSchemaManagerTest.php index 0f5badd98ee..71ff3775f9c 100644 --- a/tests/Functional/Schema/SqliteSchemaManagerTest.php +++ b/tests/Functional/Schema/SqliteSchemaManagerTest.php @@ -52,7 +52,7 @@ public function createListTableColumns(): Table public function testListForeignKeysFromExistingDatabase(): void { - $this->connection->executeStatement(<<connection->executeStatement(<<<'EOS' CREATE TABLE user ( id INTEGER PRIMARY KEY AUTOINCREMENT, page INTEGER CONSTRAINT FK_1 REFERENCES page (key) DEFERRABLE INITIALLY DEFERRED, @@ -60,8 +60,7 @@ public function testListForeignKeysFromExistingDatabase(): void log INTEGER, CONSTRAINT FK_3 FOREIGN KEY (log) REFERENCES log ON UPDATE SET NULL NOT DEFERRABLE ) -EOS - ); +EOS); $expected = [ new ForeignKeyConstraint( @@ -69,21 +68,21 @@ public function testListForeignKeysFromExistingDatabase(): void 'page', ['key'], 'FK_1', - ['onUpdate' => 'NO ACTION', 'onDelete' => 'NO ACTION', 'deferrable' => true, 'deferred' => true] + ['onUpdate' => 'NO ACTION', 'onDelete' => 'NO ACTION', 'deferrable' => true, 'deferred' => true], ), new ForeignKeyConstraint( ['parent'], 'user', ['id'], '', - ['onUpdate' => 'NO ACTION', 'onDelete' => 'CASCADE', 'deferrable' => false, 'deferred' => false] + ['onUpdate' => 'NO ACTION', 'onDelete' => 'CASCADE', 'deferrable' => false, 'deferred' => false], ), new ForeignKeyConstraint( ['log'], 'log', [], 'FK_3', - ['onUpdate' => 'SET NULL', 'onDelete' => 'NO ACTION', 'deferrable' => false, 'deferred' => false] + ['onUpdate' => 'SET NULL', 'onDelete' => 'NO ACTION', 'deferrable' => false, 'deferred' => false], ), ]; @@ -125,7 +124,7 @@ protected function assertVarBinaryColumnIsValid(Table $table, string $columnName public function testListTableColumnsWithWhitespacesInTypeDeclarations(): void { - $sql = <<connection->insert('test_pk_auto_increment', ['text' => '2']); $lastUsedIdAfterDelete = (int) $this->connection->fetchOne( - 'SELECT id FROM test_pk_auto_increment WHERE text = "2"' + 'SELECT id FROM test_pk_auto_increment WHERE text = "2"', ); // with an empty table, non autoincrement rowid is always 1 diff --git a/tests/Functional/StatementTest.php b/tests/Functional/StatementTest.php index 547c36feb4a..e8da2b46768 100644 --- a/tests/Functional/StatementTest.php +++ b/tests/Functional/StatementTest.php @@ -109,7 +109,7 @@ public function testFetchLongBlob(): void $table->addColumn('contents', 'blob', ['length' => 0xFFFFFFFF]); $this->dropAndCreateTable($table); - $contents = base64_decode(<<convertToPHPValue( $result->fetchOne(), - $this->connection->getDatabasePlatform() + $this->connection->getDatabasePlatform(), ); self::assertSame($contents, stream_get_contents($stream)); @@ -222,7 +222,7 @@ public function testParameterBindingOrder(): void $query = $platform->getDummySelectSQL( $platform->getLengthExpression('?') . ', ' - . $platform->getLengthExpression('?') + . $platform->getLengthExpression('?'), ); $stmt = $this->connection->prepare($query); @@ -232,9 +232,7 @@ public function testParameterBindingOrder(): void self::assertEquals([5, 6], $stmt->executeQuery()->fetchNumeric()); } - /** - * @dataProvider emptyFetchProvider - */ + /** @dataProvider emptyFetchProvider */ public function testFetchFromExecutedStatementWithFreedResult(callable $fetch, mixed $expected): void { $this->connection->insert('stmt_test', ['id' => 1]); @@ -258,9 +256,7 @@ public function testFetchFromExecutedStatementWithFreedResult(callable $fetch, m self::assertSame($expected, $value); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function emptyFetchProvider(): iterable { return [ @@ -277,9 +273,7 @@ static function (Result $result): mixed { false, ], 'fetch-all' => [ - /** - * @return mixed[] - */ + /** @return mixed[] */ static function (Result $result): array { return $result->fetchAllAssociative(); }, @@ -318,7 +312,7 @@ public function testExecWithRedundantParameters(): void ) { self::markTestSkipped(sprintf( 'The underlying implementation of the "%s" driver does not report redundant parameters', - get_debug_type($driver) + get_debug_type($driver), )); } diff --git a/tests/Functional/TemporaryTableTest.php b/tests/Functional/TemporaryTableTest.php index 11bec6b9dbf..18ca5fe076e 100644 --- a/tests/Functional/TemporaryTableTest.php +++ b/tests/Functional/TemporaryTableTest.php @@ -90,7 +90,7 @@ public function testCreateTemporaryTableNotAutoCommitTransaction(): void try { $this->connection->executeStatement( - $platform->getDropTemporaryTableSQL($tempTable) + $platform->getDropTemporaryTableSQL($tempTable), ); } catch (Throwable) { } @@ -103,7 +103,7 @@ private function dropTemporaryTable(string $name): void { $platform = $this->connection->getDatabasePlatform(); $sql = $platform->getDropTemporaryTableSQL( - $platform->getTemporaryTableName($name) + $platform->getTemporaryTableName($name), ); try { diff --git a/tests/Functional/Ticket/DBAL752Test.php b/tests/Functional/Ticket/DBAL752Test.php index e4f3655878a..71fc6ff2fd6 100644 --- a/tests/Functional/Ticket/DBAL752Test.php +++ b/tests/Functional/Ticket/DBAL752Test.php @@ -23,7 +23,7 @@ protected function setUp(): void public function testUnsignedIntegerDetection(): void { - $this->connection->executeStatement(<<connection->executeStatement(<<<'SQL' CREATE TABLE dbal752_unsigneds ( small SMALLINT, small_unsigned SMALLINT UNSIGNED, @@ -34,8 +34,7 @@ public function testUnsignedIntegerDetection(): void big BIGINT, big_unsigned BIGINT UNSIGNED ); -SQL - ); +SQL); $schemaManager = $this->connection->createSchemaManager(); diff --git a/tests/Functional/TypeConversionTest.php b/tests/Functional/TypeConversionTest.php index edd7fd5444d..d1f53cc75a5 100644 --- a/tests/Functional/TypeConversionTest.php +++ b/tests/Functional/TypeConversionTest.php @@ -40,9 +40,7 @@ protected function setUp(): void $this->dropAndCreateTable($table); } - /** - * @dataProvider booleanProvider - */ + /** @dataProvider booleanProvider */ public function testIdempotentConversionToBoolean(string $type, mixed $originalValue): void { $dbValue = $this->processValue($type, $originalValue); @@ -51,9 +49,7 @@ public function testIdempotentConversionToBoolean(string $type, mixed $originalV self::assertEquals($originalValue, $dbValue); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function booleanProvider(): iterable { return [ @@ -62,9 +58,7 @@ public static function booleanProvider(): iterable ]; } - /** - * @dataProvider integerProvider - */ + /** @dataProvider integerProvider */ public function testIdempotentConversionToInteger(string $type, mixed $originalValue): void { $dbValue = $this->processValue($type, $originalValue); @@ -73,9 +67,7 @@ public function testIdempotentConversionToInteger(string $type, mixed $originalV self::assertEquals($originalValue, $dbValue); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function integerProvider(): iterable { return [ @@ -83,9 +75,7 @@ public static function integerProvider(): iterable ]; } - /** - * @dataProvider floatProvider - */ + /** @dataProvider floatProvider */ public function testIdempotentConversionToFloat(string $type, mixed $originalValue): void { $dbValue = $this->processValue($type, $originalValue); @@ -94,9 +84,7 @@ public function testIdempotentConversionToFloat(string $type, mixed $originalVal self::assertEquals($originalValue, $dbValue); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function floatProvider(): iterable { return [ @@ -104,9 +92,7 @@ public static function floatProvider(): iterable ]; } - /** - * @dataProvider toStringProvider - */ + /** @dataProvider toStringProvider */ public function testIdempotentConversionToString(string $type, mixed $originalValue): void { if ($type === 'text' && TestUtil::isDriverOneOf('pdo_oci')) { @@ -121,9 +107,7 @@ public function testIdempotentConversionToString(string $type, mixed $originalVa self::assertEquals($originalValue, $dbValue); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function toStringProvider(): iterable { return [ @@ -137,9 +121,7 @@ public function testIdempotentConversionToArray(): void self::assertEquals(['foo' => 'bar'], $this->processValue('json', ['foo' => 'bar'])); } - /** - * @dataProvider toDateTimeProvider - */ + /** @dataProvider toDateTimeProvider */ public function testIdempotentConversionToDateTime(string $type, DateTime $originalValue): void { $dbValue = $this->processValue($type, $originalValue); @@ -153,13 +135,11 @@ public function testIdempotentConversionToDateTime(string $type, DateTime $origi self::assertEquals($originalValue, $dbValue); self::assertEquals( $originalValue->getTimezone(), - $dbValue->getTimezone() + $dbValue->getTimezone(), ); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function toDateTimeProvider(): iterable { return [ @@ -176,7 +156,7 @@ private function processValue(string $type, mixed $originalValue): mixed $typeInstance = Type::getType($type); $insertionValue = $typeInstance->convertToDatabaseValue( $originalValue, - $this->connection->getDatabasePlatform() + $this->connection->getDatabasePlatform(), ); $this->connection->insert('type_conversion', ['id' => ++self::$typeCounter, $columnName => $insertionValue]); @@ -185,7 +165,7 @@ private function processValue(string $type, mixed $originalValue): mixed return $typeInstance->convertToPHPValue( $this->connection->fetchOne($sql), - $this->connection->getDatabasePlatform() + $this->connection->getDatabasePlatform(), ); } } diff --git a/tests/Functional/Types/AsciiStringTest.php b/tests/Functional/Types/AsciiStringTest.php index 2f3f0ea2020..d5579352f3b 100644 --- a/tests/Functional/Types/AsciiStringTest.php +++ b/tests/Functional/Types/AsciiStringTest.php @@ -57,7 +57,7 @@ private function select(string $id): string $value = $this->connection->fetchOne( 'SELECT val FROM ascii_table WHERE id = ?', [$id], - [ParameterType::ASCII] + [ParameterType::ASCII], ); self::assertIsString($value); diff --git a/tests/Functional/Types/BinaryTest.php b/tests/Functional/Types/BinaryTest.php index eabf7ee94fe..eb3c891a037 100644 --- a/tests/Functional/Types/BinaryTest.php +++ b/tests/Functional/Types/BinaryTest.php @@ -71,7 +71,7 @@ private function select(string $id): mixed $value = $this->connection->fetchOne( 'SELECT val FROM binary_table WHERE id = ?', [$id], - [ParameterType::BINARY] + [ParameterType::BINARY], ); return Type::getType('binary')->convertToPHPValue($value, $this->connection->getDatabasePlatform()); diff --git a/tests/Functional/Types/DecimalTest.php b/tests/Functional/Types/DecimalTest.php index e6668998f36..e1f1e917d9d 100644 --- a/tests/Functional/Types/DecimalTest.php +++ b/tests/Functional/Types/DecimalTest.php @@ -13,9 +13,7 @@ final class DecimalTest extends FunctionalTestCase { - /** - * @return string[][] - */ + /** @return string[][] */ public function dataValuesProvider(): array { return [ @@ -24,9 +22,7 @@ public function dataValuesProvider(): array ]; } - /** - * @dataProvider dataValuesProvider - */ + /** @dataProvider dataValuesProvider */ public function testInsertAndRetrieveDecimal(string $expected): void { $table = new Table('decimal_table'); @@ -37,12 +33,12 @@ public function testInsertAndRetrieveDecimal(string $expected): void $this->connection->insert( 'decimal_table', ['val' => $expected], - ['val' => Types::DECIMAL] + ['val' => Types::DECIMAL], ); $value = Type::getType(Types::DECIMAL)->convertToPHPValue( $this->connection->fetchOne('SELECT val FROM decimal_table'), - $this->connection->getDatabasePlatform() + $this->connection->getDatabasePlatform(), ); self::assertIsString($value); diff --git a/tests/Functional/WriteTest.php b/tests/Functional/WriteTest.php index df723dfe378..e52ab250c34 100644 --- a/tests/Functional/WriteTest.php +++ b/tests/Functional/WriteTest.php @@ -48,7 +48,7 @@ public function testExecuteStatementWithTypes(): void $affected = $this->connection->executeStatement( $sql, [1, 'foo'], - [ParameterType::INTEGER, ParameterType::STRING] + [ParameterType::INTEGER, ParameterType::STRING], ); self::assertEquals(1, $affected, 'executeStatement() should return the number of affected rows!'); @@ -135,19 +135,19 @@ public function testUpdate(): void self::assertEquals(1, $this->connection->update( 'write_table', ['test_string' => 'bar'], - ['test_string' => 'foo'] + ['test_string' => 'foo'], )); self::assertEquals(2, $this->connection->update( 'write_table', ['test_string' => 'baz'], - ['test_string' => 'bar'] + ['test_string' => 'bar'], )); self::assertEquals(0, $this->connection->update( 'write_table', ['test_string' => 'baz'], - ['test_string' => 'bar'] + ['test_string' => 'bar'], )); } @@ -157,7 +157,7 @@ public function testUpdateAll(): void self::assertEquals(2, $this->connection->update( 'write_table', - ['test_string' => 'baz'] + ['test_string' => 'baz'], )); } @@ -204,14 +204,14 @@ public function testInsertWithKeyValueTypes(): void $this->connection->insert( 'write_table', ['test_int' => '30', 'test_string' => $testString], - ['test_string' => 'datetime', 'test_int' => 'integer'] + ['test_string' => 'datetime', 'test_int' => 'integer'], ); $data = $this->connection->fetchOne('SELECT test_string FROM write_table WHERE test_int = 30'); self::assertEquals( $testString->format($this->connection->getDatabasePlatform()->getDateTimeFormatString()), - $data + $data, ); } @@ -222,7 +222,7 @@ public function testUpdateWithKeyValueTypes(): void $this->connection->insert( 'write_table', ['test_int' => '30', 'test_string' => $testString], - ['test_string' => 'datetime', 'test_int' => 'integer'] + ['test_string' => 'datetime', 'test_int' => 'integer'], ); $testString = new DateTime('2013-04-15 10:10:10'); @@ -231,14 +231,14 @@ public function testUpdateWithKeyValueTypes(): void 'write_table', ['test_string' => $testString], ['test_int' => '30'], - ['test_string' => 'datetime', 'test_int' => 'integer'] + ['test_string' => 'datetime', 'test_int' => 'integer'], ); $data = $this->connection->fetchOne('SELECT test_string FROM write_table WHERE test_int = 30'); self::assertEquals( $testString->format($this->connection->getDatabasePlatform()->getDateTimeFormatString()), - $data + $data, ); } @@ -248,7 +248,7 @@ public function testDeleteWithKeyValueTypes(): void $this->connection->insert( 'write_table', ['test_int' => '30', 'test_string' => $val], - ['test_string' => 'datetime', 'test_int' => 'integer'] + ['test_string' => 'datetime', 'test_int' => 'integer'], ); $this->connection->delete('write_table', [ @@ -270,7 +270,7 @@ public function testEmptyIdentityInsert(): void if (! $platform->supportsIdentityColumns()) { self::markTestSkipped( - 'Test only works on platforms with native support for identity columns.' + 'Test only works on platforms with native support for identity columns.', ); } @@ -305,7 +305,7 @@ public function testUpdateWhereIsNull(): void $this->connection->insert( 'write_table', ['test_int' => '30', 'test_string' => null], - ['test_string' => 'string', 'test_int' => 'integer'] + ['test_string' => 'string', 'test_int' => 'integer'], ); $data = $this->connection->fetchAllAssociative('SELECT * FROM write_table WHERE test_int = 30'); @@ -327,7 +327,7 @@ public function testDeleteWhereIsNull(): void $this->connection->insert( 'write_table', ['test_int' => '30', 'test_string' => null], - ['test_string' => 'string', 'test_int' => 'integer'] + ['test_string' => 'string', 'test_int' => 'integer'], ); $data = $this->connection->fetchAllAssociative('SELECT * FROM write_table WHERE test_int = 30'); @@ -341,9 +341,7 @@ public function testDeleteWhereIsNull(): void self::assertCount(0, $data); } - /** - * @param class-string $expectedClass - */ + /** @param class-string $expectedClass */ private function expectDriverException(string $expectedClass, Closure $test): void { try { diff --git a/tests/FunctionalTestCase.php b/tests/FunctionalTestCase.php index 0ebd0e42299..93b23317ccc 100644 --- a/tests/FunctionalTestCase.php +++ b/tests/FunctionalTestCase.php @@ -35,9 +35,7 @@ protected function markConnectionNotReusable(): void $this->isConnectionReusable = false; } - /** - * @before - */ + /** @before */ final protected function connect(): void { if (self::$sharedConnection === null) { @@ -47,9 +45,7 @@ final protected function connect(): void $this->connection = self::$sharedConnection; } - /** - * @after - */ + /** @after */ final protected function disconnect(): void { while ($this->connection->isTransactionActive()) { diff --git a/tests/Logging/MiddlewareTest.php b/tests/Logging/MiddlewareTest.php index e7866341390..d6844a8a91a 100644 --- a/tests/Logging/MiddlewareTest.php +++ b/tests/Logging/MiddlewareTest.php @@ -16,8 +16,7 @@ class MiddlewareTest extends TestCase { private Driver $driver; - /** @var LoggerInterface&MockObject */ - private $logger; + private LoggerInterface&MockObject $logger; public function setUp(): void { diff --git a/tests/Platforms/AbstractMySQLPlatformTestCase.php b/tests/Platforms/AbstractMySQLPlatformTestCase.php index 9aed62a8a5f..6e64e230674 100644 --- a/tests/Platforms/AbstractMySQLPlatformTestCase.php +++ b/tests/Platforms/AbstractMySQLPlatformTestCase.php @@ -18,9 +18,7 @@ use function array_shift; -/** - * @extends AbstractPlatformTestCase - */ +/** @extends AbstractPlatformTestCase */ abstract class AbstractMySQLPlatformTestCase extends AbstractPlatformTestCase { public function testModifyLimitQueryWitoutLimit(): void @@ -37,7 +35,7 @@ public function testGenerateMixedCaseTableCreate(): void $sql = $this->platform->getCreateTableSQL($table); self::assertEquals( 'CREATE TABLE Foo (Bar INT NOT NULL)', - array_shift($sql) + array_shift($sql), ); } @@ -47,9 +45,7 @@ public function getGenerateTableSql(): string . 'PRIMARY KEY(id))'; } - /** - * @return string[] - */ + /** @return string[] */ public function getGenerateTableWithMultiColumnUniqueIndexSql(): array { return [ @@ -75,7 +71,7 @@ public function testGeneratesSqlSnippets(): void self::assertEquals('RLIKE', $this->platform->getRegexpExpression()); self::assertEquals( 'CONCAT(column1, column2, column3)', - $this->platform->getConcatExpression('column1', 'column2', 'column3') + $this->platform->getConcatExpression('column1', 'column2', 'column3'), ); } @@ -84,19 +80,19 @@ public function testGeneratesTransactionsCommands(): void self::assertEquals( 'SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED', $this->platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::READ_UNCOMMITTED), - '' + '', ); self::assertEquals( 'SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED', - $this->platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::READ_COMMITTED) + $this->platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::READ_COMMITTED), ); self::assertEquals( 'SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ', - $this->platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::REPEATABLE_READ) + $this->platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::REPEATABLE_READ), ); self::assertEquals( 'SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE', - $this->platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::SERIALIZABLE) + $this->platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::SERIALIZABLE), ); } @@ -112,17 +108,17 @@ public function testGeneratesTypeDeclarationForIntegers(): void { self::assertEquals( 'INT', - $this->platform->getIntegerTypeDeclarationSQL([]) + $this->platform->getIntegerTypeDeclarationSQL([]), ); self::assertEquals( 'INT AUTO_INCREMENT', - $this->platform->getIntegerTypeDeclarationSQL(['autoincrement' => true]) + $this->platform->getIntegerTypeDeclarationSQL(['autoincrement' => true]), ); self::assertEquals( 'INT AUTO_INCREMENT', $this->platform->getIntegerTypeDeclarationSQL( - ['autoincrement' => true, 'primary' => true] - ) + ['autoincrement' => true, 'primary' => true], + ), ); } @@ -208,9 +204,7 @@ public function testChangeIndexWithForeignKeys(): void self::assertEquals(['ALTER TABLE test DROP INDEX uniq, ADD INDEX idx (col)'], $sql); } - /** - * @return string[] - */ + /** @return string[] */ protected function getQuotedColumnInPrimaryKeySQL(): array { return ['CREATE TABLE `quoted` (`create` VARCHAR(255) NOT NULL, ' @@ -218,9 +212,7 @@ protected function getQuotedColumnInPrimaryKeySQL(): array ]; } - /** - * @return string[] - */ + /** @return string[] */ protected function getQuotedColumnInIndexSQL(): array { return [ @@ -229,9 +221,7 @@ protected function getQuotedColumnInIndexSQL(): array ]; } - /** - * @return string[] - */ + /** @return string[] */ protected function getQuotedNameInIndexSQL(): array { return [ @@ -240,9 +230,7 @@ protected function getQuotedNameInIndexSQL(): array ]; } - /** - * @return string[] - */ + /** @return string[] */ protected function getQuotedColumnInForeignKeySQL(): array { return [ @@ -274,7 +262,7 @@ public function testCreateTableWithFulltextIndex(): void . 'FULLTEXT INDEX fulltext_text (text)) ' . 'ENGINE = MyISAM', ], - $sql + $sql, ); } @@ -294,7 +282,7 @@ public function testCreateTableWithSpatialIndex(): void 'CREATE TABLE spatial_table (point LONGTEXT NOT NULL, SPATIAL INDEX spatial_text (point)) ' . 'ENGINE = MyISAM', ], - $sql + $sql, ); } @@ -340,7 +328,7 @@ public function testAlterTableAddPrimaryKey(): void self::assertEquals( ['DROP INDEX idx_id ON alter_table_add_pk', 'ALTER TABLE alter_table_add_pk ADD PRIMARY KEY (id)'], - $this->platform->getAlterTableSQL($diff) + $this->platform->getAlterTableSQL($diff), ); } @@ -366,7 +354,7 @@ public function testAlterPrimaryKeyWithAutoincrementColumn(): void 'DROP INDEX `primary` ON alter_primary_key', 'ALTER TABLE alter_primary_key ADD PRIMARY KEY (foo)', ], - $this->platform->getAlterTableSQL($diff) + $this->platform->getAlterTableSQL($diff), ); } @@ -391,7 +379,7 @@ public function testDropPrimaryKeyWithAutoincrementColumn(): void 'ALTER TABLE drop_primary_key MODIFY id INT NOT NULL', 'DROP INDEX `primary` ON drop_primary_key', ], - $this->platform->getAlterTableSQL($diff) + $this->platform->getAlterTableSQL($diff), ); } @@ -418,7 +406,7 @@ public function testDropNonAutoincrementColumnFromCompositePrimaryKeyWithAutoinc 'DROP INDEX `primary` ON tbl', 'ALTER TABLE tbl ADD PRIMARY KEY (id)', ], - $this->platform->getAlterTableSQL($diff) + $this->platform->getAlterTableSQL($diff), ); } @@ -445,7 +433,7 @@ public function testAddNonAutoincrementColumnToPrimaryKeyWithAutoincrementColumn 'DROP INDEX `primary` ON tbl', 'ALTER TABLE tbl ADD PRIMARY KEY (id, foo)', ], - $this->platform->getAlterTableSQL($diff) + $this->platform->getAlterTableSQL($diff), ); } @@ -491,7 +479,7 @@ public function testAlterPrimaryKeyWithNewColumn(): void 'ALTER TABLE yolo ADD pkc2 INT NOT NULL', 'ALTER TABLE yolo ADD PRIMARY KEY (pkc1, pkc2)', ], - $this->platform->getAlterTableSQL($diff) + $this->platform->getAlterTableSQL($diff), ); } @@ -518,9 +506,7 @@ public function testGetVariableLengthBinaryTypeDeclarationSQLNoLength(): void parent::testGetVariableLengthBinaryTypeDeclarationSQLNoLength(); } - /** - * @return string[] - */ + /** @return string[] */ protected function getAlterTableRenameIndexSQL(): array { return [ @@ -529,9 +515,7 @@ protected function getAlterTableRenameIndexSQL(): array ]; } - /** - * @return string[] - */ + /** @return string[] */ protected function getQuotedAlterTableRenameIndexSQL(): array { return [ @@ -542,9 +526,7 @@ protected function getQuotedAlterTableRenameIndexSQL(): array ]; } - /** - * @return string[] - */ + /** @return string[] */ protected function getAlterTableRenameIndexInSchemaSQL(): array { return [ @@ -553,9 +535,7 @@ protected function getAlterTableRenameIndexInSchemaSQL(): array ]; } - /** - * @return string[] - */ + /** @return string[] */ protected function getQuotedAlterTableRenameIndexInSchemaSQL(): array { return [ @@ -582,7 +562,7 @@ public function testIgnoresDifferenceInDefaultValuesForUnsupportedColumnTypes(): . 'def_blob_null LONGBLOB DEFAULT NULL' . ')', ], - $this->platform->getCreateTableSQL($table) + $this->platform->getCreateTableSQL($table), ); $diffTable = clone $table; @@ -737,7 +717,7 @@ public function testQuotesDatabaseNameInListViewsSQL(): void { self::assertStringContainsStringIgnoringCase( "'Foo''Bar\\\\'", - $this->platform->getListViewsSQL("Foo'Bar\\") + $this->platform->getListViewsSQL("Foo'Bar\\"), ); } @@ -745,7 +725,7 @@ public function testColumnCharsetDeclarationSQL(): void { self::assertSame( 'CHARACTER SET ascii', - $this->platform->getColumnCharsetDeclarationSQL('ascii') + $this->platform->getColumnCharsetDeclarationSQL('ascii'), ); } @@ -758,7 +738,7 @@ public function testColumnCollationDeclarationSQL(): void { self::assertSame( 'COLLATE `ascii_general_ci`', - $this->platform->getColumnCollationDeclarationSQL('ascii_general_ci') + $this->platform->getColumnCollationDeclarationSQL('ascii_general_ci'), ); } @@ -774,7 +754,7 @@ public function testGetCreateTableSQLWithColumnCollation(): void 'CREATE TABLE foo (no_collation VARCHAR(255) NOT NULL, ' . 'column_collation VARCHAR(255) NOT NULL COLLATE `ascii_general_ci`)', ], - $this->platform->getCreateTableSQL($table) + $this->platform->getCreateTableSQL($table), ); } @@ -789,7 +769,7 @@ protected function createComparator(): Comparator $this->platform, $this->createStub(CharsetMetadataProvider::class), $this->createStub(CollationMetadataProvider::class), - new DefaultTableOptions('utf8mb4', 'utf8mb4_general_ci') + new DefaultTableOptions('utf8mb4', 'utf8mb4_general_ci'), ); } } diff --git a/tests/Platforms/AbstractPlatformTestCase.php b/tests/Platforms/AbstractPlatformTestCase.php index 9e7ff2c025e..c40a9c91371 100644 --- a/tests/Platforms/AbstractPlatformTestCase.php +++ b/tests/Platforms/AbstractPlatformTestCase.php @@ -23,17 +23,13 @@ use function implode; use function sprintf; -/** - * @template T of AbstractPlatform - */ +/** @template T of AbstractPlatform */ abstract class AbstractPlatformTestCase extends TestCase { /** @var T */ protected AbstractPlatform $platform; - /** - * @return T - */ + /** @return T */ abstract public function createPlatform(): AbstractPlatform; protected function setUp(): void @@ -51,17 +47,13 @@ public function testQuoteIdentifier(): void self::assertEquals('"test"."test"', $this->platform->quoteIdentifier('test.test')); } - /** - * @dataProvider getReturnsForeignKeyReferentialActionSQL - */ + /** @dataProvider getReturnsForeignKeyReferentialActionSQL */ public function testReturnsForeignKeyReferentialActionSQL(string $action, string $expectedSQL): void { self::assertSame($expectedSQL, $this->platform->getForeignKeyReferentialActionSQL($action)); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function getReturnsForeignKeyReferentialActionSQL(): iterable { return [ @@ -130,9 +122,7 @@ public function testGenerateTableWithMultiColumnUniqueIndex(): void self::assertEquals($this->getGenerateTableWithMultiColumnUniqueIndexSql(), $sql); } - /** - * @return string[] - */ + /** @return string[] */ abstract public function getGenerateTableWithMultiColumnUniqueIndexSql(): array; public function testGeneratesIndexCreationSql(): void @@ -141,7 +131,7 @@ public function testGeneratesIndexCreationSql(): void self::assertEquals( $this->getGenerateIndexSql(), - $this->platform->getCreateIndexSQL($indexDef, 'mytable') + $this->platform->getCreateIndexSQL($indexDef, 'mytable'), ); } @@ -233,13 +223,11 @@ public function getGenerateConstraintForeignKeySql(ForeignKeyConstraint $fk): st return sprintf( 'ALTER TABLE test ADD CONSTRAINT constraint_fk FOREIGN KEY (fk_name) REFERENCES %s (id)', - $quotedForeignTable + $quotedForeignTable, ); } - /** - * @return string[] - */ + /** @return string[] */ abstract public function getGenerateAlterTableSql(): array; public function testGeneratesTableAlterationSql(): void @@ -266,10 +254,10 @@ public function testGeneratesTableAlterationSql(): void [ 'length' => 255, 'default' => 'def', - ] + ], ), ['type', 'notnull', 'default'], - $table->getColumn('bar') + $table->getColumn('bar'), ); $tableDiff->changedColumns['bloo'] = new ColumnDiff( @@ -277,10 +265,10 @@ public function testGeneratesTableAlterationSql(): void new Column( 'bloo', Type::getType('boolean'), - ['default' => false] + ['default' => false], ), ['type', 'notnull', 'default'], - $table->getColumn('bloo') + $table->getColumn('bloo'), ); $sql = $this->platform->getAlterTableSQL($tableDiff); @@ -292,7 +280,7 @@ public function testGetCustomColumnDeclarationSql(): void { self::assertEquals( 'foo MEDIUMINT(6) UNSIGNED', - $this->platform->getColumnDeclarationSQL('foo', ['columnDefinition' => 'MEDIUMINT(6) UNSIGNED']) + $this->platform->getColumnDeclarationSQL('foo', ['columnDefinition' => 'MEDIUMINT(6) UNSIGNED']), ); } @@ -380,7 +368,7 @@ public function testGetAlterTableSqlDispatchEvent(): void 'changed', new Column('changed2', Type::getType('string'), ['length' => 255]), [], - $table->getColumn('changed') + $table->getColumn('changed'), ); $tableDiff->renamedColumns['renamed'] = new Column('renamed2', Type::getType('integer')); @@ -405,7 +393,7 @@ public function testGetDefaultValueDeclarationSQLDateTime(): void $this->platform->getDefaultValueDeclarationSQL([ 'type' => Type::getType($type), 'default' => $this->platform->getCurrentTimestampSQL(), - ]) + ]), ); } } @@ -418,7 +406,7 @@ public function testGetDefaultValueDeclarationSQLForIntegerTypes(): void $this->platform->getDefaultValueDeclarationSQL([ 'type' => Type::getType($type), 'default' => 1, - ]) + ]), ); } } @@ -432,7 +420,7 @@ public function testGetDefaultValueDeclarationSQLForDateType(): void $this->platform->getDefaultValueDeclarationSQL([ 'type' => Type::getType($type), 'default' => $currentDateSql, - ]) + ]), ); } } @@ -454,24 +442,16 @@ public function testQuotedColumnInPrimaryKeyPropagation(): void self::assertEquals($this->getQuotedColumnInPrimaryKeySQL(), $sql); } - /** - * @return string[] - */ + /** @return string[] */ abstract protected function getQuotedColumnInPrimaryKeySQL(): array; - /** - * @return string[] - */ + /** @return string[] */ abstract protected function getQuotedColumnInIndexSQL(): array; - /** - * @return string[] - */ + /** @return string[] */ abstract protected function getQuotedNameInIndexSQL(): array; - /** - * @return string[] - */ + /** @return string[] */ abstract protected function getQuotedColumnInForeignKeySQL(): array; public function testQuotedColumnInIndexPropagation(): void @@ -518,7 +498,7 @@ public function testQuotedColumnInForeignKeyPropagation(): void ['create', 'foo', '`bar`'], ['create', 'bar', '`foo-bar`'], [], - 'FK_WITH_RESERVED_KEYWORD' + 'FK_WITH_RESERVED_KEYWORD', ); // Foreign table with non-reserved keyword as name (does not need quotation). @@ -538,7 +518,7 @@ public function testQuotedColumnInForeignKeyPropagation(): void ['create', 'foo', '`bar`'], ['create', 'bar', '`foo-bar`'], [], - 'FK_WITH_NON_RESERVED_KEYWORD' + 'FK_WITH_NON_RESERVED_KEYWORD', ); // Foreign table with special character in name (needs quotation on some platforms, e.g. Sqlite). @@ -558,7 +538,7 @@ public function testQuotedColumnInForeignKeyPropagation(): void ['create', 'foo', '`bar`'], ['create', 'bar', '`foo-bar`'], [], - 'FK_WITH_INTENDED_QUOTATION' + 'FK_WITH_INTENDED_QUOTATION', ); $sql = $this->platform->getCreateTableSQL($table); @@ -571,7 +551,7 @@ public function testQuotesReservedKeywordInUniqueConstraintDeclarationSQL(): voi self::assertSame( $this->getQuotesReservedKeywordInUniqueConstraintDeclarationSQL(), - $this->platform->getUniqueConstraintDeclarationSQL($constraint) + $this->platform->getUniqueConstraintDeclarationSQL($constraint), ); } @@ -581,7 +561,7 @@ public function testQuotesReservedKeywordInTruncateTableSQL(): void { self::assertSame( $this->getQuotesReservedKeywordInTruncateTableSQL(), - $this->platform->getTruncateTableSQL('select') + $this->platform->getTruncateTableSQL('select'), ); } @@ -597,7 +577,7 @@ public function testQuotesReservedKeywordInIndexDeclarationSQL(): void self::assertSame( $this->getQuotesReservedKeywordInIndexDeclarationSQL(), - $this->platform->getIndexDeclarationSQL($index) + $this->platform->getIndexDeclarationSQL($index), ); } @@ -637,15 +617,15 @@ public function testAlterTableChangeQuotedColumn(): void new Column( 'select', Type::getType('string'), - ['length' => 255] + ['length' => 255], ), ['type'], - $table->getColumn('select') + $table->getColumn('select'), ); self::assertStringContainsString( $this->platform->quoteIdentifier('select'), - implode(';', $this->platform->getAlterTableSQL($tableDiff)) + implode(';', $this->platform->getAlterTableSQL($tableDiff)), ); } @@ -653,7 +633,7 @@ public function testGetFixedLengthStringTypeDeclarationSQLNoLength(): void { self::assertSame( $this->getExpectedFixedLengthStringTypeDeclarationSQLNoLength(), - $this->platform->getStringTypeDeclarationSQL(['fixed' => true]) + $this->platform->getStringTypeDeclarationSQL(['fixed' => true]), ); } @@ -669,7 +649,7 @@ public function testGetFixedLengthStringTypeDeclarationSQLWithLength(): void $this->platform->getStringTypeDeclarationSQL([ 'fixed' => true, 'length' => 16, - ]) + ]), ); } @@ -682,7 +662,7 @@ public function testGetVariableLengthStringTypeDeclarationSQLNoLength(): void { self::assertSame( $this->getExpectedVariableLengthStringTypeDeclarationSQLNoLength(), - $this->platform->getStringTypeDeclarationSQL([]) + $this->platform->getStringTypeDeclarationSQL([]), ); } @@ -695,7 +675,7 @@ public function testGetVariableLengthStringTypeDeclarationSQLWithLength(): void { self::assertSame( $this->getExpectedVariableLengthStringTypeDeclarationSQLWithLength(), - $this->platform->getStringTypeDeclarationSQL(['length' => 16]) + $this->platform->getStringTypeDeclarationSQL(['length' => 16]), ); } @@ -708,7 +688,7 @@ public function testGetFixedLengthBinaryTypeDeclarationSQLNoLength(): void { self::assertSame( $this->getExpectedFixedLengthBinaryTypeDeclarationSQLNoLength(), - $this->platform->getBinaryTypeDeclarationSQL(['fixed' => true]) + $this->platform->getBinaryTypeDeclarationSQL(['fixed' => true]), ); } @@ -724,7 +704,7 @@ public function testGetFixedLengthBinaryTypeDeclarationSQLWithLength(): void $this->platform->getBinaryTypeDeclarationSQL([ 'fixed' => true, 'length' => 16, - ]) + ]), ); } @@ -737,7 +717,7 @@ public function testGetVariableLengthBinaryTypeDeclarationSQLNoLength(): void { self::assertSame( $this->getExpectedVariableLengthBinaryTypeDeclarationSQLNoLength(), - $this->platform->getBinaryTypeDeclarationSQL([]) + $this->platform->getBinaryTypeDeclarationSQL([]), ); } @@ -750,7 +730,7 @@ public function testGetVariableLengthBinaryTypeDeclarationSQLWithLength(): void { self::assertSame( $this->getExpectedVariableLengthBinaryTypeDeclarationSQLWithLength(), - $this->platform->getBinaryTypeDeclarationSQL(['length' => 16]) + $this->platform->getBinaryTypeDeclarationSQL(['length' => 16]), ); } @@ -769,7 +749,7 @@ public function testReturnsJsonTypeDeclarationSQL(): void self::assertSame( $this->platform->getClobTypeDeclarationSQL($column), - $this->platform->getJsonTypeDeclarationSQL($column) + $this->platform->getJsonTypeDeclarationSQL($column), ); } @@ -785,13 +765,11 @@ public function testAlterTableRenameIndex(): void self::assertSame( $this->getAlterTableRenameIndexSQL(), - $this->platform->getAlterTableSQL($tableDiff) + $this->platform->getAlterTableSQL($tableDiff), ); } - /** - * @return string[] - */ + /** @return string[] */ protected function getAlterTableRenameIndexSQL(): array { return [ @@ -813,13 +791,11 @@ public function testQuotesAlterTableRenameIndex(): void self::assertSame( $this->getQuotedAlterTableRenameIndexSQL(), - $this->platform->getAlterTableSQL($tableDiff) + $this->platform->getAlterTableSQL($tableDiff), ); } - /** - * @return string[] - */ + /** @return string[] */ protected function getQuotedAlterTableRenameIndexSQL(): array { return [ @@ -881,7 +857,7 @@ public function testQuotesAlterTableRenameColumn(): void self::assertEquals( $this->getQuotedAlterTableRenameColumnSQL(), - $this->platform->getAlterTableSQL($diff) + $this->platform->getAlterTableSQL($diff), ); } @@ -920,7 +896,7 @@ public function testQuotesAlterTableChangeColumnLength(): void self::assertEquals( $this->getQuotedAlterTableChangeColumnLengthSQL(), - $this->platform->getAlterTableSQL($diff) + $this->platform->getAlterTableSQL($diff), ); } @@ -943,13 +919,11 @@ public function testAlterTableRenameIndexInSchema(): void self::assertSame( $this->getAlterTableRenameIndexInSchemaSQL(), - $this->platform->getAlterTableSQL($tableDiff) + $this->platform->getAlterTableSQL($tableDiff), ); } - /** - * @return string[] - */ + /** @return string[] */ protected function getAlterTableRenameIndexInSchemaSQL(): array { return [ @@ -971,13 +945,11 @@ public function testQuotesAlterTableRenameIndexInSchema(): void self::assertSame( $this->getQuotedAlterTableRenameIndexInSchemaSQL(), - $this->platform->getAlterTableSQL($tableDiff) + $this->platform->getAlterTableSQL($tableDiff), ); } - /** - * @return string[] - */ + /** @return string[] */ protected function getQuotedAlterTableRenameIndexInSchemaSQL(): array { return [ @@ -997,7 +969,7 @@ public function testGetCommentOnColumnSQLWithoutQuoteCharacter(): void { self::assertEquals( $this->getQuotedCommentOnColumnSQLWithoutQuoteCharacter(), - $this->platform->getCommentOnColumnSQL('mytable', 'id', 'This is a comment') + $this->platform->getCommentOnColumnSQL('mytable', 'id', 'This is a comment'), ); } @@ -1010,7 +982,7 @@ public function testGetCommentOnColumnSQLWithQuoteCharacter(): void { self::assertEquals( $this->getQuotedCommentOnColumnSQLWithQuoteCharacter(), - $this->platform->getCommentOnColumnSQL('mytable', 'id', "It's a quote !") + $this->platform->getCommentOnColumnSQL('mytable', 'id', "It's a quote !"), ); } @@ -1029,13 +1001,11 @@ public function testGetCommentOnColumnSQL(): void $this->platform->getCommentOnColumnSQL('foo', 'bar', 'comment'), // regular identifiers $this->platform->getCommentOnColumnSQL('`Foo`', '`BAR`', 'comment'), // explicitly quoted identifiers $this->platform->getCommentOnColumnSQL('select', 'from', 'comment'), // reserved keyword identifiers - ] + ], ); } - /** - * @dataProvider getGeneratesInlineColumnCommentSQL - */ + /** @dataProvider getGeneratesInlineColumnCommentSQL */ public function testGeneratesInlineColumnCommentSQL(string $comment, string $expectedSql): void { if (! $this->platform->supportsInlineColumnComments()) { @@ -1045,9 +1015,7 @@ public function testGeneratesInlineColumnCommentSQL(string $comment, string $exp self::assertSame($expectedSql, $this->platform->getInlineColumnCommentSQL($comment)); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function getGeneratesInlineColumnCommentSQL(): iterable { return [ @@ -1055,7 +1023,7 @@ public static function getGeneratesInlineColumnCommentSQL(): iterable 'comment requiring escaping' => [ sprintf( 'Using inline comment delimiter %s works', - static::getInlineColumnCommentDelimiter() + static::getInlineColumnCommentDelimiter(), ), static::getInlineColumnCommentRequiringEscapingSQL(), ], @@ -1091,7 +1059,7 @@ public function testThrowsExceptionOnGeneratingInlineColumnCommentSQLIfUnsupport $this->expectException(Exception::class); $this->expectExceptionMessage( - 'Operation "' . AbstractPlatform::class . '::getInlineColumnCommentSQL" is not supported by platform.' + 'Operation "' . AbstractPlatform::class . '::getInlineColumnCommentSQL" is not supported by platform.', ); $this->expectExceptionCode(0); @@ -1118,7 +1086,7 @@ public function testGeneratesAlterTableRenameColumnSQL(): void $table->addColumn( 'bar', 'integer', - ['notnull' => true, 'default' => 666, 'comment' => 'rename test'] + ['notnull' => true, 'default' => 666, 'comment' => 'rename test'], ); $tableDiff = new TableDiff('foo'); @@ -1126,15 +1094,13 @@ public function testGeneratesAlterTableRenameColumnSQL(): void $tableDiff->renamedColumns['bar'] = new Column( 'baz', Type::getType('integer'), - ['notnull' => true, 'default' => 666, 'comment' => 'rename test'] + ['notnull' => true, 'default' => 666, 'comment' => 'rename test'], ); self::assertSame($this->getAlterTableRenameColumnSQL(), $this->platform->getAlterTableSQL($tableDiff)); } - /** - * @return string[] - */ + /** @return string[] */ abstract public function getAlterTableRenameColumnSQL(): array; public function testQuotesTableIdentifiersInAlterTableSQL(): void @@ -1157,7 +1123,7 @@ public function testQuotesTableIdentifiersInAlterTableSQL(): void 'bar', new Column('bar', Type::getType('integer'), ['notnull' => false]), ['notnull'], - $table->getColumn('bar') + $table->getColumn('bar'), ); $tableDiff->renamedColumns['id'] = new Column('war', Type::getType('integer')); $tableDiff->removedColumns['baz'] = new Column('baz', Type::getType('integer')); @@ -1167,13 +1133,11 @@ public function testQuotesTableIdentifiersInAlterTableSQL(): void self::assertSame( $this->getQuotesTableIdentifiersInAlterTableSQL(), - $this->platform->getAlterTableSQL($tableDiff) + $this->platform->getAlterTableSQL($tableDiff), ); } - /** - * @return string[] - */ + /** @return string[] */ abstract protected function getQuotesTableIdentifiersInAlterTableSQL(): array; public function testAlterStringToFixedString(): void @@ -1189,10 +1153,10 @@ public function testAlterStringToFixedString(): void new Column( 'name', Type::getType('string'), - ['fixed' => true, 'length' => 2] + ['fixed' => true, 'length' => 2], ), ['fixed'], - $table->getColumn('name') + $table->getColumn('name'), ); $sql = $this->platform->getAlterTableSQL($tableDiff); @@ -1202,9 +1166,7 @@ public function testAlterStringToFixedString(): void self::assertEquals($expectedSql, $sql); } - /** - * @return string[] - */ + /** @return string[] */ abstract protected function getAlterStringToFixedStringSQL(): array; public function testGeneratesAlterTableRenameIndexUsedByForeignKeySQL(): void @@ -1228,13 +1190,11 @@ public function testGeneratesAlterTableRenameIndexUsedByForeignKeySQL(): void self::assertSame( $this->getGeneratesAlterTableRenameIndexUsedByForeignKeySQL(), - $this->platform->getAlterTableSQL($tableDiff) + $this->platform->getAlterTableSQL($tableDiff), ); } - /** - * @return string[] - */ + /** @return string[] */ abstract protected function getGeneratesAlterTableRenameIndexUsedByForeignKeySQL(): array; /** @@ -1247,9 +1207,7 @@ public function testGeneratesDecimalTypeDeclarationSQL(array $column, string $ex self::assertSame($expectedSql, $this->platform->getDecimalTypeDeclarationSQL($column)); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function getGeneratesDecimalTypeDeclarationSQL(): iterable { return [ @@ -1272,9 +1230,7 @@ public function testGeneratesFloatDeclarationSQL(array $column, string $expected self::assertSame($expectedSql, $this->platform->getFloatDeclarationSQL($column)); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function getGeneratesFloatDeclarationSQL(): iterable { return [ @@ -1291,7 +1247,7 @@ public function testItEscapesStringsForLike(): void { self::assertSame( '\_25\% off\_ your next purchase \\\\o/', - $this->platform->escapeStringForLike('_25% off_ your next purchase \o/', '\\') + $this->platform->escapeStringForLike('_25% off_ your next purchase \o/', '\\'), ); } @@ -1301,7 +1257,7 @@ public function testZeroOffsetWithoutLimitIsIgnored(): void self::assertSame( $query, - $this->platform->modifyLimitQuery($query, null, 0) + $this->platform->modifyLimitQuery($query, null, 0), ); } @@ -1316,9 +1272,7 @@ public function testAsciiSQLDeclaration(string $expectedSql, array $column): voi self::assertEquals($expectedSql, $declarationSql); } - /** - * @return array}> - */ + /** @return array}> */ public function asciiStringSqlDeclarationDataProvider(): array { return [ diff --git a/tests/Platforms/DB2PlatformTest.php b/tests/Platforms/DB2PlatformTest.php index 0673448e565..41688f053b9 100644 --- a/tests/Platforms/DB2PlatformTest.php +++ b/tests/Platforms/DB2PlatformTest.php @@ -14,9 +14,7 @@ use Doctrine\DBAL\Schema\TableDiff; use Doctrine\DBAL\Types\Type; -/** - * @extends AbstractPlatformTestCase - */ +/** @extends AbstractPlatformTestCase */ class DB2PlatformTest extends AbstractPlatformTestCase { public function createPlatform(): AbstractPlatform @@ -149,7 +147,7 @@ public function testGeneratesCreateTableSQLWithCommonIndexes(): void 'CREATE INDEX IDX_D87F7E0C5E237E06 ON test (name)', 'CREATE INDEX composite_idx ON test (id, name)', ], - $this->platform->getCreateTableSQL($table) + $this->platform->getCreateTableSQL($table), ); } @@ -166,7 +164,7 @@ public function testGeneratesCreateTableSQLWithForeignKeyConstraints(): void ['fk_1', 'fk_2'], ['pk_1', 'pk_2'], [], - 'named_fk' + 'named_fk', ); self::assertEquals( @@ -179,7 +177,7 @@ public function testGeneratesCreateTableSQLWithForeignKeyConstraints(): void . ' REFERENCES foreign_table2 (pk_1, pk_2)', 'CREATE INDEX IDX_D87F7E0C177612A38E7F4319 ON test (fk_1, fk_2)', ], - $this->platform->getCreateTableSQL($table) + $this->platform->getCreateTableSQL($table), ); } @@ -196,7 +194,7 @@ public function testGeneratesCreateTableSQLWithCheckConstraints(): void 'CREATE TABLE test (id INTEGER NOT NULL, check_max INTEGER NOT NULL, ' . 'check_min INTEGER NOT NULL, PRIMARY KEY(id), CHECK (check_max <= 10), CHECK (check_min >= 10))', ], - $this->platform->getCreateTableSQL($table) + $this->platform->getCreateTableSQL($table), ); } @@ -214,7 +212,7 @@ public function testGeneratesColumnTypesDeclarationSQL(): void self::assertEquals( 'SMALLINT GENERATED BY DEFAULT AS IDENTITY', - $this->platform->getSmallIntTypeDeclarationSQL($fullColumnDef) + $this->platform->getSmallIntTypeDeclarationSQL($fullColumnDef), ); self::assertEquals('INTEGER', $this->platform->getIntegerTypeDeclarationSQL([])); @@ -222,7 +220,7 @@ public function testGeneratesColumnTypesDeclarationSQL(): void self::assertEquals( 'INTEGER GENERATED BY DEFAULT AS IDENTITY', - $this->platform->getIntegerTypeDeclarationSQL($fullColumnDef) + $this->platform->getIntegerTypeDeclarationSQL($fullColumnDef), ); self::assertEquals('BIGINT', $this->platform->getBigIntTypeDeclarationSQL([])); @@ -230,7 +228,7 @@ public function testGeneratesColumnTypesDeclarationSQL(): void self::assertEquals( 'BIGINT GENERATED BY DEFAULT AS IDENTITY', - $this->platform->getBigIntTypeDeclarationSQL($fullColumnDef) + $this->platform->getBigIntTypeDeclarationSQL($fullColumnDef), ); self::assertEquals('BLOB(1M)', $this->platform->getBlobTypeDeclarationSQL($fullColumnDef)); @@ -240,7 +238,7 @@ public function testGeneratesColumnTypesDeclarationSQL(): void self::assertEquals( 'TIMESTAMP(0) WITH DEFAULT', - $this->platform->getDateTimeTypeDeclarationSQL(['version' => true]) + $this->platform->getDateTimeTypeDeclarationSQL(['version' => true]), ); self::assertEquals('TIMESTAMP(0)', $this->platform->getDateTimeTypeDeclarationSQL($fullColumnDef)); @@ -256,7 +254,7 @@ public function testGeneratesDDLSnippets(): void self::assertEquals( 'CREATE VIEW fooview AS ' . $viewSql, - $this->platform->getCreateViewSQL('fooview', $viewSql) + $this->platform->getCreateViewSQL('fooview', $viewSql), ); self::assertEquals('DROP VIEW fooview', $this->platform->getDropViewSQL('fooview')); @@ -268,8 +266,8 @@ public function testGeneratesCreateUnnamedPrimaryKeySQL(): void 'ALTER TABLE foo ADD PRIMARY KEY (a, b)', $this->platform->getCreatePrimaryKeySQL( new Index('any_pk_name', ['a', 'b'], true, true), - 'foo' - ) + 'foo', + ), ); } @@ -283,34 +281,34 @@ public function testGeneratesSQLSnippets(): void self::assertEquals( "'1987/05/02' + 2 MINUTE", - $this->platform->getDateAddMinutesExpression("'1987/05/02'", '2') + $this->platform->getDateAddMinutesExpression("'1987/05/02'", '2'), ); self::assertEquals( "'1987/05/02' + 102 MONTH", - $this->platform->getDateAddMonthExpression("'1987/05/02'", '102') + $this->platform->getDateAddMonthExpression("'1987/05/02'", '102'), ); self::assertEquals( "'1987/05/02' + (5 * 3) MONTH", - $this->platform->getDateAddQuartersExpression("'1987/05/02'", '5') + $this->platform->getDateAddQuartersExpression("'1987/05/02'", '5'), ); self::assertEquals( "'1987/05/02' + 1 SECOND", - $this->platform->getDateAddSecondsExpression("'1987/05/02'", '1') + $this->platform->getDateAddSecondsExpression("'1987/05/02'", '1'), ); self::assertEquals( "'1987/05/02' + (3 * 7) DAY", - $this->platform->getDateAddWeeksExpression("'1987/05/02'", '3') + $this->platform->getDateAddWeeksExpression("'1987/05/02'", '3'), ); self::assertEquals("'1987/05/02' + 10 YEAR", $this->platform->getDateAddYearsExpression("'1987/05/02'", '10')); self::assertEquals( "DAYS('1987/05/02') - DAYS('1987/04/01')", - $this->platform->getDateDiffExpression("'1987/05/02'", "'1987/04/01'") + $this->platform->getDateDiffExpression("'1987/05/02'", "'1987/04/01'"), ); self::assertEquals("'1987/05/02' - 4 DAY", $this->platform->getDateSubDaysExpression("'1987/05/02'", '4')); @@ -318,27 +316,27 @@ public function testGeneratesSQLSnippets(): void self::assertEquals( "'1987/05/02' - 2 MINUTE", - $this->platform->getDateSubMinutesExpression("'1987/05/02'", '2') + $this->platform->getDateSubMinutesExpression("'1987/05/02'", '2'), ); self::assertEquals( "'1987/05/02' - 102 MONTH", - $this->platform->getDateSubMonthExpression("'1987/05/02'", '102') + $this->platform->getDateSubMonthExpression("'1987/05/02'", '102'), ); self::assertEquals( "'1987/05/02' - (5 * 3) MONTH", - $this->platform->getDateSubQuartersExpression("'1987/05/02'", '5') + $this->platform->getDateSubQuartersExpression("'1987/05/02'", '5'), ); self::assertEquals( "'1987/05/02' - 1 SECOND", - $this->platform->getDateSubSecondsExpression("'1987/05/02'", '1') + $this->platform->getDateSubSecondsExpression("'1987/05/02'", '1'), ); self::assertEquals( "'1987/05/02' - (3 * 7) DAY", - $this->platform->getDateSubWeeksExpression("'1987/05/02'", '3') + $this->platform->getDateSubWeeksExpression("'1987/05/02'", '3'), ); self::assertEquals("'1987/05/02' - 10 YEAR", $this->platform->getDateSubYearsExpression("'1987/05/02'", '10')); @@ -346,12 +344,12 @@ public function testGeneratesSQLSnippets(): void self::assertEquals( 'LOCATE(substring_column, string_column)', - $this->platform->getLocateExpression('string_column', 'substring_column') + $this->platform->getLocateExpression('string_column', 'substring_column'), ); self::assertEquals( 'LOCATE(substring_column, string_column, 1)', - $this->platform->getLocateExpression('string_column', 'substring_column', '1') + $this->platform->getLocateExpression('string_column', 'substring_column', '1'), ); self::assertEquals('SUBSTR(column, 5)', $this->platform->getSubstringExpression('column', '5')); @@ -516,13 +514,11 @@ protected function getCommentOnColumnSQL(): array ]; } - /** - * @dataProvider getGeneratesAlterColumnSQL - */ + /** @dataProvider getGeneratesAlterColumnSQL */ public function testGeneratesAlterColumnSQL( string $changedProperty, Column $column, - ?string $expectedSQLClause = null + ?string $expectedSQLClause = null, ): void { $tableDiff = new TableDiff('foo'); $tableDiff->fromTable = new Table('foo'); @@ -539,9 +535,7 @@ public function testGeneratesAlterColumnSQL( self::assertSame($expectedSQL, $this->platform->getAlterTableSQL($tableDiff)); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function getGeneratesAlterColumnSQL(): iterable { return [ diff --git a/tests/Platforms/MySQL/CollationMetadataProvider/CachingCollationMetadataProviderTest.php b/tests/Platforms/MySQL/CollationMetadataProvider/CachingCollationMetadataProviderTest.php index 5d0c47233e6..f90bdaf7cde 100644 --- a/tests/Platforms/MySQL/CollationMetadataProvider/CachingCollationMetadataProviderTest.php +++ b/tests/Platforms/MySQL/CollationMetadataProvider/CachingCollationMetadataProviderTest.php @@ -10,9 +10,7 @@ class CachingCollationMetadataProviderTest extends TestCase { - /** - * @dataProvider charsetAndCollationProvider - */ + /** @dataProvider charsetAndCollationProvider */ public function testCharsetCaching(string $collation, ?string $charset): void { $underlyingProvider = $this->createMock(CollationMetadataProvider::class); @@ -26,9 +24,7 @@ public function testCharsetCaching(string $collation, ?string $charset): void self::assertSame($charset, $cachingProvider->getCollationCharset($collation)); } - /** - * @return iterable - */ + /** @return iterable */ public static function charsetAndCollationProvider(): iterable { yield 'found' => ['utf8mb4_unicode_ci', 'utf8mb4']; diff --git a/tests/Platforms/MySQL/ComparatorTest.php b/tests/Platforms/MySQL/ComparatorTest.php index 16d20d2b655..7b9774f3e7e 100644 --- a/tests/Platforms/MySQL/ComparatorTest.php +++ b/tests/Platforms/MySQL/ComparatorTest.php @@ -19,7 +19,7 @@ protected function setUp(): void new MySQLPlatform(), $this->createStub(CharsetMetadataProvider::class), $this->createStub(CollationMetadataProvider::class), - new DefaultTableOptions('utf8mb4', 'utf8mb4_general_ci') + new DefaultTableOptions('utf8mb4', 'utf8mb4_general_ci'), ); } } diff --git a/tests/Platforms/MySQLPlatformTest.php b/tests/Platforms/MySQLPlatformTest.php index 56ae4840a16..80a37abc625 100644 --- a/tests/Platforms/MySQLPlatformTest.php +++ b/tests/Platforms/MySQLPlatformTest.php @@ -31,17 +31,13 @@ public function testInitializesJsonTypeMapping(): void self::assertSame(Types::JSON, $this->platform->getDoctrineTypeMapping('json')); } - /** - * @return string[] - */ + /** @return string[] */ protected function getAlterTableRenameIndexSQL(): array { return ['ALTER TABLE mytable RENAME INDEX idx_foo TO idx_bar']; } - /** - * @return string[] - */ + /** @return string[] */ protected function getQuotedAlterTableRenameIndexSQL(): array { return [ @@ -50,17 +46,13 @@ protected function getQuotedAlterTableRenameIndexSQL(): array ]; } - /** - * @return string[] - */ + /** @return string[] */ protected function getAlterTableRenameIndexInSchemaSQL(): array { return ['ALTER TABLE myschema.mytable RENAME INDEX idx_foo TO idx_bar']; } - /** - * @return string[] - */ + /** @return string[] */ protected function getQuotedAlterTableRenameIndexInSchemaSQL(): array { return [ @@ -81,7 +73,7 @@ public function testHasCorrectDefaultTransactionIsolationLevel(): void { self::assertEquals( TransactionIsolationLevel::REPEATABLE_READ, - $this->platform->getDefaultTransactionIsolationLevel() + $this->platform->getDefaultTransactionIsolationLevel(), ); } @@ -92,7 +84,7 @@ public function testCollationOptionIsTakenIntoAccount(): void $table->addOption('collation', 'my_collation'); self::assertStringContainsString( 'my_collation', - $this->platform->getCreateTableSQL($table)[0] + $this->platform->getCreateTableSQL($table)[0], ); } } diff --git a/tests/Platforms/OraclePlatformTest.php b/tests/Platforms/OraclePlatformTest.php index e94de14202f..8527e8e0619 100644 --- a/tests/Platforms/OraclePlatformTest.php +++ b/tests/Platforms/OraclePlatformTest.php @@ -19,9 +19,7 @@ use function strtoupper; use function uniqid; -/** - * @extends AbstractPlatformTestCase - */ +/** @extends AbstractPlatformTestCase */ class OraclePlatformTest extends AbstractPlatformTestCase { public function createPlatform(): AbstractPlatform @@ -70,7 +68,7 @@ public function testGeneratesSqlSnippets(): void { self::assertEquals( 'column1 || column2 || column3', - $this->platform->getConcatExpression('column1', 'column2', 'column3') + $this->platform->getConcatExpression('column1', 'column2', 'column3'), ); } @@ -78,19 +76,19 @@ public function testGeneratesTransactionsCommands(): void { self::assertEquals( 'SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED', - $this->platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::READ_UNCOMMITTED) + $this->platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::READ_UNCOMMITTED), ); self::assertEquals( 'SET TRANSACTION ISOLATION LEVEL READ COMMITTED', - $this->platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::READ_COMMITTED) + $this->platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::READ_COMMITTED), ); self::assertEquals( 'SET TRANSACTION ISOLATION LEVEL SERIALIZABLE', - $this->platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::REPEATABLE_READ) + $this->platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::REPEATABLE_READ), ); self::assertEquals( 'SET TRANSACTION ISOLATION LEVEL SERIALIZABLE', - $this->platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::SERIALIZABLE) + $this->platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::SERIALIZABLE), ); } @@ -113,17 +111,17 @@ public function testGeneratesTypeDeclarationForIntegers(): void { self::assertEquals( 'NUMBER(10)', - $this->platform->getIntegerTypeDeclarationSQL([]) + $this->platform->getIntegerTypeDeclarationSQL([]), ); self::assertEquals( 'NUMBER(10)', - $this->platform->getIntegerTypeDeclarationSQL(['autoincrement' => true]) + $this->platform->getIntegerTypeDeclarationSQL(['autoincrement' => true]), ); self::assertEquals( 'NUMBER(10)', $this->platform->getIntegerTypeDeclarationSQL( - ['autoincrement' => true, 'primary' => true] - ) + ['autoincrement' => true, 'primary' => true], + ), ); } @@ -169,9 +167,7 @@ public function testGeneratesAdvancedForeignKeyOptionsSQL(array $options, string self::assertSame($expectedSql, $this->platform->getAdvancedForeignKeyOptionsSQL($foreignKey)); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function getGeneratesAdvancedForeignKeyOptionsSQLData(): iterable { return [ @@ -227,11 +223,11 @@ public function testGenerateTableWithAutoincrement(): void $tableName, $tableName, $tableName, - $columnName + $columnName, ), sprintf('CREATE SEQUENCE %s_SEQ START WITH 1 MINVALUE 1 INCREMENT BY 1', $tableName), sprintf( - <<platform->getCreateTableSQL($table)); } @@ -395,22 +391,18 @@ public function testDoesNotPropagateUnnecessaryTableAlterationOnBinaryType(): vo self::assertNull( $this->createComparator() - ->diffTable($table1, $table2) + ->diffTable($table1, $table2), ); } - /** - * @dataProvider dataCreateSequenceWithCache - */ + /** @dataProvider dataCreateSequenceWithCache */ public function testCreateSequenceWithCache(int $cacheSize, string $expectedSql): void { $sequence = new Sequence('foo', 1, 1, $cacheSize); self::assertStringContainsString($expectedSql, $this->platform->getCreateSequenceSQL($sequence)); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function dataCreateSequenceWithCache(): iterable { return [ @@ -507,9 +499,7 @@ public function testReturnsDropAutoincrementSQL(string $table, array $expectedSq self::assertSame($expectedSql, $this->platform->getDropAutoincrementSql($table)); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function getReturnsDropAutoincrementSQL(): iterable { return [ @@ -581,7 +571,7 @@ public function testAltersTableColumnCommentWithExplicitlyQuotedIdentifiers(): v self::assertNotNull($tableDiff); self::assertSame( ['COMMENT ON COLUMN "foo"."bar" IS \'baz\''], - $this->platform->getAlterTableSQL($tableDiff) + $this->platform->getAlterTableSQL($tableDiff), ); } @@ -598,7 +588,7 @@ public function testQuotedTableNames(): void $sql = $this->platform->getCreateTableSQL($table); self::assertEquals('CREATE TABLE "test" ("id" NUMBER(10) NOT NULL)', $sql[0]); self::assertEquals('CREATE SEQUENCE "test_SEQ" START WITH 1 MINVALUE 1 INCREMENT BY 1', $sql[2]); - $createTriggerStatement = <<platform->getListSequencesSQL("Foo'Bar\\") + $this->platform->getListSequencesSQL("Foo'Bar\\"), ); } - /** - * @return array}> - */ + /** @return array}> */ public function asciiStringSqlDeclarationDataProvider(): array { return [ diff --git a/tests/Platforms/PostgreSQLPlatformTest.php b/tests/Platforms/PostgreSQLPlatformTest.php index f8f9cc1e514..55cfaaee176 100644 --- a/tests/Platforms/PostgreSQLPlatformTest.php +++ b/tests/Platforms/PostgreSQLPlatformTest.php @@ -18,9 +18,7 @@ use function sprintf; -/** - * @extends AbstractPlatformTestCase - */ +/** @extends AbstractPlatformTestCase */ class PostgreSQLPlatformTest extends AbstractPlatformTestCase { public function createPlatform(): AbstractPlatform @@ -81,12 +79,12 @@ public function testGeneratesForeignKeySqlForNonStandardOptions(): void 'my_table', ['id'], 'my_fk', - ['onDelete' => 'CASCADE'] + ['onDelete' => 'CASCADE'], ); self::assertEquals( 'CONSTRAINT my_fk FOREIGN KEY (foreign_id)' . ' REFERENCES my_table (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE', - $this->platform->getForeignKeyDeclarationSQL($foreignKey) + $this->platform->getForeignKeyDeclarationSQL($foreignKey), ); $foreignKey = new ForeignKeyConstraint( @@ -94,12 +92,12 @@ public function testGeneratesForeignKeySqlForNonStandardOptions(): void 'my_table', ['id'], 'my_fk', - ['match' => 'full'] + ['match' => 'full'], ); self::assertEquals( 'CONSTRAINT my_fk FOREIGN KEY (foreign_id)' . ' REFERENCES my_table (id) MATCH full NOT DEFERRABLE INITIALLY IMMEDIATE', - $this->platform->getForeignKeyDeclarationSQL($foreignKey) + $this->platform->getForeignKeyDeclarationSQL($foreignKey), ); $foreignKey = new ForeignKeyConstraint( @@ -107,12 +105,12 @@ public function testGeneratesForeignKeySqlForNonStandardOptions(): void 'my_table', ['id'], 'my_fk', - ['deferrable' => true] + ['deferrable' => true], ); self::assertEquals( 'CONSTRAINT my_fk FOREIGN KEY (foreign_id)' . ' REFERENCES my_table (id) DEFERRABLE INITIALLY IMMEDIATE', - $this->platform->getForeignKeyDeclarationSQL($foreignKey) + $this->platform->getForeignKeyDeclarationSQL($foreignKey), ); $foreignKey = new ForeignKeyConstraint( @@ -120,12 +118,12 @@ public function testGeneratesForeignKeySqlForNonStandardOptions(): void 'my_table', ['id'], 'my_fk', - ['deferred' => true] + ['deferred' => true], ); self::assertEquals( 'CONSTRAINT my_fk FOREIGN KEY (foreign_id)' . ' REFERENCES my_table (id) NOT DEFERRABLE INITIALLY DEFERRED', - $this->platform->getForeignKeyDeclarationSQL($foreignKey) + $this->platform->getForeignKeyDeclarationSQL($foreignKey), ); $foreignKey = new ForeignKeyConstraint( @@ -133,12 +131,12 @@ public function testGeneratesForeignKeySqlForNonStandardOptions(): void 'my_table', ['id'], 'my_fk', - ['deferred' => true] + ['deferred' => true], ); self::assertEquals( 'CONSTRAINT my_fk FOREIGN KEY (foreign_id)' . ' REFERENCES my_table (id) NOT DEFERRABLE INITIALLY DEFERRED', - $this->platform->getForeignKeyDeclarationSQL($foreignKey) + $this->platform->getForeignKeyDeclarationSQL($foreignKey), ); $foreignKey = new ForeignKeyConstraint( @@ -146,12 +144,12 @@ public function testGeneratesForeignKeySqlForNonStandardOptions(): void 'my_table', ['id'], 'my_fk', - ['deferrable' => true, 'deferred' => true, 'match' => 'full'] + ['deferrable' => true, 'deferred' => true, 'match' => 'full'], ); self::assertEquals( 'CONSTRAINT my_fk FOREIGN KEY (foreign_id)' . ' REFERENCES my_table (id) MATCH full DEFERRABLE INITIALLY DEFERRED', - $this->platform->getForeignKeyDeclarationSQL($foreignKey) + $this->platform->getForeignKeyDeclarationSQL($foreignKey), ); } @@ -161,14 +159,14 @@ public function testGeneratesSqlSnippets(): void self::assertEquals( 'column1 || column2 || column3', - $this->platform->getConcatExpression('column1', 'column2', 'column3') + $this->platform->getConcatExpression('column1', 'column2', 'column3'), ); self::assertEquals('SUBSTRING(column FROM 5)', $this->platform->getSubstringExpression('column', '5')); self::assertEquals( 'SUBSTRING(column FROM 1 FOR 5)', - $this->platform->getSubstringExpression('column', '1', '5') + $this->platform->getSubstringExpression('column', '1', '5'), ); } @@ -176,19 +174,19 @@ public function testGeneratesTransactionCommands(): void { self::assertEquals( 'SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL READ UNCOMMITTED', - $this->platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::READ_UNCOMMITTED) + $this->platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::READ_UNCOMMITTED), ); self::assertEquals( 'SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL READ COMMITTED', - $this->platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::READ_COMMITTED) + $this->platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::READ_COMMITTED), ); self::assertEquals( 'SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL REPEATABLE READ', - $this->platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::REPEATABLE_READ) + $this->platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::REPEATABLE_READ), ); self::assertEquals( 'SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL SERIALIZABLE', - $this->platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::SERIALIZABLE) + $this->platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::SERIALIZABLE), ); } @@ -207,13 +205,11 @@ public function testGenerateTableWithAutoincrement(): void self::assertEquals( ['CREATE TABLE autoinc_table (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL)'], - $this->platform->getCreateTableSQL($table) + $this->platform->getCreateTableSQL($table), ); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function serialTypes(): iterable { return [ @@ -222,9 +218,7 @@ public static function serialTypes(): iterable ]; } - /** - * @dataProvider serialTypes - */ + /** @dataProvider serialTypes */ public function testGenerateTableWithAutoincrementDoesNotSetDefault(string $type, string $definition): void { $table = new Table('autoinc_table_notnull'); @@ -237,9 +231,7 @@ public function testGenerateTableWithAutoincrementDoesNotSetDefault(string $type self::assertEquals([sprintf('CREATE TABLE autoinc_table_notnull (id %s)', $definition)], $sql); } - /** - * @dataProvider serialTypes - */ + /** @dataProvider serialTypes */ public function testCreateTableWithAutoincrementAndNotNullAddsConstraint(string $type, string $definition): void { $table = new Table('autoinc_table_notnull_enabled'); @@ -252,9 +244,7 @@ public function testCreateTableWithAutoincrementAndNotNullAddsConstraint(string self::assertEquals([sprintf('CREATE TABLE autoinc_table_notnull_enabled (id %s NOT NULL)', $definition)], $sql); } - /** - * @dataProvider serialTypes - */ + /** @dataProvider serialTypes */ public function testGetDefaultValueDeclarationSQLIgnoresTheDefaultKeyWhenTheFieldIsSerial(string $type): void { $sql = $this->platform->getDefaultValueDeclarationSQL( @@ -262,7 +252,7 @@ public function testGetDefaultValueDeclarationSQLIgnoresTheDefaultKeyWhenTheFiel 'autoincrement' => true, 'type' => Type::getType($type), 'default' => 1, - ] + ], ); self::assertSame('', $sql); @@ -272,17 +262,17 @@ public function testGeneratesTypeDeclarationForIntegers(): void { self::assertEquals( 'INT', - $this->platform->getIntegerTypeDeclarationSQL([]) + $this->platform->getIntegerTypeDeclarationSQL([]), ); self::assertEquals( 'INT GENERATED BY DEFAULT AS IDENTITY', - $this->platform->getIntegerTypeDeclarationSQL(['autoincrement' => true]) + $this->platform->getIntegerTypeDeclarationSQL(['autoincrement' => true]), ); self::assertEquals( 'INT GENERATED BY DEFAULT AS IDENTITY', $this->platform->getIntegerTypeDeclarationSQL( - ['autoincrement' => true, 'primary' => true] - ) + ['autoincrement' => true, 'primary' => true], + ), ); } @@ -296,15 +286,15 @@ public function testGeneratesSequenceSqlCommands(): void $sequence = new Sequence('myseq', 20, 1); self::assertEquals( 'CREATE SEQUENCE myseq INCREMENT BY 20 MINVALUE 1 START 1', - $this->platform->getCreateSequenceSQL($sequence) + $this->platform->getCreateSequenceSQL($sequence), ); self::assertEquals( 'DROP SEQUENCE myseq CASCADE', - $this->platform->getDropSequenceSQL('myseq') + $this->platform->getDropSequenceSQL('myseq'), ); self::assertEquals( "SELECT NEXTVAL('myseq')", - $this->platform->getSequenceNextValSQL('myseq') + $this->platform->getSequenceNextValSQL('myseq'), ); } @@ -388,12 +378,10 @@ protected function getQuotedColumnInForeignKeySQL(): array ]; } - /** - * @dataProvider pgBooleanProvider - */ + /** @dataProvider pgBooleanProvider */ public function testConvertBooleanAsLiteralStrings( string $databaseValue, - string $preparedStatementValue + string $preparedStatementValue, ): void { self::assertEquals($preparedStatementValue, $this->platform->convertBooleans($databaseValue)); } @@ -409,14 +397,12 @@ public function testConvertBooleanAsLiteralIntegers(): void self::assertEquals(0, $this->platform->convertBooleans('0')); } - /** - * @dataProvider pgBooleanProvider - */ + /** @dataProvider pgBooleanProvider */ public function testConvertBooleanAsDatabaseValueStrings( string $databaseValue, string $preparedStatementValue, int $integerValue, - bool $booleanValue + bool $booleanValue, ): void { self::assertSame($integerValue, $this->platform->convertBooleansToDatabaseValue($booleanValue)); } @@ -429,14 +415,12 @@ public function testConvertBooleanAsDatabaseValueIntegers(): void self::assertSame(0, $this->platform->convertBooleansToDatabaseValue(false)); } - /** - * @dataProvider pgBooleanProvider - */ + /** @dataProvider pgBooleanProvider */ public function testConvertFromBoolean( string $databaseValue, string $prepareStatementValue, int $integerValue, - bool $booleanValue + bool $booleanValue, ): void { self::assertSame($booleanValue, $this->platform->convertFromBoolean($databaseValue)); } @@ -481,18 +465,14 @@ public function testDroppingConstraintsBeforeColumns(): void self::assertEquals($expectedSql, $sql); } - /** - * @dataProvider dataCreateSequenceWithCache - */ + /** @dataProvider dataCreateSequenceWithCache */ public function testCreateSequenceWithCache(int $cacheSize, string $expectedSql): void { $sequence = new Sequence('foo', 1, 1, $cacheSize); self::assertStringContainsString($expectedSql, $this->platform->getCreateSequenceSQL($sequence)); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function dataCreateSequenceWithCache(): iterable { return [ @@ -715,7 +695,7 @@ public function testAltersTableColumnCommentWithExplicitlyQuotedIdentifiers(): v self::assertInstanceOf(TableDiff::class, $tableDiff); self::assertSame( ['COMMENT ON COLUMN "foo"."bar" IS \'baz\''], - $this->platform->getAlterTableSQL($tableDiff) + $this->platform->getAlterTableSQL($tableDiff), ); } @@ -772,7 +752,7 @@ public function testGetCreateTableSQLWithUniqueConstraints(): void 'ALTER TABLE foo ADD CONSTRAINT test_unique_constraint UNIQUE (id)', ], $this->platform->getCreateTableSQL($table), - 'Unique constraints are added to table.' + 'Unique constraints are added to table.', ); } @@ -787,7 +767,7 @@ public function testGetCreateTableSQLWithColumnCollation(): void "COMMENT ON TABLE foo IS 'foo'", ], $this->platform->getCreateTableSQL($table), - 'Comments are added to table.' + 'Comments are added to table.', ); } @@ -795,7 +775,7 @@ public function testColumnCollationDeclarationSQL(): void { self::assertEquals( 'COLLATE "en_US.UTF-8"', - $this->platform->getColumnCollationDeclarationSQL('en_US.UTF-8') + $this->platform->getColumnCollationDeclarationSQL('en_US.UTF-8'), ); } @@ -810,17 +790,17 @@ public function testReturnsSmallIntTypeDeclarationSQL(): void { self::assertSame( 'SMALLINT GENERATED BY DEFAULT AS IDENTITY', - $this->platform->getSmallIntTypeDeclarationSQL(['autoincrement' => true]) + $this->platform->getSmallIntTypeDeclarationSQL(['autoincrement' => true]), ); self::assertSame( 'SMALLINT', - $this->platform->getSmallIntTypeDeclarationSQL(['autoincrement' => false]) + $this->platform->getSmallIntTypeDeclarationSQL(['autoincrement' => false]), ); self::assertSame( 'SMALLINT', - $this->platform->getSmallIntTypeDeclarationSQL([]) + $this->platform->getSmallIntTypeDeclarationSQL([]), ); } @@ -843,7 +823,7 @@ public function testGetListSequencesSQL(): void WHERE sequence_catalog = 'test_db' AND sequence_schema NOT LIKE 'pg\_%' AND sequence_schema != 'information_schema'", - $this->platform->getListSequencesSQL('test_db') + $this->platform->getListSequencesSQL('test_db'), ); } } diff --git a/tests/Platforms/SQLServerPlatformTestCase.php b/tests/Platforms/SQLServerPlatformTestCase.php index 4d64549a258..2d99de859f8 100644 --- a/tests/Platforms/SQLServerPlatformTestCase.php +++ b/tests/Platforms/SQLServerPlatformTestCase.php @@ -20,9 +20,7 @@ use Doctrine\DBAL\TransactionIsolationLevel; use Doctrine\DBAL\Types\Type; -/** - * @extends AbstractPlatformTestCase - */ +/** @extends AbstractPlatformTestCase */ class SQLServerPlatformTestCase extends AbstractPlatformTestCase { public function createPlatform(): AbstractPlatform @@ -89,7 +87,7 @@ public function testGeneratesSqlSnippets(): void self::assertEquals('CURRENT_TIMESTAMP', $this->platform->getCurrentTimestampSQL()); self::assertEquals( '(column1 + column2 + column3)', - $this->platform->getConcatExpression('column1', 'column2', 'column3') + $this->platform->getConcatExpression('column1', 'column2', 'column3'), ); } @@ -97,19 +95,19 @@ public function testGeneratesTransactionsCommands(): void { self::assertEquals( 'SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED', - $this->platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::READ_UNCOMMITTED) + $this->platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::READ_UNCOMMITTED), ); self::assertEquals( 'SET TRANSACTION ISOLATION LEVEL READ COMMITTED', - $this->platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::READ_COMMITTED) + $this->platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::READ_COMMITTED), ); self::assertEquals( 'SET TRANSACTION ISOLATION LEVEL REPEATABLE READ', - $this->platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::REPEATABLE_READ) + $this->platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::REPEATABLE_READ), ); self::assertEquals( 'SET TRANSACTION ISOLATION LEVEL SERIALIZABLE', - $this->platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::SERIALIZABLE) + $this->platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::SERIALIZABLE), ); } @@ -127,17 +125,17 @@ public function testGeneratesTypeDeclarationForIntegers(): void { self::assertEquals( 'INT', - $this->platform->getIntegerTypeDeclarationSQL([]) + $this->platform->getIntegerTypeDeclarationSQL([]), ); self::assertEquals( 'INT IDENTITY', - $this->platform->getIntegerTypeDeclarationSQL(['autoincrement' => true]) + $this->platform->getIntegerTypeDeclarationSQL(['autoincrement' => true]), ); self::assertEquals( 'INT IDENTITY', $this->platform->getIntegerTypeDeclarationSQL( - ['autoincrement' => true, 'primary' => true] - ) + ['autoincrement' => true, 'primary' => true], + ), ); } @@ -146,7 +144,7 @@ public function testGeneratesTypeDeclarationsForStrings(): void self::assertSame('VARCHAR(MAX)', $this->platform->getClobTypeDeclarationSQL([])); self::assertSame( 'VARCHAR(MAX)', - $this->platform->getClobTypeDeclarationSQL(['length' => 5, 'fixed' => true]) + $this->platform->getClobTypeDeclarationSQL(['length' => 5, 'fixed' => true]), ); } @@ -220,12 +218,12 @@ public function testModifyLimitQueryWithMultipleOrderBy(): void { $sql = $this->platform->modifyLimitQuery( 'SELECT * FROM user ORDER BY username DESC, usereamil ASC', - 10 + 10, ); self::assertEquals( 'SELECT * FROM user ORDER BY username DESC, usereamil ASC OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY', - $sql + $sql, ); } @@ -233,14 +231,14 @@ public function testModifyLimitQueryWithSubSelect(): void { $sql = $this->platform->modifyLimitQuery( 'SELECT * FROM (SELECT u.id as uid, u.name as uname) dctrn_result', - 10 + 10, ); self::assertEquals( 'SELECT * FROM (' . 'SELECT u.id as uid, u.name as uname' . ') dctrn_result ORDER BY (SELECT 0) OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY', - $sql + $sql, ); } @@ -250,26 +248,26 @@ public function testModifyLimitQueryWithSubSelectAndOrder(): void 'SELECT * FROM (' . 'SELECT u.id as uid, u.name as uname' . ') dctrn_result ORDER BY uname DESC', - 10 + 10, ); self::assertEquals( 'SELECT * FROM (' . 'SELECT u.id as uid, u.name as uname' . ') dctrn_result ORDER BY uname DESC OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY', - $sql + $sql, ); $sql = $this->platform->modifyLimitQuery( 'SELECT * FROM (SELECT u.id, u.name) dctrn_result ORDER BY name DESC', - 10 + 10, ); self::assertEquals( 'SELECT * FROM (' . 'SELECT u.id, u.name' . ') dctrn_result ORDER BY name DESC OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY', - $sql + $sql, ); } @@ -278,40 +276,40 @@ public function testModifyLimitQueryWithSubSelectAndMultipleOrder(): void $sql = $this->platform->modifyLimitQuery( 'SELECT * FROM (SELECT u.id as uid, u.name as uname) dctrn_result ORDER BY uname DESC, uid ASC', 10, - 5 + 5, ); self::assertEquals( 'SELECT * FROM (' . 'SELECT u.id as uid, u.name as uname' . ') dctrn_result ORDER BY uname DESC, uid ASC OFFSET 5 ROWS FETCH NEXT 10 ROWS ONLY', - $sql + $sql, ); $sql = $this->platform->modifyLimitQuery( 'SELECT * FROM (SELECT u.id uid, u.name uname) dctrn_result ORDER BY uname DESC, uid ASC', 10, - 5 + 5, ); self::assertEquals( 'SELECT * FROM (' . 'SELECT u.id uid, u.name uname' . ') dctrn_result ORDER BY uname DESC, uid ASC OFFSET 5 ROWS FETCH NEXT 10 ROWS ONLY', - $sql + $sql, ); $sql = $this->platform->modifyLimitQuery( 'SELECT * FROM (SELECT u.id, u.name) dctrn_result ORDER BY name DESC, id ASC', 10, - 5 + 5, ); self::assertEquals( 'SELECT * FROM (' . 'SELECT u.id, u.name' . ') dctrn_result ORDER BY name DESC, id ASC OFFSET 5 ROWS FETCH NEXT 10 ROWS ONLY', - $sql + $sql, ); } @@ -321,7 +319,7 @@ public function testModifyLimitQueryWithFromColumnNames(): void self::assertEquals( 'SELECT a.fromFoo, fromBar FROM foo ORDER BY (SELECT 0) OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY', - $sql + $sql, ); } @@ -370,7 +368,7 @@ public function testModifyLimitQueryWithExtraLongQuery(): void self::assertEquals( $expected, - $this->platform->modifyLimitQuery($query, 10) + $this->platform->modifyLimitQuery($query, 10), ); } @@ -406,7 +404,7 @@ public function testModifyLimitQueryWithSubSelectInSelectList(): void 'FROM profile p WHERE p.user_id = u.id) login_count ' . 'FROM user u ' . "WHERE u.status = 'disabled'", - 10 + 10, ); self::assertEquals( @@ -419,7 +417,7 @@ public function testModifyLimitQueryWithSubSelectInSelectList(): void 'FROM user u ' . "WHERE u.status = 'disabled' " . 'ORDER BY (SELECT 0) OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY', - $sql + $sql, ); } @@ -436,7 +434,7 @@ public function testModifyLimitQueryWithSubSelectInSelectListAndOrderByClause(): "WHERE u.status = 'disabled' " . 'ORDER BY u.username DESC', 10, - 5 + 5, ); self::assertEquals( @@ -450,7 +448,7 @@ public function testModifyLimitQueryWithSubSelectInSelectListAndOrderByClause(): "WHERE u.status = 'disabled' " . 'ORDER BY u.username DESC ' . 'OFFSET 5 ROWS FETCH NEXT 10 ROWS ONLY', - $sql + $sql, ); } @@ -464,7 +462,7 @@ public function testModifyLimitQueryWithAggregateFunctionInOrderByClause(): void 'GROUP BY code ' . 'ORDER BY MAX(heading_id) DESC', 1, - 0 + 0, ); self::assertEquals( @@ -475,7 +473,7 @@ public function testModifyLimitQueryWithAggregateFunctionInOrderByClause(): void 'GROUP BY code ' . 'ORDER BY MAX(heading_id) DESC ' . 'OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY', - $sql + $sql, ); } @@ -551,7 +549,7 @@ public function testModifyLimitSubquerySimple(): void self::assertEquals( $expected, - $this->platform->modifyLimitQuery($query, 20) + $this->platform->modifyLimitQuery($query, 20), ); } @@ -576,7 +574,7 @@ public function testCreateNonClusteredPrimaryKeyInTable(): void self::assertEquals( ['CREATE TABLE tbl (id INT NOT NULL, PRIMARY KEY NONCLUSTERED (id))'], - $this->platform->getCreateTableSQL($table) + $this->platform->getCreateTableSQL($table), ); } @@ -586,7 +584,7 @@ public function testCreateNonClusteredPrimaryKey(): void $idx->addFlag('nonclustered'); self::assertEquals( 'ALTER TABLE tbl ADD PRIMARY KEY NONCLUSTERED (id)', - $this->platform->getCreatePrimaryKeySQL($idx, 'tbl') + $this->platform->getCreatePrimaryKeySQL($idx, 'tbl'), ); } @@ -686,7 +684,7 @@ public function testAlterTableWithSchemaDropColumnComments(): void 'quota', new Column('quota', Type::getType('integer'), []), ['comment'], - new Column('quota', Type::getType('integer'), ['comment' => 'A comment']) + new Column('quota', Type::getType('integer'), ['comment' => 'A comment']), ); $expectedSql = [ @@ -704,7 +702,7 @@ public function testAlterTableWithSchemaUpdateColumnComments(): void 'quota', new Column('quota', Type::getType('integer'), ['comment' => 'B comment']), ['comment'], - new Column('quota', Type::getType('integer'), ['comment' => 'A comment']) + new Column('quota', Type::getType('integer'), ['comment' => 'A comment']), ); $expectedSql = ["EXEC sp_updateextendedproperty N'MS_Description', N'B comment', " @@ -724,7 +722,7 @@ public function testGeneratesCreateTableSQLWithColumnComments(): void $table->addColumn( '`comment_quoted`', 'integer', - ['comment' => 'Doctrine 0wnz comments for explicitly quoted columns!'] + ['comment' => 'Doctrine 0wnz comments for explicitly quoted columns!'], ); $table->addColumn('create', 'integer', ['comment' => 'Doctrine 0wnz comments for reserved keyword columns!']); $table->addColumn('commented_type', 'json'); @@ -760,7 +758,7 @@ public function testGeneratesCreateTableSQLWithColumnComments(): void "EXEC sp_addextendedproperty N'MS_Description', N'O''Reilly', " . "N'SCHEMA', 'dbo', N'TABLE', 'mytable', N'COLUMN', comment_with_string_literal_char", ], - $this->platform->getCreateTableSQL($table) + $this->platform->getCreateTableSQL($table), ); } @@ -774,7 +772,7 @@ public function testGeneratesAlterTableSQLWithColumnComments(): void $table->addColumn( '`comment_quoted`', 'integer', - ['comment' => 'Doctrine 0wnz comments for explicitly quoted columns!'] + ['comment' => 'Doctrine 0wnz comments for explicitly quoted columns!'], ); $table->addColumn('create', 'integer', ['comment' => 'Doctrine 0wnz comments for reserved keyword columns!']); $table->addColumn('commented_type', 'json'); @@ -823,7 +821,7 @@ public function testGeneratesAlterTableSQLWithColumnComments(): void 'id', new Column('id', Type::getType('integer'), ['autoincrement' => true, 'comment' => 'primary']), ['comment'], - new Column('id', Type::getType('integer'), ['autoincrement' => true]) + new Column('id', Type::getType('integer'), ['autoincrement' => true]), ); // Change type to custom type from empty string commented column. @@ -831,7 +829,7 @@ public function testGeneratesAlterTableSQLWithColumnComments(): void 'comment_empty_string', new Column('comment_empty_string', Type::getType('json')), ['type'], - new Column('comment_empty_string', Type::getType('integer'), ['comment' => '']) + new Column('comment_empty_string', Type::getType('integer'), ['comment' => '']), ); // Change comment to empty comment from zero-string commented column. @@ -839,7 +837,7 @@ public function testGeneratesAlterTableSQLWithColumnComments(): void 'comment_string_0', new Column('comment_string_0', Type::getType('integer'), ['comment' => '']), ['comment'], - new Column('comment_string_0', Type::getType('integer'), ['comment' => '0']) + new Column('comment_string_0', Type::getType('integer'), ['comment' => '0']), ); // Remove comment from regular commented column. @@ -847,7 +845,7 @@ public function testGeneratesAlterTableSQLWithColumnComments(): void 'comment', new Column('comment', Type::getType('integer')), ['comment'], - new Column('comment', Type::getType('integer'), ['comment' => 'Doctrine 0wnz you!']) + new Column('comment', Type::getType('integer'), ['comment' => 'Doctrine 0wnz you!']), ); // Change comment and change type to custom type from regular commented column. @@ -855,7 +853,7 @@ public function testGeneratesAlterTableSQLWithColumnComments(): void '`comment_quoted`', new Column('`comment_quoted`', Type::getType('json'), ['comment' => 'Doctrine JSON.']), ['comment', 'type'], - new Column('`comment_quoted`', Type::getType('integer'), ['comment' => 'Doctrine 0wnz you!']) + new Column('`comment_quoted`', Type::getType('integer'), ['comment' => 'Doctrine 0wnz you!']), ); // Remove comment and change type to custom type from regular commented column. @@ -866,8 +864,8 @@ public function testGeneratesAlterTableSQLWithColumnComments(): void new Column( 'create', Type::getType('integer'), - ['comment' => 'Doctrine 0wnz comments for reserved keyword columns!'] - ) + ['comment' => 'Doctrine 0wnz comments for reserved keyword columns!'], + ), ); // Add comment and change custom type to regular type from non-commented column. @@ -875,7 +873,7 @@ public function testGeneratesAlterTableSQLWithColumnComments(): void 'commented_type', new Column('commented_type', Type::getType('integer'), ['comment' => 'foo']), ['comment', 'type'], - new Column('commented_type', Type::getType('json')) + new Column('commented_type', Type::getType('json')), ); // Remove comment from commented custom type column. @@ -883,7 +881,7 @@ public function testGeneratesAlterTableSQLWithColumnComments(): void 'commented_type_with_comment', new Column('commented_type_with_comment', Type::getType('json')), ['comment'], - new Column('commented_type_with_comment', Type::getType('json'), ['comment' => 'Doctrine JSON type.']) + new Column('commented_type_with_comment', Type::getType('json'), ['comment' => 'Doctrine JSON type.']), ); // Change comment from comment with string literal char column. @@ -891,7 +889,7 @@ public function testGeneratesAlterTableSQLWithColumnComments(): void 'comment_with_string_literal_char', new Column('comment_with_string_literal_char', Type::getType('string'), ['comment' => "'"]), ['comment'], - new Column('comment_with_string_literal_char', Type::getType('json'), ['comment' => "O'Reilly"]) + new Column('comment_with_string_literal_char', Type::getType('json'), ['comment' => "O'Reilly"]), ); self::assertEquals( @@ -935,7 +933,7 @@ public function testGeneratesAlterTableSQLWithColumnComments(): void "EXEC sp_updateextendedproperty N'MS_Description', N'''', " . "N'SCHEMA', 'dbo', N'TABLE', 'mytable', N'COLUMN', comment_with_string_literal_char", ], - $this->platform->getAlterTableSQL($tableDiff) + $this->platform->getAlterTableSQL($tableDiff), ); } @@ -1079,7 +1077,7 @@ public function testChangeColumnsTypeWithDefaultValue(): void 'col_int', new Column('col_int', Type::getType('integer'), ['default' => 666]), ['type'], - new Column('col_int', Type::getType('smallint'), ['default' => 666]) + new Column('col_int', Type::getType('smallint'), ['default' => 666]), ); $tableDiff->changedColumns['col_string'] = new ColumnDiff( @@ -1090,7 +1088,7 @@ public function testChangeColumnsTypeWithDefaultValue(): void 'default' => 'foo', ]), ['fixed'], - new Column('col_string', Type::getType('string'), ['default' => 'foo']) + new Column('col_string', Type::getType('string'), ['default' => 'foo']), ); self::assertSame( @@ -1102,7 +1100,7 @@ public function testChangeColumnsTypeWithDefaultValue(): void 'ALTER TABLE column_def_change_type ALTER COLUMN col_string NCHAR(255) NOT NULL', "ALTER TABLE column_def_change_type ADD CONSTRAINT DF_829302E0_2725A6D0 DEFAULT 'foo' FOR col_string", ], - $this->platform->getAlterTableSQL($tableDiff) + $this->platform->getAlterTableSQL($tableDiff), ); } @@ -1161,9 +1159,7 @@ public function testGeneratesIdentifierNamesInCreateTableSQL(Table $table, array self::assertSame($expectedSql, $this->platform->getCreateTableSQL($table)); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function getGeneratesIdentifierNamesInCreateTableSQL(): iterable { return [ @@ -1232,9 +1228,7 @@ public function testGeneratesIdentifierNamesInAlterTableSQL(TableDiff $tableDiff self::assertSame($expectedSql, $this->platform->getAlterTableSQL($tableDiff)); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function getGeneratesIdentifierNamesInAlterTableSQL(): iterable { return [ @@ -1259,7 +1253,7 @@ public static function getGeneratesIdentifierNamesInAlterTableSQL(): iterable new Column('mycolumn', Type::getType('string'), [ 'length' => 255, 'default' => 'foo', - ]) + ]), ), ], [ @@ -1267,7 +1261,7 @@ public static function getGeneratesIdentifierNamesInAlterTableSQL(): iterable 'length' => 255, 'default' => 'foo', ]), - ] + ], ), [ 'ALTER TABLE mytable ADD addcolumn NVARCHAR(255) NOT NULL ' . @@ -1299,7 +1293,7 @@ public static function getGeneratesIdentifierNamesInAlterTableSQL(): iterable new Column('`mycolumn`', Type::getType('string'), [ 'length' => 255, 'default' => 'foo', - ]) + ]), ), ], [ @@ -1307,7 +1301,7 @@ public static function getGeneratesIdentifierNamesInAlterTableSQL(): iterable 'length' => 255, 'default' => 'foo', ]), - ] + ], ), [ 'ALTER TABLE [mytable] ADD [addcolumn] NVARCHAR(255) NOT NULL ' . @@ -1339,7 +1333,7 @@ public static function getGeneratesIdentifierNamesInAlterTableSQL(): iterable new Column('select', Type::getType('string'), [ 'length' => 255, 'default' => 'foo', - ]) + ]), ), ], [ @@ -1347,7 +1341,7 @@ public static function getGeneratesIdentifierNamesInAlterTableSQL(): iterable 'length' => 255, 'default' => 'foo', ]), - ] + ], ), [ 'ALTER TABLE [table] ADD [add] NVARCHAR(255) NOT NULL ' . @@ -1379,7 +1373,7 @@ public static function getGeneratesIdentifierNamesInAlterTableSQL(): iterable new Column('`select`', Type::getType('string'), [ 'length' => 255, 'default' => 'foo', - ]) + ]), ), ], [ @@ -1387,7 +1381,7 @@ public static function getGeneratesIdentifierNamesInAlterTableSQL(): iterable 'length' => 255, 'default' => 'foo', ]), - ] + ], ), [ 'ALTER TABLE [table] ADD [add] NVARCHAR(255) NOT NULL ' . @@ -1509,7 +1503,7 @@ public function testModifyLimitQueryWithTopNSubQueryWithOrderBy(): void self::assertEquals( $expected, - $this->platform->modifyLimitQuery($query, 10) + $this->platform->modifyLimitQuery($query, 10), ); $query = 'SELECT * FROM test t WHERE t.id = (' @@ -1522,7 +1516,7 @@ public function testModifyLimitQueryWithTopNSubQueryWithOrderBy(): void self::assertEquals( $expected, - $this->platform->modifyLimitQuery($query, 10) + $this->platform->modifyLimitQuery($query, 10), ); } @@ -1538,7 +1532,7 @@ public function testModifyLimitQueryWithFromSubquery(): void self::assertEquals( $expected, - $this->platform->modifyLimitQuery($query, 10) + $this->platform->modifyLimitQuery($query, 10), ); } @@ -1554,7 +1548,7 @@ public function testModifyLimitQueryWithFromSubqueryAndOrder(): void self::assertEquals( $expected, - $this->platform->modifyLimitQuery($query, 10) + $this->platform->modifyLimitQuery($query, 10), ); } @@ -1584,7 +1578,7 @@ public function testGetDefaultValueDeclarationSQLForDateType(): void $this->platform->getDefaultValueDeclarationSQL([ 'type' => Type::getType($type), 'default' => $currentDateSql, - ]) + ]), ); } } @@ -1598,7 +1592,7 @@ public function testColumnCollationDeclarationSQL(): void { self::assertSame( 'COLLATE Latin1_General_CS_AS_KS_WS', - $this->platform->getColumnCollationDeclarationSQL('Latin1_General_CS_AS_KS_WS') + $this->platform->getColumnCollationDeclarationSQL('Latin1_General_CS_AS_KS_WS'), ); } @@ -1613,7 +1607,7 @@ public function testGetCreateTableSQLWithColumnCollation(): void ['CREATE TABLE foo (no_collation NVARCHAR(255) NOT NULL, ' . 'column_collation NVARCHAR(255) COLLATE Latin1_General_CS_AS_KS_WS NOT NULL)', ], - $this->platform->getCreateTableSQL($table) + $this->platform->getCreateTableSQL($table), ); } @@ -1627,19 +1621,19 @@ public function testGeneratesSequenceSqlCommands(): void $sequence = new Sequence('myseq', 20, 1); self::assertEquals( 'CREATE SEQUENCE myseq START WITH 1 INCREMENT BY 20 MINVALUE 1', - $this->platform->getCreateSequenceSQL($sequence) + $this->platform->getCreateSequenceSQL($sequence), ); self::assertEquals( 'ALTER SEQUENCE myseq INCREMENT BY 20', - $this->platform->getAlterSequenceSQL($sequence) + $this->platform->getAlterSequenceSQL($sequence), ); self::assertEquals( 'DROP SEQUENCE myseq', - $this->platform->getDropSequenceSQL('myseq') + $this->platform->getDropSequenceSQL('myseq'), ); self::assertEquals( 'SELECT NEXT VALUE FOR myseq', - $this->platform->getSequenceNextValSQL('myseq') + $this->platform->getSequenceNextValSQL('myseq'), ); } @@ -1650,7 +1644,7 @@ public function testAlterTableWithSchemaSameColumnComments(): void 'quota', new Column('quota', Type::getType('integer'), ['comment' => 'A comment', 'notnull' => true]), ['notnull'], - new Column('quota', Type::getType('integer'), ['comment' => 'A comment', 'notnull' => false]) + new Column('quota', Type::getType('integer'), ['comment' => 'A comment', 'notnull' => false]), ); $expectedSql = ['ALTER TABLE testschema.mytable ALTER COLUMN quota INT NOT NULL']; @@ -1658,9 +1652,7 @@ public function testAlterTableWithSchemaSameColumnComments(): void self::assertEquals($expectedSql, $this->platform->getAlterTableSQL($tableDiff)); } - /** - * @dataProvider getLockHints - */ + /** @dataProvider getLockHints */ public function testAppendsLockHint(LockMode $lockMode, string $lockHint): void { $fromClause = 'FROM users'; @@ -1669,9 +1661,7 @@ public function testAppendsLockHint(LockMode $lockMode, string $lockHint): void self::assertSame($expectedResult, $this->platform->appendLockHint($fromClause, $lockMode)); } - /** - * @return iterable - */ + /** @return iterable */ public static function getLockHints(): iterable { return [ diff --git a/tests/Platforms/SQLitePlatformTest.php b/tests/Platforms/SQLitePlatformTest.php index 9624a8a2540..d397ebb5aa1 100644 --- a/tests/Platforms/SQLitePlatformTest.php +++ b/tests/Platforms/SQLitePlatformTest.php @@ -15,9 +15,7 @@ use Doctrine\DBAL\TransactionIsolationLevel; use Doctrine\DBAL\Types\Type; -/** - * @extends AbstractPlatformTestCase - */ +/** @extends AbstractPlatformTestCase */ class SQLitePlatformTest extends AbstractPlatformTestCase { public function createPlatform(): AbstractPlatform @@ -57,19 +55,19 @@ public function testGeneratesTransactionCommands(): void { self::assertEquals( 'PRAGMA read_uncommitted = 0', - $this->platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::READ_UNCOMMITTED) + $this->platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::READ_UNCOMMITTED), ); self::assertEquals( 'PRAGMA read_uncommitted = 1', - $this->platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::READ_COMMITTED) + $this->platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::READ_COMMITTED), ); self::assertEquals( 'PRAGMA read_uncommitted = 1', - $this->platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::REPEATABLE_READ) + $this->platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::REPEATABLE_READ), ); self::assertEquals( 'PRAGMA read_uncommitted = 1', - $this->platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::SERIALIZABLE) + $this->platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::SERIALIZABLE), ); } @@ -77,7 +75,7 @@ public function testIgnoresUnsignedIntegerDeclarationForAutoIncrementalIntegers( { self::assertSame( 'INTEGER PRIMARY KEY AUTOINCREMENT', - $this->platform->getIntegerTypeDeclarationSQL(['autoincrement' => true, 'unsigned' => true]) + $this->platform->getIntegerTypeDeclarationSQL(['autoincrement' => true, 'unsigned' => true]), ); } @@ -85,25 +83,25 @@ public function testGeneratesTypeDeclarationForSmallIntegers(): void { self::assertEquals( 'SMALLINT', - $this->platform->getSmallIntTypeDeclarationSQL([]) + $this->platform->getSmallIntTypeDeclarationSQL([]), ); self::assertEquals( 'INTEGER PRIMARY KEY AUTOINCREMENT', - $this->platform->getSmallIntTypeDeclarationSQL(['autoincrement' => true]) + $this->platform->getSmallIntTypeDeclarationSQL(['autoincrement' => true]), ); self::assertEquals( 'INTEGER PRIMARY KEY AUTOINCREMENT', $this->platform->getSmallIntTypeDeclarationSQL( - ['autoincrement' => true, 'primary' => true] - ) + ['autoincrement' => true, 'primary' => true], + ), ); self::assertEquals( 'SMALLINT', - $this->platform->getSmallIntTypeDeclarationSQL(['unsigned' => false]) + $this->platform->getSmallIntTypeDeclarationSQL(['unsigned' => false]), ); self::assertEquals( 'SMALLINT UNSIGNED', - $this->platform->getSmallIntTypeDeclarationSQL(['unsigned' => true]) + $this->platform->getSmallIntTypeDeclarationSQL(['unsigned' => true]), ); } @@ -111,29 +109,29 @@ public function testGeneratesTypeDeclarationForIntegers(): void { self::assertEquals( 'INTEGER', - $this->platform->getIntegerTypeDeclarationSQL([]) + $this->platform->getIntegerTypeDeclarationSQL([]), ); self::assertEquals( 'INTEGER PRIMARY KEY AUTOINCREMENT', - $this->platform->getIntegerTypeDeclarationSQL(['autoincrement' => true]) + $this->platform->getIntegerTypeDeclarationSQL(['autoincrement' => true]), ); self::assertEquals( 'INTEGER PRIMARY KEY AUTOINCREMENT', - $this->platform->getIntegerTypeDeclarationSQL(['autoincrement' => true, 'unsigned' => true]) + $this->platform->getIntegerTypeDeclarationSQL(['autoincrement' => true, 'unsigned' => true]), ); self::assertEquals( 'INTEGER PRIMARY KEY AUTOINCREMENT', $this->platform->getIntegerTypeDeclarationSQL( - ['autoincrement' => true, 'primary' => true] - ) + ['autoincrement' => true, 'primary' => true], + ), ); self::assertEquals( 'INTEGER', - $this->platform->getIntegerTypeDeclarationSQL(['unsigned' => false]) + $this->platform->getIntegerTypeDeclarationSQL(['unsigned' => false]), ); self::assertEquals( 'INTEGER UNSIGNED', - $this->platform->getIntegerTypeDeclarationSQL(['unsigned' => true]) + $this->platform->getIntegerTypeDeclarationSQL(['unsigned' => true]), ); } @@ -141,29 +139,29 @@ public function testGeneratesTypeDeclarationForBigIntegers(): void { self::assertEquals( 'BIGINT', - $this->platform->getBigIntTypeDeclarationSQL([]) + $this->platform->getBigIntTypeDeclarationSQL([]), ); self::assertEquals( 'INTEGER PRIMARY KEY AUTOINCREMENT', - $this->platform->getBigIntTypeDeclarationSQL(['autoincrement' => true]) + $this->platform->getBigIntTypeDeclarationSQL(['autoincrement' => true]), ); self::assertEquals( 'INTEGER PRIMARY KEY AUTOINCREMENT', - $this->platform->getBigIntTypeDeclarationSQL(['autoincrement' => true, 'unsigned' => true]) + $this->platform->getBigIntTypeDeclarationSQL(['autoincrement' => true, 'unsigned' => true]), ); self::assertEquals( 'INTEGER PRIMARY KEY AUTOINCREMENT', $this->platform->getBigIntTypeDeclarationSQL( - ['autoincrement' => true, 'primary' => true] - ) + ['autoincrement' => true, 'primary' => true], + ), ); self::assertEquals( 'BIGINT', - $this->platform->getBigIntTypeDeclarationSQL(['unsigned' => false]) + $this->platform->getBigIntTypeDeclarationSQL(['unsigned' => false]), ); self::assertEquals( 'BIGINT UNSIGNED', - $this->platform->getBigIntTypeDeclarationSQL(['unsigned' => true]) + $this->platform->getBigIntTypeDeclarationSQL(['unsigned' => true]), ); } @@ -234,7 +232,7 @@ public function testGenerateTableSqlShouldNotAutoQuotePrimaryKey(): void $createTableSQL = $this->platform->getCreateTableSQL($table); self::assertEquals( 'CREATE TABLE test ("like" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL)', - $createTableSQL[0] + $createTableSQL[0], ); } @@ -256,9 +254,7 @@ public function testAlterTableAddColumns(): void self::assertEquals($expected, $this->platform->getAlterTableSQL($diff)); } - /** - * @dataProvider complexDiffProvider - */ + /** @dataProvider complexDiffProvider */ public function testAlterTableAddComplexColumns(TableDiff $diff): void { $this->expectException(Exception::class); @@ -279,9 +275,7 @@ public function testRenameNonExistingColumn(): void $this->platform->getAlterTableSQL($tableDiff); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function complexDiffProvider(): iterable { $date = new TableDiff('user'); @@ -520,7 +514,7 @@ public function testAlterTableRenameIndexInSchema(): void { self::markTestIncomplete( 'Test currently produces broken SQL due to SQLitePlatform::getAlterTable() being broken ' . - 'when used with schemas.' + 'when used with schemas.', ); } @@ -528,7 +522,7 @@ public function testQuotesAlterTableRenameIndexInSchema(): void { self::markTestIncomplete( 'Test currently produces broken SQL due to SQLitePlatform::getAlterTable() being broken ' . - 'when used with schemas.' + 'when used with schemas.', ); } @@ -662,7 +656,7 @@ public function testDateAddStaticNumberOfDays(): void { self::assertSame( "DATETIME(rentalBeginsOn,'+' || 12 || ' DAY')", - $this->platform->getDateAddDaysExpression('rentalBeginsOn', '12') + $this->platform->getDateAddDaysExpression('rentalBeginsOn', '12'), ); } @@ -670,7 +664,7 @@ public function testDateAddNumberOfDaysFromColumn(): void { self::assertSame( "DATETIME(rentalBeginsOn,'+' || duration || ' DAY')", - $this->platform->getDateAddDaysExpression('rentalBeginsOn', 'duration') + $this->platform->getDateAddDaysExpression('rentalBeginsOn', 'duration'), ); } @@ -683,7 +677,7 @@ public function testColumnCollationDeclarationSQL(): void { self::assertSame( 'COLLATE NOCASE', - $this->platform->getColumnCollationDeclarationSQL('NOCASE') + $this->platform->getColumnCollationDeclarationSQL('NOCASE'), ); } @@ -698,7 +692,7 @@ public function testGetCreateTableSQLWithColumnCollation(): void 'CREATE TABLE foo (no_collation VARCHAR(255) NOT NULL, ' . 'column_collation VARCHAR(255) NOT NULL COLLATE NOCASE)', ], - $this->platform->getCreateTableSQL($table) + $this->platform->getCreateTableSQL($table), ); } } diff --git a/tests/Portability/ConverterTest.php b/tests/Portability/ConverterTest.php index e2c39889d35..4192d8b725f 100644 --- a/tests/Portability/ConverterTest.php +++ b/tests/Portability/ConverterTest.php @@ -21,18 +21,16 @@ public function testConvertNumeric( array|false $row, bool $convertEmptyStringToNull, bool $rightTrimString, - array|false $expected + array|false $expected, ): void { self::assertSame( $expected, $this->createConverter($convertEmptyStringToNull, $rightTrimString, null) - ->convertNumeric($row) + ->convertNumeric($row), ); } - /** - * @return iterable> - */ + /** @return iterable> */ public static function convertNumericProvider(): iterable { $row = ['X ', '']; @@ -79,18 +77,16 @@ public function testConvertAssociative( bool $convertEmptyStringToNull, bool $rightTrimString, ?int $case, - array|false $expected + array|false $expected, ): void { self::assertSame( $expected, $this->createConverter($convertEmptyStringToNull, $rightTrimString, $case) - ->convertAssociative($row) + ->convertAssociative($row), ); } - /** - * @return iterable> - */ + /** @return iterable> */ public static function convertAssociativeProvider(): iterable { $row = [ @@ -189,25 +185,21 @@ public static function convertAssociativeProvider(): iterable yield 'False' => [false, true, true, null, false]; } - /** - * @dataProvider convertOneProvider - */ + /** @dataProvider convertOneProvider */ public function testConvertOne( mixed $value, bool $convertEmptyStringToNull, bool $rightTrimString, - mixed $expected + mixed $expected, ): void { self::assertSame( $expected, $this->createConverter($convertEmptyStringToNull, $rightTrimString, null) - ->convertOne($value) + ->convertOne($value), ); } - /** - * @return iterable> - */ + /** @return iterable> */ public static function convertOneProvider(): iterable { yield 'None, trailing space' => ['X ', false, false, 'X ']; @@ -232,18 +224,16 @@ public function testConvertAllNumeric( array $data, bool $convertEmptyStringToNull, bool $rightTrimString, - array $expected + array $expected, ): void { self::assertSame( $expected, $this->createConverter($convertEmptyStringToNull, $rightTrimString, null) - ->convertAllNumeric($data) + ->convertAllNumeric($data), ); } - /** - * @return iterable> - */ + /** @return iterable> */ public static function convertAllNumericProvider(): iterable { $data = [ @@ -301,18 +291,16 @@ public function testConvertAllAssociative( bool $convertEmptyStringToNull, bool $rightTrimString, ?int $case, - array $expected + array $expected, ): void { self::assertSame( $expected, $this->createConverter($convertEmptyStringToNull, $rightTrimString, $case) - ->convertAllAssociative($row) + ->convertAllAssociative($row), ); } - /** - * @return iterable> - */ + /** @return iterable> */ public static function convertAllAssociativeProvider(): iterable { $data = [ @@ -473,18 +461,16 @@ public function testConvertFirstColumn( array $column, bool $convertEmptyStringToNull, bool $rightTrimString, - array $expected + array $expected, ): void { self::assertSame( $expected, $this->createConverter($convertEmptyStringToNull, $rightTrimString, null) - ->convertFirstColumn($column) + ->convertFirstColumn($column), ); } - /** - * @return iterable> - */ + /** @return iterable> */ public static function convertFirstColumnProvider(): iterable { $column = ['X ', '']; diff --git a/tests/Portability/ResultTest.php b/tests/Portability/ResultTest.php index 0fdec58e25a..5458d0d49ad 100644 --- a/tests/Portability/ResultTest.php +++ b/tests/Portability/ResultTest.php @@ -11,9 +11,7 @@ class ResultTest extends TestCase { - /** - * @dataProvider fetchProvider - */ + /** @dataProvider fetchProvider */ public function testFetch(string $source, callable $fetch, mixed $return): void { $driverResult = $this->createMock(DriverResult::class); @@ -26,9 +24,7 @@ public function testFetch(string $source, callable $fetch, mixed $return): void self::assertSame($return, $fetch($result)); } - /** - * @return iterable> - */ + /** @return iterable> */ public static function fetchProvider(): iterable { yield 'numeric' => [ @@ -126,7 +122,7 @@ private function newResult(DriverResult $driverResult): Result { return new Result( $driverResult, - new Converter(false, false, null) + new Converter(false, false, null), ); } } diff --git a/tests/Query/Expression/CompositeExpressionTest.php b/tests/Query/Expression/CompositeExpressionTest.php index 326588b8951..31de4d495e3 100644 --- a/tests/Query/Expression/CompositeExpressionTest.php +++ b/tests/Query/Expression/CompositeExpressionTest.php @@ -40,17 +40,13 @@ public function testWith(): void self::assertCount(3, $expr); } - /** - * @dataProvider provideDataForConvertToString - */ + /** @dataProvider provideDataForConvertToString */ public function testCompositeUsageAndGeneration(CompositeExpression $expr, string $expects): void { self::assertEquals($expects, (string) $expr); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function provideDataForConvertToString(): iterable { return [ @@ -75,8 +71,8 @@ public static function provideDataForConvertToString(): iterable 'u.user = 1', CompositeExpression::or( 'u.group_id = 1', - 'u.group_id = 2' - ) + 'u.group_id = 2', + ), ), '(u.user = 1) AND ((u.group_id = 1) OR (u.group_id = 2))', ], @@ -85,8 +81,8 @@ public static function provideDataForConvertToString(): iterable 'u.group_id = 1', CompositeExpression::and( 'u.user = 1', - 'u.group_id = 2' - ) + 'u.group_id = 2', + ), ), '(u.group_id = 1) OR ((u.user = 1) AND (u.group_id = 2))', ], diff --git a/tests/Query/Expression/ExpressionBuilderTest.php b/tests/Query/Expression/ExpressionBuilderTest.php index 8c289c2f760..738e6ec5e6e 100644 --- a/tests/Query/Expression/ExpressionBuilderTest.php +++ b/tests/Query/Expression/ExpressionBuilderTest.php @@ -36,9 +36,7 @@ public function testAnd(array $parts, string $expected): void self::assertEquals($expected, (string) $composite); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function provideDataForAnd(): iterable { return [ @@ -63,7 +61,7 @@ public static function provideDataForAnd(): iterable 'u.user = 1', CompositeExpression::or( 'u.group_id = 1', - 'u.group_id = 2' + 'u.group_id = 2', ), ], '(u.user = 1) AND ((u.group_id = 1) OR (u.group_id = 2))', @@ -73,7 +71,7 @@ public static function provideDataForAnd(): iterable 'u.group_id = 1', CompositeExpression::and( 'u.user = 1', - 'u.group_id = 2' + 'u.group_id = 2', ), ], '(u.group_id = 1) AND ((u.user = 1) AND (u.group_id = 2))', @@ -93,9 +91,7 @@ public function testOr(array $parts, string $expected): void self::assertEquals($expected, (string) $composite); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function provideDataForOr(): iterable { return [ @@ -120,7 +116,7 @@ public static function provideDataForOr(): iterable 'u.user = 1', CompositeExpression::or( 'u.group_id = 1', - 'u.group_id = 2' + 'u.group_id = 2', ), ], '(u.user = 1) OR ((u.group_id = 1) OR (u.group_id = 2))', @@ -130,7 +126,7 @@ public static function provideDataForOr(): iterable 'u.group_id = 1', CompositeExpression::and( 'u.user = 1', - 'u.group_id = 2' + 'u.group_id = 2', ), ], '(u.group_id = 1) OR ((u.user = 1) AND (u.group_id = 2))', @@ -138,9 +134,7 @@ public static function provideDataForOr(): iterable ]; } - /** - * @dataProvider provideDataForComparison - */ + /** @dataProvider provideDataForComparison */ public function testComparison(string $leftExpr, string $operator, string $rightExpr, string $expected): void { $part = $this->expr->comparison($leftExpr, $operator, $rightExpr); @@ -148,9 +142,7 @@ public function testComparison(string $leftExpr, string $operator, string $right self::assertEquals($expected, $part); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function provideDataForComparison(): iterable { return [ @@ -232,7 +224,7 @@ public function testLikeWithEscape(): void { self::assertEquals( "a.song LIKE 'a virgin' ESCAPE '💩'", - $this->expr->like('a.song', "'a virgin'", "'💩'") + $this->expr->like('a.song', "'a virgin'", "'💩'"), ); } @@ -240,7 +232,7 @@ public function testNotLikeWithoutEscape(): void { self::assertEquals( "s.last_words NOT LIKE 'this'", - $this->expr->notLike('s.last_words', "'this'") + $this->expr->notLike('s.last_words', "'this'"), ); } @@ -248,7 +240,7 @@ public function testNotLikeWithEscape(): void { self::assertEquals( "p.description NOT LIKE '20💩%' ESCAPE '💩'", - $this->expr->notLike('p.description', "'20💩%'", "'💩'") + $this->expr->notLike('p.description', "'20💩%'", "'💩'"), ); } } diff --git a/tests/Query/QueryBuilderTest.php b/tests/Query/QueryBuilderTest.php index 9776fa665ad..002d3bda99f 100644 --- a/tests/Query/QueryBuilderTest.php +++ b/tests/Query/QueryBuilderTest.php @@ -183,7 +183,7 @@ public function testSelectWithAndOrWhereConditions(): void self::assertEquals( 'SELECT u.*, p.* FROM users u' . ' WHERE (((u.username = ?) AND (u.username = ?)) OR (u.name = ?)) AND (u.name = ?)', - (string) $qb + (string) $qb, ); } @@ -258,7 +258,7 @@ public function testSelectHavingAndHaving(): void self::assertEquals( 'SELECT u.*, p.* FROM users u GROUP BY u.id HAVING (u.name = ?) AND (u.username = ?)', - (string) $qb + (string) $qb, ); } @@ -274,7 +274,7 @@ public function testSelectHavingOrHaving(): void self::assertEquals( 'SELECT u.*, p.* FROM users u GROUP BY u.id HAVING (u.name = ?) OR (u.username = ?)', - (string) $qb + (string) $qb, ); } @@ -290,7 +290,7 @@ public function testSelectOrHavingOrHaving(): void self::assertEquals( 'SELECT u.*, p.* FROM users u GROUP BY u.id HAVING (u.name = ?) OR (u.username = ?)', - (string) $qb + (string) $qb, ); } @@ -307,7 +307,7 @@ public function testSelectHavingAndOrHaving(): void self::assertEquals( 'SELECT u.*, p.* FROM users u GROUP BY u.id HAVING ((u.name = ?) OR (u.username = ?)) AND (u.username = ?)', - (string) $qb + (string) $qb, ); } @@ -425,7 +425,7 @@ public function testInsertValues(): void [ 'foo' => '?', 'bar' => '?', - ] + ], ); self::assertEquals('INSERT INTO users (foo, bar) VALUES(?, ?)', (string) $qb); @@ -439,13 +439,13 @@ public function testInsertReplaceValues(): void [ 'foo' => '?', 'bar' => '?', - ] + ], ) ->values( [ 'bar' => '?', 'foo' => '?', - ] + ], ); self::assertEquals('INSERT INTO users (bar, foo) VALUES(?, ?)', (string) $qb); @@ -467,7 +467,7 @@ public function testInsertValuesSetValue(): void $qb = new QueryBuilder($this->conn); $qb->insert('users') ->values( - ['foo' => '?'] + ['foo' => '?'], ) ->setValue('bar', '?'); @@ -480,9 +480,7 @@ public function testGetConnection(): void self::assertSame($this->conn, $qb->getConnection()); } - /** - * @dataProvider maxResultsProvider - */ + /** @dataProvider maxResultsProvider */ public function testSetMaxResults(?int $maxResults): void { $qb = new QueryBuilder($this->conn); @@ -491,9 +489,7 @@ public function testSetMaxResults(?int $maxResults): void self::assertEquals($maxResults, $qb->getMaxResults()); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function maxResultsProvider(): iterable { return [ @@ -515,7 +511,7 @@ public function testCreateNamedParameter(): void $qb = new QueryBuilder($this->conn); $qb->select('u.*')->from('users', 'u')->where( - $qb->expr()->eq('u.name', $qb->createNamedParameter(10, ParameterType::INTEGER)) + $qb->expr()->eq('u.name', $qb->createNamedParameter(10, ParameterType::INTEGER)), ); self::assertEquals('SELECT u.* FROM users u WHERE u.name = :dcValue1', (string) $qb); @@ -528,7 +524,7 @@ public function testCreateNamedParameterCustomPlaceholder(): void $qb = new QueryBuilder($this->conn); $qb->select('u.*')->from('users', 'u')->where( - $qb->expr()->eq('u.name', $qb->createNamedParameter(10, ParameterType::INTEGER, ':test')) + $qb->expr()->eq('u.name', $qb->createNamedParameter(10, ParameterType::INTEGER, ':test')), ); self::assertEquals('SELECT u.* FROM users u WHERE u.name = :test', (string) $qb); @@ -541,7 +537,7 @@ public function testCreatePositionalParameter(): void $qb = new QueryBuilder($this->conn); $qb->select('u.*')->from('users', 'u')->where( - $qb->expr()->eq('u.name', $qb->createPositionalParameter(10, ParameterType::INTEGER)) + $qb->expr()->eq('u.name', $qb->createPositionalParameter(10, ParameterType::INTEGER)), ); self::assertEquals('SELECT u.* FROM users u WHERE u.name = ?', (string) $qb); @@ -563,7 +559,7 @@ public function testReferenceJoinFromJoin(): void $this->expectException(QueryException::class); $this->expectExceptionMessage( 'The given alias "invalid" is not part of any FROM or JOIN clause table. ' - . 'The currently registered aliases are: news, nv.' + . 'The currently registered aliases are: news, nv.', ); self::assertEquals('', $qb->getSQL()); } @@ -585,7 +581,7 @@ public function testSelectFromMasterWithWhereOnJoinedTables(): void . " INNER JOIN nodeversion nv ON nv.refId = news.id AND nv.refEntityname='Entity\\News'" . ' INNER JOIN nodetranslation nt ON nv.nodetranslation = nt.id' . ' INNER JOIN node n ON nt.node = n.id WHERE (nt.lang = ?) AND (n.deleted = 0)', - $qb->getSQL() + $qb->getSQL(), ); } @@ -606,7 +602,7 @@ public function testSelectWithMultipleFromAndJoins(): void . ' INNER JOIN permissions p ON p.user_id = u.id, articles a' . ' INNER JOIN comments c ON c.article_id = a.id' . ' WHERE (u.id = a.user_id) AND (p.read = 1)', - $qb->getSQL() + $qb->getSQL(), ); } @@ -628,7 +624,7 @@ public function testSelectWithJoinsWithMultipleOnConditionsParseOrder(): void 'INNER JOIN table_d d ON a.fk_d = d.id ' . 'INNER JOIN table_c c ON c.fk_b = b.id AND b.language = ? ' . 'INNER JOIN table_e e ON e.fk_c = c.id AND e.fk_d = d.id', - (string) $qb + (string) $qb, ); } @@ -654,7 +650,7 @@ public function testSelectWithMultipleFromsAndJoinsWithMultipleOnConditionsParse 'INNER JOIN table_e e ON e.fk_c = c.id AND e.fk_d = d.id, ' . 'table_f f ' . 'INNER JOIN table_g g ON f.fk_g = g.id', - (string) $qb + (string) $qb, ); } @@ -725,7 +721,7 @@ public function testComplexSelectWithoutTableAliases(): void . ' INNER JOIN permissions p ON p.user_id = users.id, articles' . ' INNER JOIN comments c ON c.article_id = articles.id' . ' WHERE (users.id = articles.user_id) AND (p.read = 1)', - $qb->getSQL() + $qb->getSQL(), ); } @@ -743,7 +739,7 @@ public function testComplexSelectWithSomeTableAliases(): void 'SELECT u.id FROM users u' . ' INNER JOIN permissions p ON p.user_id = u.id, articles' . ' INNER JOIN comments c ON c.article_id = articles.id', - $qb->getSQL() + $qb->getSQL(), ); } @@ -819,7 +815,7 @@ public function testJoinWithNonUniqueAliasThrowsException(): void $this->expectException(QueryException::class); $this->expectExceptionMessage( - 'The given alias "a" is not unique in FROM and JOIN clause table. The currently registered aliases are: a.' + 'The given alias "a" is not unique in FROM and JOIN clause table. The currently registered aliases are: a.', ); $qb->getSQL(); @@ -837,7 +833,7 @@ public function testFetchAssociative( string $where, array $parameters, array $parameterTypes, - string $expectedSql + string $expectedSql, ): void { $qb = new QueryBuilder($this->conn); $mockedResult = $this->createMock(Result::class); @@ -872,7 +868,7 @@ public function testFetchNumeric( string $where, array $parameters, array $parameterTypes, - string $expectedSql + string $expectedSql, ): void { $qb = new QueryBuilder($this->conn); $mockedResult = $this->createMock(Result::class); @@ -907,7 +903,7 @@ public function testFetchOne( string $where, array $parameters, array $parameterTypes, - string $expectedSql + string $expectedSql, ): void { $qb = new QueryBuilder($this->conn); $mockedResult = $this->createMock(Result::class); @@ -942,7 +938,7 @@ public function testFetchAllAssociative( string $where, array $parameters, array $parameterTypes, - string $expectedSql + string $expectedSql, ): void { $qb = new QueryBuilder($this->conn); $mockedResult = $this->createMock(Result::class); @@ -958,7 +954,7 @@ public function testFetchAllAssociative( [ ['username' => 'jwage', 'password' => 'changeme'], ['username' => 'support', 'password' => 'p@ssword'], - ] + ], ); $results = $qb->select($select) @@ -972,7 +968,7 @@ public function testFetchAllAssociative( ['username' => 'jwage', 'password' => 'changeme'], ['username' => 'support', 'password' => 'p@ssword'], ], - $results + $results, ); } @@ -988,7 +984,7 @@ public function testFetchAllNumeric( string $where, array $parameters, array $parameterTypes, - string $expectedSql + string $expectedSql, ): void { $qb = new QueryBuilder($this->conn); $mockedResult = $this->createMock(Result::class); @@ -1004,7 +1000,7 @@ public function testFetchAllNumeric( [ ['jwage', 'changeme'], ['support', 'p@ssword'], - ] + ], ); $results = $qb->select($select) @@ -1018,7 +1014,7 @@ public function testFetchAllNumeric( ['jwage', 'changeme'], ['support', 'p@ssword'], ], - $results + $results, ); } @@ -1034,7 +1030,7 @@ public function testFetchAllKeyValue( string $where, array $parameters, array $parameterTypes, - string $expectedSql + string $expectedSql, ): void { $qb = new QueryBuilder($this->conn); $mockedResult = $this->createMock(Result::class); @@ -1050,7 +1046,7 @@ public function testFetchAllKeyValue( [ 'jwage' => 'changeme', 'support' => 'p@ssw0rd', - ] + ], ); $results = $qb->select($select) @@ -1064,7 +1060,7 @@ public function testFetchAllKeyValue( 'jwage' => 'changeme', 'support' => 'p@ssw0rd', ], - $results + $results, ); } @@ -1080,7 +1076,7 @@ public function testFetchAllAssociativeIndexed( string $where, array $parameters, array $parameterTypes, - string $expectedSql + string $expectedSql, ): void { $qb = new QueryBuilder($this->conn); $mockedResult = $this->createMock(Result::class); @@ -1098,7 +1094,7 @@ public function testFetchAllAssociativeIndexed( 'username' => 'jwage', 'password' => 'changeme', ], - ] + ], ); $results = $qb->select($select) @@ -1114,7 +1110,7 @@ public function testFetchAllAssociativeIndexed( 'password' => 'changeme', ], ], - $results + $results, ); } @@ -1130,7 +1126,7 @@ public function testFetchFirstColumn( string $where, array $parameters, array $parameterTypes, - string $expectedSql + string $expectedSql, ): void { $qb = new QueryBuilder($this->conn); $mockedResult = $this->createMock(Result::class); @@ -1146,7 +1142,7 @@ public function testFetchFirstColumn( [ 'jwage', 'support', - ] + ], ); $results = $qb->select($select) @@ -1160,7 +1156,7 @@ public function testFetchFirstColumn( 'jwage', 'support', ], - $results + $results, ); } @@ -1227,7 +1223,7 @@ public function testExecuteQuery( string $where, array $params, array $types, - string $expectedSql + string $expectedSql, ): void { $qb = new QueryBuilder($this->conn); $mockedResult = $this->createMock(Result::class); @@ -1245,7 +1241,7 @@ public function testExecuteQuery( self::assertSame( $mockedResult, - $results + $results, ); } @@ -1261,7 +1257,7 @@ public function testExecuteQueryWithResultCaching( string $where, array $parameters, array $parameterTypes, - string $expectedSql + string $expectedSql, ): void { $qb = new QueryBuilder($this->conn); $qcp = new QueryCacheProfile(300); @@ -1281,7 +1277,7 @@ public function testExecuteQueryWithResultCaching( self::assertSame( $mockedResult, - $results + $results, ); } @@ -1315,7 +1311,7 @@ public function testExecuteStatement(): void self::assertSame( $mockedResult, - $results + $results, ); } } diff --git a/tests/SQL/ParserTest.php b/tests/SQL/ParserTest.php index 660c42742b7..2aaea2b54c6 100644 --- a/tests/SQL/ParserTest.php +++ b/tests/SQL/ParserTest.php @@ -17,9 +17,7 @@ class ParserTest extends TestCase implements Visitor /** @var list */ private array $result = []; - /** - * @dataProvider statementsWithParametersProvider - */ + /** @dataProvider statementsWithParametersProvider */ public function testStatementsWithParameters(bool $mySQLStringEscaping, string $sql, string $expected): void { $parser = new Parser($mySQLStringEscaping); @@ -28,9 +26,7 @@ public function testStatementsWithParameters(bool $mySQLStringEscaping, string $ $this->assertParsed($expected); } - /** - * @return iterable> - */ + /** @return iterable> */ public static function statementsWithParametersProvider(): iterable { foreach (self::getModes() as $mode => $mySQLStringEscaping) { @@ -40,9 +36,7 @@ public static function statementsWithParametersProvider(): iterable } } - /** - * @return iterable> - */ + /** @return iterable> */ private static function getStatementsWithParameters(): iterable { yield [ @@ -310,9 +304,7 @@ private static function getStatementsWithParameters(): iterable ]; } - /** - * @dataProvider statementsWithoutParametersProvider - */ + /** @dataProvider statementsWithoutParametersProvider */ public function testStatementsWithoutParameters(bool $mySQLStringEscaping, string $sql): void { $parser = new Parser($mySQLStringEscaping); @@ -321,9 +313,7 @@ public function testStatementsWithoutParameters(bool $mySQLStringEscaping, strin $this->assertParsed($sql); } - /** - * @return iterable> - */ + /** @return iterable> */ public static function statementsWithoutParametersProvider(): iterable { foreach (self::getModes() as $mode => $mySQLStringEscaping) { @@ -333,9 +323,7 @@ public static function statementsWithoutParametersProvider(): iterable } } - /** - * @return iterable - */ + /** @return iterable */ private static function getStatementsWithoutParameters(): iterable { yield 'SELECT * FROM Foo'; @@ -350,9 +338,7 @@ private static function getStatementsWithoutParameters(): iterable yield 'SELECT @rank := 1'; } - /** - * @dataProvider ansiParametersProvider - */ + /** @dataProvider ansiParametersProvider */ public function testAnsiEscaping(string $sql, string $expected): void { $parser = new Parser(false); @@ -361,9 +347,7 @@ public function testAnsiEscaping(string $sql, string $expected): void $this->assertParsed($expected); } - /** - * @return iterable> - */ + /** @return iterable> */ public static function ansiParametersProvider(): iterable { yield 'Quotes inside literals escaped by doubling' => [ @@ -395,9 +379,7 @@ public static function ansiParametersProvider(): iterable ]; } - /** - * @dataProvider mySQLParametersProvider - */ + /** @dataProvider mySQLParametersProvider */ public function testMySQLEscaping(string $sql, string $expected): void { $parser = new Parser(true); @@ -406,9 +388,7 @@ public function testMySQLEscaping(string $sql, string $expected): void $this->assertParsed($expected); } - /** - * @return iterable> - */ + /** @return iterable> */ public static function mySQLParametersProvider(): iterable { yield 'Quotes inside literals escaped by backslash' => [ @@ -459,9 +439,7 @@ public function acceptOther(string $sql): void $this->result[] = $sql; } - /** - * @return iterable - */ + /** @return iterable */ private static function getModes(): iterable { yield 'ANSI' => false; diff --git a/tests/Schema/ColumnTest.php b/tests/Schema/ColumnTest.php index 16f3d49ae24..1dab36ebdf9 100644 --- a/tests/Schema/ColumnTest.php +++ b/tests/Schema/ColumnTest.php @@ -115,9 +115,7 @@ public function testQuotedColumnName(): void self::assertEquals('[bar]', $column->getQuotedName($sqlServerPlatform)); } - /** - * @dataProvider getIsQuoted - */ + /** @dataProvider getIsQuoted */ public function testIsQuoted(string $columnName, bool $isQuoted): void { $type = Type::getType('string'); @@ -126,9 +124,7 @@ public function testIsQuoted(string $columnName, bool $isQuoted): void self::assertSame($isQuoted, $column->isQuoted()); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function getIsQuoted(): iterable { return [ diff --git a/tests/Schema/ComparatorTest.php b/tests/Schema/ComparatorTest.php index e22378db88d..1beee8e4c15 100644 --- a/tests/Schema/ComparatorTest.php +++ b/tests/Schema/ComparatorTest.php @@ -31,7 +31,7 @@ public function testCompareSame1(): void 'bugdb', [ 'integercolumn1' => new Column('integercolumn1', Type::getType('integer')), - ] + ], ), ]); $schema2 = new Schema([ @@ -39,7 +39,7 @@ public function testCompareSame1(): void 'bugdb', [ 'integercolumn1' => new Column('integercolumn1', Type::getType('integer')), - ] + ], ), ]); @@ -56,7 +56,7 @@ public function testCompareSame2(): void [ 'integercolumn1' => new Column('integercolumn1', Type::getType('integer')), 'integercolumn2' => new Column('integercolumn2', Type::getType('integer')), - ] + ], ), ]); $schema2 = new Schema([ @@ -65,7 +65,7 @@ public function testCompareSame2(): void [ 'integercolumn2' => new Column('integercolumn2', Type::getType('integer')), 'integercolumn1' => new Column('integercolumn1', Type::getType('integer')), - ] + ], ), ]); @@ -123,7 +123,7 @@ public function testCompareMissingField(): void [ 'integercolumn1' => $missingColumn, 'integercolumn2' => new Column('integercolumn2', Type::getType('integer')), - ] + ], ), ]); $schema2 = new Schema([ @@ -131,7 +131,7 @@ public function testCompareMissingField(): void 'bugdb', [ 'integercolumn2' => new Column('integercolumn2', Type::getType('integer')), - ] + ], ), ]); @@ -142,9 +142,9 @@ public function testCompareMissingField(): void 'bugdb', [], [], - ['integercolumn1' => $missingColumn] + ['integercolumn1' => $missingColumn], ), - ] + ], ); $expected->fromSchema = $schema1; $expected->changedTables['bugdb']->fromTable = $schema1->getTable('bugdb'); @@ -159,7 +159,7 @@ public function testCompareNewField(): void 'bugdb', [ 'integercolumn1' => new Column('integercolumn1', Type::getType('integer')), - ] + ], ), ]); $schema2 = new Schema([ @@ -168,7 +168,7 @@ public function testCompareNewField(): void [ 'integercolumn1' => new Column('integercolumn1', Type::getType('integer')), 'integercolumn2' => new Column('integercolumn2', Type::getType('integer')), - ] + ], ), ]); @@ -179,9 +179,9 @@ public function testCompareNewField(): void 'bugdb', [ 'integercolumn2' => new Column('integercolumn2', Type::getType('integer')), - ] + ], ), - ] + ], ); $expected->fromSchema = $schema1; $expected->changedTables['bugdb']->fromTable = $schema1->getTable('bugdb'); @@ -259,9 +259,9 @@ public function testCompareRemovedIndex(): void 'primary' => new Index( 'primary', ['integercolumn1'], - true + true, ), - ] + ], ), ]); $schema2 = new Schema([ @@ -270,7 +270,7 @@ public function testCompareRemovedIndex(): void [ 'integercolumn1' => new Column('integercolumn1', Type::getType('integer')), 'integercolumn2' => new Column('integercolumn2', Type::getType('integer')), - ] + ], ), ]); @@ -288,11 +288,11 @@ public function testCompareRemovedIndex(): void 'primary' => new Index( 'primary', ['integercolumn1'], - true + true, ), - ] + ], ), - ] + ], ); $expected->fromSchema = $schema1; $expected->changedTables['bugdb']->fromTable = $schema1->getTable('bugdb'); @@ -308,7 +308,7 @@ public function testCompareNewIndex(): void [ 'integercolumn1' => new Column('integercolumn1', Type::getType('integer')), 'integercolumn2' => new Column('integercolumn2', Type::getType('integer')), - ] + ], ), ]); $schema2 = new Schema([ @@ -322,9 +322,9 @@ public function testCompareNewIndex(): void 'primary' => new Index( 'primary', ['integercolumn1'], - true + true, ), - ] + ], ), ]); @@ -340,11 +340,11 @@ public function testCompareNewIndex(): void 'primary' => new Index( 'primary', ['integercolumn1'], - true + true, ), - ] + ], ), - ] + ], ); $expected->fromSchema = $schema1; $expected->changedTables['bugdb']->fromTable = $schema1->getTable('bugdb'); @@ -365,9 +365,9 @@ public function testCompareChangedIndex(): void 'primary' => new Index( 'primary', ['integercolumn1'], - true + true, ), - ] + ], ), ]); $schema2 = new Schema([ @@ -381,9 +381,9 @@ public function testCompareChangedIndex(): void 'primary' => new Index( 'primary', ['integercolumn1', 'integercolumn2'], - true + true, ), - ] + ], ), ]); @@ -403,11 +403,11 @@ public function testCompareChangedIndex(): void 'integercolumn1', 'integercolumn2', ], - true + true, ), - ] + ], ), - ] + ], ); $expected->fromSchema = $schema1; $expected->changedTables['bugdb']->fromTable = $schema1->getTable('bugdb'); @@ -426,7 +426,7 @@ public function testCompareChangedIndexFieldPositions(): void ], [ 'primary' => new Index('primary', ['integercolumn1', 'integercolumn2'], true), - ] + ], ), ]); $schema2 = new Schema([ @@ -438,7 +438,7 @@ public function testCompareChangedIndexFieldPositions(): void ], [ 'primary' => new Index('primary', ['integercolumn2', 'integercolumn1'], true), - ] + ], ), ]); @@ -453,9 +453,9 @@ public function testCompareChangedIndexFieldPositions(): void [], [ 'primary' => new Index('primary', ['integercolumn2', 'integercolumn1'], true), - ] + ], ), - ] + ], ); $expected->fromSchema = $schema1; $expected->changedTables['bugdb']->fromTable = $schema1->getTable('bugdb'); @@ -643,7 +643,7 @@ public function testCompareIndexBasedOnPropertiesNotName(): void self::assertEquals( $tableDiff, - $this->comparator->diffTable($tableA, $tableB) + $this->comparator->diffTable($tableA, $tableB), ); } @@ -818,9 +818,7 @@ public function testChangedSequence(): void self::assertSame($diff->changedSequences[0], $schemaNew->getSequence('baz')); } - /** - * @psalm-suppress NullArgument - */ + /** @psalm-suppress NullArgument */ public function testDiffDecimalWithNullPrecision(): void { $column = new Column('foo', Type::getType('decimal')); @@ -1003,7 +1001,7 @@ public function testCompareChangedColumn(): void 'id', $table->getColumn('id'), ['type'], - $tableFoo->getColumn('id') + $tableFoo->getColumn('id'), ); self::assertEquals($expected, $this->comparator->compareSchemas($oldSchema, $newSchema)); @@ -1030,7 +1028,7 @@ public function testCompareChangedBinaryColumn(): void 'id', $table->getColumn('id'), ['length', 'fixed'], - $tableFoo->getColumn('id') + $tableFoo->getColumn('id'), ); self::assertEquals($expected, $this->comparator->compareSchemas($oldSchema, $newSchema)); @@ -1050,7 +1048,7 @@ public function assertSchemaTableChangeCount( SchemaDiff $diff, int $newTableCount = 0, int $changeTableCount = 0, - int $removeTableCount = 0 + int $removeTableCount = 0, ): void { self::assertCount($newTableCount, $diff->newTables); self::assertCount($changeTableCount, $diff->changedTables); @@ -1061,7 +1059,7 @@ public function assertSchemaSequenceChangeCount( SchemaDiff $diff, int $newSequenceCount = 0, int $changeSequenceCount = 0, - int $removeSequenceCount = 0 + int $removeSequenceCount = 0, ): void { self::assertCount($newSequenceCount, $diff->newSequences); self::assertCount($changeSequenceCount, $diff->changedSequences); @@ -1140,16 +1138,14 @@ public function testCompareGuidColumns(): void $column2 = new Column( 'foo', Type::getType('guid'), - ['notnull' => false, 'length' => 36, 'fixed' => true, 'default' => 'NEWID()', 'comment' => 'GUID 2.'] + ['notnull' => false, 'length' => 36, 'fixed' => true, 'default' => 'NEWID()', 'comment' => 'GUID 2.'], ); self::assertEquals(['notnull', 'default', 'comment'], $this->comparator->diffColumn($column1, $column2)); self::assertEquals(['notnull', 'default', 'comment'], $this->comparator->diffColumn($column2, $column1)); } - /** - * @dataProvider getCompareColumnComments - */ + /** @dataProvider getCompareColumnComments */ public function testCompareColumnComments(string $comment1, string $comment2, bool $equals): void { $column1 = new Column('foo', Type::getType('integer'), ['comment' => $comment1]); @@ -1166,9 +1162,7 @@ public function testCompareColumnComments(string $comment1, string $comment2, bo self::assertSame($expectedDiff, $actualDiff); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function getCompareColumnComments(): iterable { return [ @@ -1195,7 +1189,7 @@ public function testForeignKeyRemovalWithRenamedLocalColumn(): void 'table1', [ 'id' => new Column('id', Type::getType('integer')), - ] + ], ), 'table2' => new Table( 'table2', @@ -1207,7 +1201,7 @@ public function testForeignKeyRemovalWithRenamedLocalColumn(): void [], [ new ForeignKeyConstraint(['id_table1'], 'table1', ['id'], 'fk_table2_table1'), - ] + ], ), ]); $toSchema = new Schema([ @@ -1221,13 +1215,13 @@ public function testForeignKeyRemovalWithRenamedLocalColumn(): void [], [ new ForeignKeyConstraint(['id_table3'], 'table3', ['id'], 'fk_table2_table3'), - ] + ], ), 'table3' => new Table( 'table3', [ 'id' => new Column('id', Type::getType('integer')), - ] + ], ), ]); $actual = $this->comparator->compareSchemas($fromSchema, $toSchema); @@ -1249,11 +1243,11 @@ public function testWillNotProduceSchemaDiffOnTableWithAddedCustomSchemaDefiniti new Column( 'is_default', Type::getType('string'), - ['length' => 32] + ['length' => 32], ), - ] + ], ), - ] + ], ); $toSchema = new Schema( [ @@ -1264,15 +1258,15 @@ public function testWillNotProduceSchemaDiffOnTableWithAddedCustomSchemaDefiniti 'columnDefinition' => 'ENUM(\'default\')', 'length' => 32, ]), - ] + ], ), - ] + ], ); self::assertEmpty( $this->comparator->compareSchemas($fromSchema, $toSchema) ->changedTables, - 'Schema diff is empty, since only `columnDefinition` changed from `null` (not detected) to a defined one' + 'Schema diff is empty, since only `columnDefinition` changed from `null` (not detected) to a defined one', ); } diff --git a/tests/Schema/ForeignKeyConstraintTest.php b/tests/Schema/ForeignKeyConstraintTest.php index 65888d34bac..d867d7473db 100644 --- a/tests/Schema/ForeignKeyConstraintTest.php +++ b/tests/Schema/ForeignKeyConstraintTest.php @@ -29,9 +29,7 @@ public function testIntersectsIndexColumns(array $indexColumns, bool $expectedRe self::assertSame($expectedResult, $foreignKey->intersectsIndexColumns($index)); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function getIntersectsIndexColumnsData(): iterable { return [ @@ -58,21 +56,17 @@ public static function getIntersectsIndexColumnsData(): iterable ]; } - /** - * @dataProvider getUnqualifiedForeignTableNameData - */ + /** @dataProvider getUnqualifiedForeignTableNameData */ public function testGetUnqualifiedForeignTableName( string $foreignTableName, - string $expectedUnqualifiedTableName + string $expectedUnqualifiedTableName, ): void { $foreignKey = new ForeignKeyConstraint(['foo', 'bar'], $foreignTableName, ['fk_foo', 'fk_bar']); self::assertSame($expectedUnqualifiedTableName, $foreignKey->getUnqualifiedForeignTableName()); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function getUnqualifiedForeignTableNameData(): iterable { return [ diff --git a/tests/Schema/IndexTest.php b/tests/Schema/IndexTest.php index bfeaf726836..44c70d182bb 100644 --- a/tests/Schema/IndexTest.php +++ b/tests/Schema/IndexTest.php @@ -9,9 +9,7 @@ class IndexTest extends TestCase { - /** - * @param mixed[] $options - */ + /** @param mixed[] $options */ private function createIndex(bool $unique = false, bool $primary = false, array $options = []): Index { return new Index('foo', ['bar', 'baz'], $unique, $primary, [], $options); @@ -120,9 +118,7 @@ public function testFulfilledWithLength(array $columns, array $lengths1, array $ self::assertSame($expected, $index2->isFullfilledBy($index1)); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function indexLengthProvider(): iterable { return [ diff --git a/tests/Schema/MySQLInheritCharsetTest.php b/tests/Schema/MySQLInheritCharsetTest.php index ef15736f4d0..81c7b53f74c 100644 --- a/tests/Schema/MySQLInheritCharsetTest.php +++ b/tests/Schema/MySQLInheritCharsetTest.php @@ -18,9 +18,7 @@ use function array_merge; -/** - * @psalm-import-type Params from DriverManager - */ +/** @psalm-import-type Params from DriverManager */ class MySQLInheritCharsetTest extends TestCase { public function testInheritTableOptionsFromDatabase(): void @@ -48,7 +46,7 @@ public function testTableOptions(): void $table = new Table('foobar', [new Column('aa', Type::getType('integer'))]); self::assertSame( ['CREATE TABLE foobar (aa INT NOT NULL)'], - $platform->getCreateTableSQL($table) + $platform->getCreateTableSQL($table), ); // charset @@ -56,7 +54,7 @@ public function testTableOptions(): void $table->addOption('charset', 'utf8'); self::assertSame( ['CREATE TABLE foobar (aa INT NOT NULL) DEFAULT CHARACTER SET utf8'], - $platform->getCreateTableSQL($table) + $platform->getCreateTableSQL($table), ); } diff --git a/tests/Schema/Platforms/MySQLSchemaTest.php b/tests/Schema/Platforms/MySQLSchemaTest.php index 087743c55a6..ebe551bd8f3 100644 --- a/tests/Schema/Platforms/MySQLSchemaTest.php +++ b/tests/Schema/Platforms/MySQLSchemaTest.php @@ -44,7 +44,7 @@ public function testSwitchPrimaryKeyOrder(): void 'DROP INDEX `primary` ON test', 'ALTER TABLE test ADD PRIMARY KEY (bar_id, foo_id)', ], - $sql + $sql, ); } @@ -64,7 +64,7 @@ public function testGenerateForeignKeySQL(): void 'ALTER TABLE test ADD CONSTRAINT FK_D87F7E0C8E48560F FOREIGN KEY (foo_id)' . ' REFERENCES test_foreign (foo_id)', ], - $sqls + $sqls, ); } @@ -85,7 +85,7 @@ public function testClobNoAlterTable(): void self::assertEquals( ['ALTER TABLE test ADD PRIMARY KEY (id)'], - $sql + $sql, ); } @@ -95,7 +95,7 @@ private function createComparator(): Comparator new MySQLPlatform(), $this->createStub(CharsetMetadataProvider::class), $this->createStub(CollationMetadataProvider::class), - new DefaultTableOptions('utf8mb4', 'utf8mb4_general_ci') + new DefaultTableOptions('utf8mb4', 'utf8mb4_general_ci'), ); } } diff --git a/tests/Schema/SQLiteSchemaManagerTest.php b/tests/Schema/SQLiteSchemaManagerTest.php index d1bd7c47ca7..43e6d7a0c9c 100644 --- a/tests/Schema/SQLiteSchemaManagerTest.php +++ b/tests/Schema/SQLiteSchemaManagerTest.php @@ -12,9 +12,7 @@ class SQLiteSchemaManagerTest extends TestCase { - /** - * @dataProvider getDataColumnCollation - */ + /** @dataProvider getDataColumnCollation */ public function testParseColumnCollation(?string $collation, string $column, string $sql): void { $conn = $this->createMock(Connection::class); @@ -25,9 +23,7 @@ public function testParseColumnCollation(?string $collation, string $column, str self::assertSame($collation, $ref->invoke($manager, $column, $sql)); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function getDataColumnCollation(): iterable { return [ @@ -127,9 +123,7 @@ public static function getDataColumnCollation(): iterable ]; } - /** - * @dataProvider getDataColumnComment - */ + /** @dataProvider getDataColumnComment */ public function testParseColumnCommentFromSQL(string $comment, string $column, string $sql): void { $conn = $this->createMock(Connection::class); @@ -140,9 +134,7 @@ public function testParseColumnCommentFromSQL(string $comment, string $column, s self::assertSame($comment, $ref->invoke($manager, $column, $sql)); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function getDataColumnComment(): iterable { return [ diff --git a/tests/Schema/TableTest.php b/tests/Schema/TableTest.php index 7b07fc6de00..c5c0818fade 100644 --- a/tests/Schema/TableTest.php +++ b/tests/Schema/TableTest.php @@ -649,7 +649,7 @@ public function testRenameIndex(): void self::assertEquals(new Index('pk_new', ['id'], true, true), $table->getIndex('pk_new')); self::assertEquals( new Index('idx_new', ['foo'], false, false, ['flag']), - $table->getIndex('idx_new') + $table->getIndex('idx_new'), ); self::assertEquals(new Index('uniq_new', ['bar', 'baz'], true), $table->getIndex('uniq_new')); @@ -671,11 +671,11 @@ public function testRenameIndex(): void self::assertEquals(new Index('primary', ['id'], true, true), $table->getIndex('primary')); self::assertEquals( new Index('IDX_D87F7E0C8C736521', ['foo'], false, false, ['flag']), - $table->getIndex('IDX_D87F7E0C8C736521') + $table->getIndex('IDX_D87F7E0C8C736521'), ); self::assertEquals( new Index('UNIQ_D87F7E0C76FF8CAA78240498', ['bar', 'baz'], true), - $table->getIndex('UNIQ_D87F7E0C76FF8CAA78240498') + $table->getIndex('UNIQ_D87F7E0C76FF8CAA78240498'), ); // Rename to same name (changed case). @@ -735,9 +735,7 @@ public function testThrowsExceptionOnRenamingToAlreadyExistingIndex(): void $table->renameIndex('idx_id', 'idx_foo'); } - /** - * @dataProvider getNormalizesAssetNames - */ + /** @dataProvider getNormalizesAssetNames */ public function testNormalizesColumnNames(string $assetName): void { $table = new Table('test'); @@ -786,9 +784,7 @@ public function testNormalizesColumnNames(string $assetName): void self::assertFalse($table->hasForeignKey('foo')); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function getNormalizesAssetNames(): iterable { return [ diff --git a/tests/TestUtil.php b/tests/TestUtil.php index ee12cc62435..f76faf19ce6 100644 --- a/tests/TestUtil.php +++ b/tests/TestUtil.php @@ -78,9 +78,7 @@ public static function getConnection(): Connection return $connection; } - /** - * @return mixed[] - */ + /** @return mixed[] */ public static function getConnectionParams(): array { if (self::hasRequiredConnectionParams()) { @@ -127,7 +125,7 @@ private static function initializeDatabase(): void if ($dbname === null) { throw new InvalidArgumentException( - 'You must have a database configured in your connection.' + 'You must have a database configured in your connection.', ); } @@ -144,9 +142,7 @@ private static function initializeDatabase(): void $privConn->close(); } - /** - * @return mixed[] - */ + /** @return mixed[] */ private static function getFallbackConnectionParams(): array { if (! extension_loaded('pdo_sqlite')) { @@ -160,9 +156,7 @@ private static function getFallbackConnectionParams(): array ]; } - /** - * @param list $subscribers - */ + /** @param list $subscribers */ private static function addDbEventSubscribers(Connection $connection, array $subscribers): void { $evm = $connection->getEventManager(); @@ -172,7 +166,7 @@ private static function addDbEventSubscribers(Connection $connection, array $sub throw new InvalidArgumentException(sprintf( '"%s" is not a valid event subscriber. It must be a class that implements "%s".', $subscriber, - EventSubscriber::class + EventSubscriber::class, )); } @@ -180,9 +174,7 @@ private static function addDbEventSubscribers(Connection $connection, array $sub } } - /** - * @return mixed[] - */ + /** @return mixed[] */ private static function getPrivilegedConnectionParameters(): array { if (isset($GLOBALS['tmpdb_driver'])) { @@ -195,9 +187,7 @@ private static function getPrivilegedConnectionParameters(): array return $parameters; } - /** - * @return mixed[] - */ + /** @return mixed[] */ private static function getTestConnectionParameters(): array { return self::mapConnectionParameters($GLOBALS, 'db_'); @@ -285,7 +275,7 @@ public static function generateResultSetQuery(array $rows, AbstractPlatform $pla } return $value . ' ' . $platform->quoteIdentifier($column); - }, array_keys($row), array_values($row))) + }, array_keys($row), array_values($row))), ); }, $rows)); } diff --git a/tests/Tools/Console/RunSqlCommandTest.php b/tests/Tools/Console/RunSqlCommandTest.php index 966171c228d..43d26cbbbce 100644 --- a/tests/Tools/Console/RunSqlCommandTest.php +++ b/tests/Tools/Console/RunSqlCommandTest.php @@ -56,7 +56,7 @@ public function testSelectStatementsPrintsResult(): void self::assertStringEqualsFile( __DIR__ . '/Fixtures/select-1.txt', - str_replace("\r\n", "\n", $this->commandTester->getDisplay()) + str_replace("\r\n", "\n", $this->commandTester->getDisplay()), ); } @@ -80,7 +80,7 @@ public function testSelectWithEmptyResultSet(): void self::assertStringContainsString( '[OK] The query yielded an empty result set.', - $this->commandTester->getDisplay() + $this->commandTester->getDisplay(), ); } @@ -132,7 +132,7 @@ public function testStatementsWithFetchResultPrintsResult(): void self::assertStringEqualsFile( __DIR__ . '/Fixtures/select-1.txt', - str_replace("\r\n", "\n", $this->commandTester->getDisplay()) + str_replace("\r\n", "\n", $this->commandTester->getDisplay()), ); } } diff --git a/tests/Types/BaseDateTypeTestCase.php b/tests/Types/BaseDateTypeTestCase.php index 25f9b72a881..81d6d4dc67b 100644 --- a/tests/Types/BaseDateTypeTestCase.php +++ b/tests/Types/BaseDateTypeTestCase.php @@ -40,9 +40,7 @@ public function testDateConvertsToDatabaseValue(): void self::assertIsString($this->type->convertToDatabaseValue(new DateTime(), $this->platform)); } - /** - * @dataProvider invalidPHPValuesProvider - */ + /** @dataProvider invalidPHPValuesProvider */ public function testInvalidTypeConversionToDatabaseValue(mixed $value): void { $this->expectException(ConversionException::class); @@ -84,9 +82,7 @@ public function testDateTimeImmutableConvertsToDatabaseValue(): void self::assertIsString($this->type->convertToDatabaseValue(new DateTimeImmutable(), $this->platform)); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function invalidPHPValuesProvider(): iterable { return [ diff --git a/tests/Types/BinaryTest.php b/tests/Types/BinaryTest.php index c82b7bdc45a..d95de474e0a 100644 --- a/tests/Types/BinaryTest.php +++ b/tests/Types/BinaryTest.php @@ -46,9 +46,7 @@ public function testReturnsSQLDeclaration(array $definition, string $expectedDec self::assertSame($expectedDeclaration, $this->type->getSQLDeclaration($definition, $platform)); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function definitionProvider(): iterable { return [ @@ -99,9 +97,7 @@ private function getBinaryString(): string return implode(array_map('chr', range(0, 255))); } - /** - * @dataProvider getInvalidDatabaseValues - */ + /** @dataProvider getInvalidDatabaseValues */ public function testThrowsConversionExceptionOnInvalidDatabaseValue(mixed $value): void { $this->expectException(ConversionException::class); @@ -109,9 +105,7 @@ public function testThrowsConversionExceptionOnInvalidDatabaseValue(mixed $value $this->type->convertToPHPValue($value, $this->platform); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function getInvalidDatabaseValues(): iterable { return [ diff --git a/tests/Types/ConversionExceptionTest.php b/tests/Types/ConversionExceptionTest.php index de02ad6cc26..3bb599baab9 100644 --- a/tests/Types/ConversionExceptionTest.php +++ b/tests/Types/ConversionExceptionTest.php @@ -26,22 +26,18 @@ public function testConversionFailedPreviousException(): void self::assertSame($previous, $exception->getPrevious()); } - /** - * @dataProvider scalarsProvider - */ + /** @dataProvider scalarsProvider */ public function testConversionFailedInvalidTypeWithScalar(mixed $scalarValue, string $expected): void { $exception = InvalidType::new($scalarValue, 'foo', ['bar', 'baz']); self::assertStringContainsString( $expected, - $exception->getMessage() + $exception->getMessage(), ); } - /** - * @dataProvider nonScalarsProvider - */ + /** @dataProvider nonScalarsProvider */ public function testConversionFailedInvalidTypeWithNonScalar(mixed $nonScalar): void { $exception = InvalidType::new($nonScalar, 'foo', ['bar', 'baz']); @@ -50,9 +46,9 @@ public function testConversionFailedInvalidTypeWithNonScalar(mixed $nonScalar): sprintf( 'Could not convert PHP value of type %s to type foo.' . ' Expected one of the following types: bar, baz.', - get_debug_type($nonScalar) + get_debug_type($nonScalar), ), - $exception->getMessage() + $exception->getMessage(), ); } @@ -74,9 +70,7 @@ public function testConversionFailedFormatPreservesPreviousException(): void self::assertSame($previous, $exception->getPrevious()); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function nonScalarsProvider(): iterable { return [ @@ -86,9 +80,7 @@ public static function nonScalarsProvider(): iterable ]; } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function scalarsProvider(): iterable { return [ diff --git a/tests/Types/DateImmutableTypeTest.php b/tests/Types/DateImmutableTypeTest.php index 2fa537bcf83..bca6ab8a01b 100644 --- a/tests/Types/DateImmutableTypeTest.php +++ b/tests/Types/DateImmutableTypeTest.php @@ -50,7 +50,7 @@ public function testConvertsDateTimeImmutableInstanceToDatabaseValue(): void self::assertSame( '2016-01-01', - $this->type->convertToDatabaseValue($date, $this->platform) + $this->type->convertToDatabaseValue($date, $this->platform), ); } diff --git a/tests/Types/DateIntervalTest.php b/tests/Types/DateIntervalTest.php index e4f57ac7b0b..9c23201c756 100644 --- a/tests/Types/DateIntervalTest.php +++ b/tests/Types/DateIntervalTest.php @@ -89,9 +89,7 @@ public function testDateIntervalEmptyStringConversion(): void $this->type->convertToPHPValue('', $this->platform); } - /** - * @dataProvider invalidPHPValuesProvider - */ + /** @dataProvider invalidPHPValuesProvider */ public function testInvalidTypeConversionToDatabaseValue(mixed $value): void { $this->expectException(ConversionException::class); @@ -99,9 +97,7 @@ public function testInvalidTypeConversionToDatabaseValue(mixed $value): void $this->type->convertToDatabaseValue($value, $this->platform); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function invalidPHPValuesProvider(): iterable { return [ diff --git a/tests/Types/DateTest.php b/tests/Types/DateTest.php index bb1aed3a157..8b4fea1280b 100644 --- a/tests/Types/DateTest.php +++ b/tests/Types/DateTest.php @@ -24,7 +24,7 @@ public function testDateConvertsToPHPValue(): void // Birthday of jwage and also birthday of Doctrine. Send him a present ;) self::assertInstanceOf( DateTime::class, - $this->type->convertToPHPValue('1985-09-01', $this->platform) + $this->type->convertToPHPValue('1985-09-01', $this->platform), ); } diff --git a/tests/Types/DateTimeImmutableTypeTest.php b/tests/Types/DateTimeImmutableTypeTest.php index 7dfff5f04fb..e1928826556 100644 --- a/tests/Types/DateTimeImmutableTypeTest.php +++ b/tests/Types/DateTimeImmutableTypeTest.php @@ -50,7 +50,7 @@ public function testConvertsDateTimeImmutableInstanceToDatabaseValue(): void self::assertSame( '2016-01-01 15:58:59', - $this->type->convertToDatabaseValue($date, $this->platform) + $this->type->convertToDatabaseValue($date, $this->platform), ); } diff --git a/tests/Types/DateTimeTzImmutableTypeTest.php b/tests/Types/DateTimeTzImmutableTypeTest.php index 46bcb8cbad5..c5f390dc3fb 100644 --- a/tests/Types/DateTimeTzImmutableTypeTest.php +++ b/tests/Types/DateTimeTzImmutableTypeTest.php @@ -50,7 +50,7 @@ public function testConvertsDateTimeImmutableInstanceToDatabaseValue(): void self::assertSame( '2016-01-01 15:58:59 UTC', - $this->type->convertToDatabaseValue($date, $this->platform) + $this->type->convertToDatabaseValue($date, $this->platform), ); } diff --git a/tests/Types/Exception/SerializationFailedTest.php b/tests/Types/Exception/SerializationFailedTest.php index 79781240a56..70b6a494e76 100644 --- a/tests/Types/Exception/SerializationFailedTest.php +++ b/tests/Types/Exception/SerializationFailedTest.php @@ -24,7 +24,7 @@ public function testNew(): void self::assertSame( 'Could not convert PHP type "float" to "json". An error was triggered by the serialization: ' . 'Inf and NaN cannot be JSON encoded', - $exception->getMessage() + $exception->getMessage(), ); } } diff --git a/tests/Types/Exception/TypeNotRegisteredTest.php b/tests/Types/Exception/TypeNotRegisteredTest.php index 9a1e195c82e..ce7d091d058 100644 --- a/tests/Types/Exception/TypeNotRegisteredTest.php +++ b/tests/Types/Exception/TypeNotRegisteredTest.php @@ -16,7 +16,7 @@ public function testNew(): void self::assertMatchesRegularExpression( '/Type of the class Doctrine\\\DBAL\\\Types\\\StringType@([0-9a-zA-Z]+) is not registered./', - $exception->getMessage() + $exception->getMessage(), ); } } diff --git a/tests/Types/JsonTest.php b/tests/Types/JsonTest.php index 3686896d715..00f4a37d689 100644 --- a/tests/Types/JsonTest.php +++ b/tests/Types/JsonTest.php @@ -69,9 +69,7 @@ public function testConversionFailure(string $data): void $this->type->convertToPHPValue($data, $this->platform); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function providerFailure(): iterable { return [['a'], ['{']]; @@ -118,7 +116,7 @@ public function testSerializationFailure(): void $this->expectException(ConversionException::class); $this->expectExceptionMessage( 'Could not convert PHP type "stdClass" to "json". ' - . 'An error was triggered by the serialization: Recursion detected' + . 'An error was triggered by the serialization: Recursion detected', ); $this->type->convertToDatabaseValue($object, $this->platform); } diff --git a/tests/Types/TimeImmutableTypeTest.php b/tests/Types/TimeImmutableTypeTest.php index 90c7f314ebd..f346d26e412 100644 --- a/tests/Types/TimeImmutableTypeTest.php +++ b/tests/Types/TimeImmutableTypeTest.php @@ -50,7 +50,7 @@ public function testConvertsDateTimeImmutableInstanceToDatabaseValue(): void self::assertSame( '15:58:59', - $this->type->convertToDatabaseValue($date, $this->platform) + $this->type->convertToDatabaseValue($date, $this->platform), ); } diff --git a/tests/Types/TypeRegistryTest.php b/tests/Types/TypeRegistryTest.php index b57eada2d68..fd6bf23ce80 100644 --- a/tests/Types/TypeRegistryTest.php +++ b/tests/Types/TypeRegistryTest.php @@ -46,7 +46,7 @@ public function testGetReturnsSameInstances(): void { self::assertSame( $this->registry->get(self::TEST_TYPE_NAME), - $this->registry->get(self::TEST_TYPE_NAME) + $this->registry->get(self::TEST_TYPE_NAME), ); } @@ -54,11 +54,11 @@ public function testLookupName(): void { self::assertSame( self::TEST_TYPE_NAME, - $this->registry->lookupName($this->testType) + $this->registry->lookupName($this->testType), ); self::assertSame( self::OTHER_TEST_TYPE_NAME, - $this->registry->lookupName($this->otherTestType) + $this->registry->lookupName($this->otherTestType), ); $this->expectException(TypeNotRegistered::class); @@ -98,7 +98,7 @@ public function testRegisterWithAlreadyRegisteredInstance(): void $this->registry->register('type2', $newType); self::assertSame( $this->registry->get('type1'), - $this->registry->get('type2') + $this->registry->get('type2'), ); } diff --git a/tests/Types/TypeTest.php b/tests/Types/TypeTest.php index efa9e229c3d..b30d9f3a8cd 100644 --- a/tests/Types/TypeTest.php +++ b/tests/Types/TypeTest.php @@ -10,17 +10,13 @@ class TypeTest extends TestCase { - /** - * @dataProvider defaultTypesProvider() - */ + /** @dataProvider defaultTypesProvider() */ public function testDefaultTypesAreRegistered(string $name): void { self::assertTrue(Type::hasType($name)); } - /** - * @return iterable - */ + /** @return iterable */ public function defaultTypesProvider(): iterable { foreach ((new ReflectionClass(Type::class))->getReflectionConstants() as $constant) { diff --git a/tests/Types/VarDateTimeImmutableTypeTest.php b/tests/Types/VarDateTimeImmutableTypeTest.php index 175a26afba0..71c34c411a0 100644 --- a/tests/Types/VarDateTimeImmutableTypeTest.php +++ b/tests/Types/VarDateTimeImmutableTypeTest.php @@ -46,7 +46,7 @@ public function testConvertsDateTimeImmutableInstanceToDatabaseValue(): void self::assertSame( '2016-01-01 15:58:59', - $this->type->convertToDatabaseValue($date, $this->platform) + $this->type->convertToDatabaseValue($date, $this->platform), ); }