From 35741d682240193b4403e3e1e6bad3cfeffa055e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Sun, 28 Aug 2022 15:09:27 +0200 Subject: [PATCH 1/2] Upgrade to doctrine/coding-standard 10 This reverts commit 2393612223c555b113b287ac2ac49b2072bd6374. --- bin/doctrine-dbal.php | 2 +- composer.json | 2 +- src/ArrayParameters/Exception.php | 4 +- .../Exception/MissingNamedParameter.php | 6 +- .../Exception/MissingPositionalParameter.php | 2 +- src/Cache/ArrayResult.php | 12 +- src/Cache/CacheException.php | 12 +- src/Cache/QueryCacheProfile.php | 12 +- src/Configuration.php | 14 +- src/Connection.php | 36 ++- src/ConnectionException.php | 20 +- .../PrimaryReadReplicaConnection.php | 2 +- 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/AbstractDB2Driver.php | 2 +- src/Driver/AbstractMySQLDriver.php | 12 +- src/Driver/AbstractOracleDriver.php | 2 +- .../EasyConnectString.php | 8 +- src/Driver/AbstractPostgreSQLDriver.php | 6 +- src/Driver/AbstractSQLServerDriver.php | 2 +- src/Driver/AbstractSQLiteDriver.php | 2 +- src/Driver/Exception.php | 4 +- src/Driver/Exception/UnknownParameterType.php | 4 +- src/Driver/FetchUtils.php | 4 +- src/Driver/IBMDB2/Connection.php | 6 +- .../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 | 8 +- .../AbstractConnectionMiddleware.php | 8 +- .../Middleware/AbstractDriverMiddleware.php | 2 +- .../AbstractStatementMiddleware.php | 6 +- src/Driver/Mysqli/Connection.php | 8 +- src/Driver/Mysqli/Driver.php | 4 +- .../Mysqli/Exception/InvalidCharset.php | 4 +- src/Driver/Mysqli/Exception/InvalidOption.php | 6 +- .../NonStreamResourceUsedAsLargeObject.php | 2 +- src/Driver/Mysqli/Initializer.php | 4 +- src/Driver/Mysqli/Initializer/Options.php | 4 +- src/Driver/Mysqli/Statement.php | 12 +- src/Driver/OCI8/Connection.php | 10 +- .../ConvertPositionalToNamedPlaceholders.php | 4 +- src/Driver/OCI8/Exception/Error.php | 4 +- .../Exception/NonTerminatedStringLiteral.php | 4 +- .../OCI8/Exception/UnknownParameterIndex.php | 2 +- src/Driver/OCI8/Result.php | 6 +- src/Driver/OCI8/Statement.php | 10 +- src/Driver/PDO/Connection.php | 12 +- 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 | 4 +- src/Driver/PDO/SQLSrv/Connection.php | 12 +- src/Driver/PDO/SQLSrv/Driver.php | 2 +- src/Driver/PDO/SQLSrv/Statement.php | 12 +- src/Driver/PDO/SQLite/Driver.php | 4 +- src/Driver/PDO/Statement.php | 16 +- src/Driver/SQLSrv/Connection.php | 6 +- src/Driver/SQLSrv/Result.php | 4 +- src/Driver/SQLSrv/Statement.php | 8 +- src/Event/ConnectionEventArgs.php | 4 +- src/Event/Listeners/OracleSessionInit.php | 4 +- src/Event/Listeners/SQLSessionInit.php | 4 +- .../SchemaAlterTableAddColumnEventArgs.php | 18 +- .../SchemaAlterTableChangeColumnEventArgs.php | 16 +- src/Event/SchemaAlterTableEventArgs.php | 12 +- .../SchemaAlterTableRemoveColumnEventArgs.php | 16 +- .../SchemaAlterTableRenameColumnEventArgs.php | 24 +- src/Event/SchemaColumnDefinitionEventArgs.php | 20 +- .../SchemaCreateTableColumnEventArgs.php | 16 +- src/Event/SchemaCreateTableEventArgs.php | 20 +- src/Event/SchemaDropTableEventArgs.php | 12 +- src/Event/SchemaEventArgs.php | 8 +- src/Event/SchemaIndexDefinitionEventArgs.php | 16 +- src/Exception.php | 38 ++- src/Exception/ConnectionLost.php | 4 +- src/Exception/DatabaseDoesNotExist.php | 4 +- src/Exception/DatabaseRequired.php | 4 +- src/Exception/InvalidArgumentException.php | 4 +- src/Exception/InvalidLockMode.php | 8 +- src/Exception/NoKeyValue.php | 4 +- src/Exception/SchemaDoesNotExist.php | 4 +- src/ExpandArrayParameters.php | 8 +- src/FetchMode.php | 2 + src/Id/TableGenerator.php | 6 +- src/Id/TableGeneratorSchemaVisitor.php | 8 +- src/Logging/Connection.php | 6 +- src/Logging/DebugStack.php | 2 +- src/Logging/Driver.php | 6 +- src/Logging/LoggerChain.php | 6 +- src/Logging/Statement.php | 10 +- src/Platforms/AbstractMySQLPlatform.php | 50 ++-- src/Platforms/AbstractPlatform.php | 222 +++++++++--------- src/Platforms/DB2Platform.php | 36 ++- src/Platforms/DateIntervalUnit.php | 4 +- src/Platforms/Keywords/DB2Keywords.php | 2 +- src/Platforms/Keywords/KeywordList.php | 4 +- src/Platforms/Keywords/MariaDBKeywords.php | 6 +- src/Platforms/Keywords/MariaDb102Keywords.php | 6 +- src/Platforms/Keywords/MySQL57Keywords.php | 2 +- src/Platforms/Keywords/MySQL80Keywords.php | 2 +- src/Platforms/Keywords/MySQLKeywords.php | 2 +- src/Platforms/Keywords/OracleKeywords.php | 2 +- .../Keywords/PostgreSQL100Keywords.php | 6 +- src/Platforms/Keywords/PostgreSQLKeywords.php | 2 +- .../Keywords/ReservedKeywordsValidator.php | 18 +- src/Platforms/Keywords/SQLServerKeywords.php | 2 +- src/Platforms/Keywords/SQLiteKeywords.php | 2 +- src/Platforms/MariaDBPlatform.php | 6 +- .../MySQL/CollationMetadataProvider.php | 4 +- .../CachingCollationMetadataProvider.php | 4 +- .../ConnectionCollationMetadataProvider.php | 10 +- src/Platforms/MySQL/Comparator.php | 6 +- src/Platforms/MySQL57Platform.php | 4 +- src/Platforms/MySQL80Platform.php | 2 +- src/Platforms/OraclePlatform.php | 42 ++-- src/Platforms/PostgreSQL100Platform.php | 6 +- src/Platforms/PostgreSQLPlatform.php | 56 ++--- src/Platforms/SQLServer/Comparator.php | 4 +- src/Platforms/SQLServerPlatform.php | 58 +++-- src/Platforms/SQLite/Comparator.php | 4 +- src/Platforms/SqlitePlatform.php | 58 ++--- src/Platforms/TrimMode.php | 4 +- src/Portability/Connection.php | 4 +- src/Portability/Driver.php | 4 +- src/Portability/Result.php | 16 +- src/Portability/Statement.php | 2 +- src/Query.php | 8 +- src/Query/Expression/CompositeExpression.php | 6 +- src/Query/Expression/ExpressionBuilder.php | 4 +- src/Query/QueryBuilder.php | 50 ++-- src/Query/QueryException.php | 4 +- src/Result.php | 16 +- .../Builder/CreateSchemaObjectsSQLBuilder.php | 2 +- src/Schema/AbstractAsset.php | 2 +- src/Schema/AbstractSchemaManager.php | 88 ++++--- src/Schema/Column.php | 66 ++---- src/Schema/ColumnDiff.php | 6 +- src/Schema/Comparator.php | 34 +-- src/Schema/Constraint.php | 8 +- src/Schema/DB2SchemaManager.php | 2 +- src/Schema/Exception/InvalidTableName.php | 4 +- src/Schema/Exception/UnknownColumnOption.php | 6 +- src/Schema/Index.php | 20 +- src/Schema/MySQLSchemaManager.php | 16 +- src/Schema/OracleSchemaManager.php | 4 +- src/Schema/PostgreSQLSchemaManager.php | 22 +- src/Schema/SQLServerSchemaManager.php | 22 +- src/Schema/Schema.php | 14 +- src/Schema/SchemaConfig.php | 8 +- src/Schema/SchemaDiff.php | 4 +- src/Schema/SchemaException.php | 28 +-- src/Schema/Sequence.php | 14 +- src/Schema/SqliteSchemaManager.php | 28 +-- src/Schema/Table.php | 42 ++-- src/Schema/TableDiff.php | 6 +- src/Schema/UniqueConstraint.php | 12 +- src/Schema/View.php | 4 +- .../Visitor/CreateSchemaSqlCollector.php | 12 +- src/Schema/Visitor/DropSchemaSqlCollector.php | 12 +- src/Schema/Visitor/Graphviz.php | 4 +- src/Schema/Visitor/RemoveNamespacedAssets.php | 2 +- src/Schema/Visitor/Visitor.php | 16 +- src/Statement.php | 10 +- .../Console/Command/ReservedWordsCommand.php | 23 +- src/Tools/Console/Command/RunSqlCommand.php | 13 +- src/Tools/Console/ConnectionProvider.php | 4 +- src/Tools/Console/ConsoleRunner.php | 4 +- src/TransactionIsolationLevel.php | 4 +- src/Types/ArrayType.php | 2 +- src/Types/BooleanType.php | 2 +- src/Types/ConversionException.php | 10 +- src/Types/DateImmutableType.php | 6 +- src/Types/DateIntervalType.php | 2 +- src/Types/DateTimeImmutableType.php | 6 +- src/Types/DateTimeType.php | 2 +- src/Types/DateTimeTzImmutableType.php | 6 +- src/Types/DateTimeTzType.php | 4 +- src/Types/DateType.php | 2 +- src/Types/GuidType.php | 2 +- src/Types/JsonType.php | 2 +- src/Types/ObjectType.php | 2 +- src/Types/SimpleArrayType.php | 2 +- src/Types/TimeImmutableType.php | 6 +- src/Types/TimeType.php | 2 +- src/Types/Type.php | 8 +- src/Types/TypeRegistry.php | 4 +- src/Types/Types.php | 12 +- src/Types/VarDateTimeImmutableType.php | 4 +- tests/Cache/QueryCacheProfileTest.php | 22 +- tests/Connection/CachedQueryTest.php | 12 +- .../Connection/ExpandArrayParametersTest.php | 12 +- tests/Connection/LoggingTest.php | 2 +- tests/ConnectionTest.php | 84 +++---- tests/Driver/AbstractDB2DriverTest.php | 6 +- tests/Driver/AbstractDriverTest.php | 22 +- 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 | 6 +- tests/Driver/Mysqli/ConnectionTest.php | 4 +- ...nvertPositionalToNamedPlaceholdersTest.php | 4 +- tests/Driver/PDO/ExceptionTest.php | 4 +- tests/Driver/PDO/PgSQL/DriverTest.php | 18 +- tests/DriverManagerTest.php | 24 +- tests/Events/OracleSessionInitTest.php | 8 +- tests/ExceptionTest.php | 8 +- tests/Functional/BlobTest.php | 6 +- .../Functional/Connection/FetchEmptyTest.php | 2 +- tests/Functional/ConnectionTest.php | 8 +- tests/Functional/DataAccessTest.php | 20 +- .../Functional/Driver/AbstractDriverTest.php | 6 +- tests/Functional/Driver/IBMDB2/DriverTest.php | 4 +- .../Driver/IBMDB2/StatementTest.php | 4 +- .../Driver/Mysqli/ConnectionTest.php | 16 +- tests/Functional/Driver/Mysqli/DriverTest.php | 4 +- .../Functional/Driver/OCI8/ConnectionTest.php | 4 +- tests/Functional/Driver/OCI8/DriverTest.php | 4 +- tests/Functional/Driver/OCI8/ResultTest.php | 18 +- .../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 | 16 +- .../Driver/PDO/SQLSrv/DriverTest.php | 14 +- .../Driver/PDO/SQLite/DriverTest.php | 4 +- tests/Functional/Driver/SQLSrv/DriverTest.php | 4 +- .../Driver/SQLSrv/StatementTest.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 | 6 +- tests/Functional/NamedParametersTest.php | 4 +- .../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 +- tests/Functional/Schema/ComparatorTest.php | 6 +- .../Functional/Schema/ComparatorTestUtils.php | 8 +- tests/Functional/Schema/DefaultValueTest.php | 4 +- .../Schema/MySQL/ComparatorTest.php | 32 +-- .../Schema/MySQLSchemaManagerTest.php | 26 +- .../Schema/OracleSchemaManagerTest.php | 14 +- .../Schema/PostgreSQL/SchemaTest.php | 2 +- .../Schema/PostgreSQLSchemaManagerTest.php | 24 +- .../Schema/SQLServerSchemaManagerTest.php | 46 ++-- .../SchemaManagerFunctionalTestCase.php | 100 +++----- .../Schema/SqliteSchemaManagerTest.php | 15 +- tests/Functional/StatementTest.php | 22 +- tests/Functional/TemporaryTableTest.php | 4 +- tests/Functional/Ticket/DBAL752Test.php | 5 +- tests/Functional/TypeConversionTest.php | 38 +-- tests/Functional/Types/AsciiStringTest.php | 2 +- tests/Functional/Types/BinaryTest.php | 6 +- tests/Functional/Types/DecimalTest.php | 12 +- tests/Functional/WriteTest.php | 30 +-- tests/FunctionalTestCase.php | 8 +- tests/Logging/DebugStackTest.php | 2 +- tests/Logging/LoggerChainTest.php | 8 +- .../AbstractMySQLPlatformTestCase.php | 156 +++++------- tests/Platforms/AbstractPlatformTestCase.php | 218 +++++++---------- tests/Platforms/DB2PlatformTest.php | 60 +++-- .../CachingCollationMetadataProviderTest.php | 8 +- tests/Platforms/MySQL/ComparatorTest.php | 2 +- tests/Platforms/MySQL57PlatformTest.php | 16 +- tests/Platforms/MySQLPlatformTest.php | 6 +- tests/Platforms/OraclePlatformTest.php | 114 ++++----- tests/Platforms/PostgreSQLPlatformTest.php | 136 +++++------ .../ReservedKeywordsValidatorTest.php | 4 +- tests/Platforms/SQLServerPlatformTestCase.php | 192 +++++++-------- tests/Platforms/SqlitePlatformTest.php | 120 +++++----- tests/Portability/ConnectionTest.php | 8 +- tests/Portability/ConverterTest.php | 36 +-- tests/Portability/ResultTest.php | 6 +- tests/Portability/StatementTest.php | 4 +- .../Expression/CompositeExpressionTest.php | 8 +- .../Expression/ExpressionBuilderTest.php | 30 +-- tests/Query/QueryBuilderTest.php | 74 +++--- tests/SQL/ParserTest.php | 44 +--- tests/Schema/ColumnTest.php | 8 +- tests/Schema/ComparatorTest.php | 104 ++++---- tests/Schema/ForeignKeyConstraintTest.php | 8 +- tests/Schema/IndexTest.php | 8 +- tests/Schema/MySQLInheritCharsetTest.php | 10 +- tests/Schema/Platforms/MySQLSchemaTest.php | 20 +- tests/Schema/SchemaTest.php | 8 +- tests/Schema/SqliteSchemaManagerTest.php | 16 +- tests/Schema/TableTest.php | 14 +- .../Visitor/CreateSchemaSqlCollectorTest.php | 14 +- .../Visitor/DropSchemaSqlCollectorTest.php | 10 +- tests/StatementTest.php | 2 +- tests/TestUtil.php | 24 +- tests/Tools/Console/RunSqlCommandTest.php | 6 +- tests/Types/ArrayTest.php | 4 +- tests/Types/BaseDateTypeTestCase.php | 4 +- tests/Types/BinaryTest.php | 4 +- tests/Types/ConversionExceptionTest.php | 12 +- tests/Types/DateImmutableTypeTest.php | 2 +- tests/Types/DateIntervalTest.php | 4 +- tests/Types/DateTest.php | 2 +- tests/Types/DateTimeImmutableTypeTest.php | 2 +- tests/Types/DateTimeTzImmutableTypeTest.php | 2 +- tests/Types/JsonTest.php | 10 +- tests/Types/ObjectTest.php | 2 +- tests/Types/TimeImmutableTypeTest.php | 2 +- tests/Types/TypeRegistryTest.php | 6 +- tests/Types/TypeTest.php | 8 +- tests/Types/VarDateTimeImmutableTypeTest.php | 2 +- 322 files changed, 1824 insertions(+), 2862 deletions(-) diff --git a/bin/doctrine-dbal.php b/bin/doctrine-dbal.php index 726f21c8851..03810b1cad5 100644 --- a/bin/doctrine-dbal.php +++ b/bin/doctrine-dbal.php @@ -6,7 +6,7 @@ STDERR, '[Warning] The use of this script is discouraged.' . ' You find instructions on how to boostrap the console runner in our documentation.' - . PHP_EOL + . PHP_EOL, ); echo PHP_EOL . PHP_EOL; diff --git a/composer.json b/composer.json index d6094ecdd55..11eb07f9b95 100644 --- a/composer.json +++ b/composer.json @@ -40,7 +40,7 @@ "psr/log": "^1|^2|^3" }, "require-dev": { - "doctrine/coding-standard": "9.0.2", + "doctrine/coding-standard": "10.0.0", "jetbrains/phpstorm-stubs": "2022.2", "phpstan/phpstan": "1.8.2", "phpstan/phpstan-strict-rules": "^1.3", diff --git a/src/ArrayParameters/Exception.php b/src/ArrayParameters/Exception.php index cce84b25bf0..7fc0f70603e 100644 --- a/src/ArrayParameters/Exception.php +++ b/src/ArrayParameters/Exception.php @@ -4,9 +4,7 @@ use Throwable; -/** - * @internal - */ +/** @internal */ interface Exception extends Throwable { } diff --git a/src/ArrayParameters/Exception/MissingNamedParameter.php b/src/ArrayParameters/Exception/MissingNamedParameter.php index 73803e2bd87..cd9b9756ae8 100644 --- a/src/ArrayParameters/Exception/MissingNamedParameter.php +++ b/src/ArrayParameters/Exception/MissingNamedParameter.php @@ -7,15 +7,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 3bfb0ea4845..f89a98b79ed 100644 --- a/src/ArrayParameters/Exception/MissingPositionalParameter.php +++ b/src/ArrayParameters/Exception/MissingPositionalParameter.php @@ -17,7 +17,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 996900776e1..93b93d176fa 100644 --- a/src/Cache/ArrayResult.php +++ b/src/Cache/ArrayResult.php @@ -9,9 +9,7 @@ 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 { /** @var list> */ @@ -20,9 +18,7 @@ final class ArrayResult implements Result private int $columnCount = 0; private int $num = 0; - /** - * @param list> $data - */ + /** @param list> $data */ public function __construct(array $data) { $this->data = $data; @@ -108,9 +104,7 @@ public function free(): void $this->data = []; } - /** - * @return array|false - */ + /** @return array|false */ private function fetch() { if (! isset($this->data[$this->num])) { diff --git a/src/Cache/CacheException.php b/src/Cache/CacheException.php index 3db115bdfae..18e95d6bed8 100644 --- a/src/Cache/CacheException.php +++ b/src/Cache/CacheException.php @@ -4,22 +4,16 @@ use Doctrine\DBAL\Exception; -/** - * @psalm-immutable - */ +/** @psalm-immutable */ class CacheException extends Exception { - /** - * @return CacheException - */ + /** @return CacheException */ public static function noCacheKey() { return new self('No cache key was set.'); } - /** - * @return CacheException - */ + /** @return CacheException */ public static function noResultDriverConfigured() { return new self('Trying to cache a query but no result driver is configured.'); diff --git a/src/Cache/QueryCacheProfile.php b/src/Cache/QueryCacheProfile.php index 61652eaa12c..e1476112ef3 100644 --- a/src/Cache/QueryCacheProfile.php +++ b/src/Cache/QueryCacheProfile.php @@ -49,7 +49,7 @@ public function __construct($lifetime = 0, $cacheKey = null, ?object $resultCach 'Passing an instance of %s to %s as $resultCache is deprecated. Pass an instance of %s instead.', Cache::class, __METHOD__, - CacheItemPoolInterface::class + CacheItemPoolInterface::class, ); $this->resultCache = CacheAdapter::wrap($resultCache); @@ -58,7 +58,7 @@ public function __construct($lifetime = 0, $cacheKey = null, ?object $resultCach '$resultCache: Expected either null or an instance of %s or %s, got %s.', CacheItemPoolInterface::class, Cache::class, - get_class($resultCache) + get_class($resultCache), )); } } @@ -79,15 +79,13 @@ public function getResultCacheDriver() 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4620', '%s is deprecated, call getResultCache() instead.', - __METHOD__ + __METHOD__, ); return $this->resultCache !== null ? DoctrineProvider::wrap($this->resultCache) : null; } - /** - * @return int - */ + /** @return int */ public function getLifetime() { return $this->lifetime; @@ -154,7 +152,7 @@ public function setResultCacheDriver(Cache $cache) 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4620', '%s is deprecated, call setResultCache() instead.', - __METHOD__ + __METHOD__, ); return new QueryCacheProfile($this->lifetime, $this->cacheKey, CacheAdapter::wrap($cache)); diff --git a/src/Configuration.php b/src/Configuration.php index 1c25959f642..1140582718d 100644 --- a/src/Configuration.php +++ b/src/Configuration.php @@ -73,7 +73,7 @@ public function setSQLLogger(?SQLLogger $logger = null): void 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4967', '%s is deprecated, use setMiddlewares() and Logging\\Middleware instead.', - __METHOD__ + __METHOD__, ); $this->sqlLogger = $logger; @@ -90,7 +90,7 @@ public function getSQLLogger(): ?SQLLogger 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4967', '%s is deprecated.', - __METHOD__ + __METHOD__, ); return $this->sqlLogger; @@ -115,7 +115,7 @@ public function getResultCacheImpl(): ?Cache 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4620', '%s is deprecated, call getResultCache() instead.', - __METHOD__ + __METHOD__, ); return $this->resultCacheImpl; @@ -141,7 +141,7 @@ public function setResultCacheImpl(Cache $cacheImpl): void 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4620', '%s is deprecated, call setResultCache() instead.', - __METHOD__ + __METHOD__, ); $this->resultCacheImpl = $cacheImpl; @@ -158,7 +158,7 @@ public function setSchemaAssetsFilter(?callable $callable = null): void 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5483', 'Not passing an argument to %s is deprecated.', - __METHOD__ + __METHOD__, ); } elseif ($callable === null) { Deprecation::trigger( @@ -220,9 +220,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 f587b6207cd..9ac939b55ee 100644 --- a/src/Connection.php +++ b/src/Connection.php @@ -294,7 +294,7 @@ public function getExpressionBuilder() 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4515', 'Connection::getExpressionBuilder() is deprecated,' - . ' use Connection::createExpressionBuilder() instead.' + . ' use Connection::createExpressionBuilder() instead.', ); return $this->_expr; @@ -315,7 +315,7 @@ public function connect() Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4966', - 'Public access to Connection::connect() is deprecated.' + 'Public access to Connection::connect() is deprecated.', ); if ($this->_conn !== null) { @@ -445,7 +445,7 @@ private function getServerVersion() 'doctrine/dbal', 'https://github.com/doctrine/dbal/pulls/4750', 'Not implementing the ServerInfoAwareConnection interface in %s is deprecated', - get_class($connection) + get_class($connection), ); // Unable to detect platform version. @@ -626,7 +626,7 @@ public function delete($table, array $criteria, array $types = []) return $this->executeStatement( 'DELETE FROM ' . $table . ' WHERE ' . implode(' AND ', $conditions), $values, - is_string(key($types)) ? $this->extractTypeValues($columns, $types) : $types + is_string(key($types)) ? $this->extractTypeValues($columns, $types) : $types, ); } @@ -738,7 +738,7 @@ public function insert($table, array $data, array $types = []) '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, ); } @@ -1172,7 +1172,7 @@ public function lastInsertId($name = null) Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4687', - 'The usage of Connection::lastInsertId() with a sequence name is deprecated.' + 'The usage of Connection::lastInsertId() with a sequence name is deprecated.', ); } @@ -1233,7 +1233,7 @@ public function setNestTransactionsWithSavepoints($nestTransactionsWithSavepoint Nesting transactions without enabling savepoints is deprecated. Call %s::setNestTransactionsWithSavepoints(true) to enable savepoints. DEPRECATION, - self::class + self::class, ); } @@ -1308,7 +1308,7 @@ public function beginTransaction() Nesting transactions without enabling savepoints is deprecated. Call %s::setNestTransactionsWithSavepoints(true) to enable savepoints. DEPRECATION, - self::class + self::class, ); } @@ -1523,7 +1523,7 @@ public function getWrappedConnection() 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4966', 'Connection::getWrappedConnection() is deprecated.' - . ' Use Connection::getNativeConnection() to access the native connection.' + . ' Use Connection::getNativeConnection() to access the native connection.', ); $this->connect(); @@ -1533,9 +1533,7 @@ public function getWrappedConnection() return $this->_conn; } - /** - * @return resource|object - */ + /** @return resource|object */ public function getNativeConnection() { $this->connect(); @@ -1544,7 +1542,7 @@ public function getNativeConnection() if (! method_exists($this->_conn, 'getNativeConnection')) { throw new LogicException(sprintf( 'The driver connection %s does not support accessing the native connection.', - get_class($this->_conn) + get_class($this->_conn), )); } @@ -1561,7 +1559,7 @@ public function createSchemaManager(): AbstractSchemaManager { return $this->_driver->getSchemaManager( $this, - $this->getDatabasePlatform() + $this->getDatabasePlatform(), ); } @@ -1580,7 +1578,7 @@ public function getSchemaManager() Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4515', - 'Connection::getSchemaManager() is deprecated, use Connection::createSchemaManager() instead.' + 'Connection::getSchemaManager() is deprecated, use Connection::createSchemaManager() instead.', ); return $this->_schemaManager ??= $this->createSchemaManager(); @@ -1677,7 +1675,7 @@ private function bindParameters(DriverStatement $stmt, array $params, array $typ 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5550', 'Using NULL as prepared statement parameter type is deprecated.' - . 'Omit or use Parameter::STRING instead' + . 'Omit or use Parameter::STRING instead', ); } @@ -1700,7 +1698,7 @@ private function bindParameters(DriverStatement $stmt, array $params, array $typ 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5550', 'Using NULL as prepared statement parameter type is deprecated.' - . 'Omit or use Parameter::STRING instead' + . 'Omit or use Parameter::STRING instead', ); } @@ -1763,9 +1761,7 @@ final public function convertExceptionDuringQuery( return $this->handleDriverException($e, new Query($sql, $params, $types)); } - /** - * @internal - */ + /** @internal */ final public function convertException(Driver\Exception $e): DriverException { return $this->handleDriverException($e, null); diff --git a/src/ConnectionException.php b/src/ConnectionException.php index 8426ca28891..f1e18987b61 100644 --- a/src/ConnectionException.php +++ b/src/ConnectionException.php @@ -2,38 +2,28 @@ namespace Doctrine\DBAL; -/** - * @psalm-immutable - */ +/** @psalm-immutable */ class ConnectionException extends Exception { - /** - * @return ConnectionException - */ + /** @return ConnectionException */ public static function commitFailedRollbackOnly() { return new self('Transaction commit failed because the transaction has been marked for rollback only.'); } - /** - * @return ConnectionException - */ + /** @return ConnectionException */ public static function noActiveTransaction() { return new self('There is no active transaction.'); } - /** - * @return ConnectionException - */ + /** @return ConnectionException */ public static function savepointsNotSupported() { return new self('Savepoints are not supported by this driver.'); } - /** - * @return ConnectionException - */ + /** @return ConnectionException */ public static function mayNotAlterNestedTransactionWithSavepointsInTransaction() { return new self('May not alter the nested transaction with savepoints behavior while a transaction is open.'); diff --git a/src/Connections/PrimaryReadReplicaConnection.php b/src/Connections/PrimaryReadReplicaConnection.php index 9d38f904b9d..1591ae1fb99 100644 --- a/src/Connections/PrimaryReadReplicaConnection.php +++ b/src/Connections/PrimaryReadReplicaConnection.php @@ -147,7 +147,7 @@ public function connect($connectionName = null) 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 c851949be38..87d50aff9e3 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 727a605d771..4703a57d513 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 { switch ($exception->getCode()) { diff --git a/src/Driver/API/PostgreSQL/ExceptionConverter.php b/src/Driver/API/PostgreSQL/ExceptionConverter.php index ffd2c1deb6a..2baca1ee232 100644 --- a/src/Driver/API/PostgreSQL/ExceptionConverter.php +++ b/src/Driver/API/PostgreSQL/ExceptionConverter.php @@ -23,14 +23,10 @@ use function strpos; -/** - * @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 e19b3ab8cef..9e67155ad5c 100644 --- a/src/Driver/API/SQLite/ExceptionConverter.php +++ b/src/Driver/API/SQLite/ExceptionConverter.php @@ -22,14 +22,10 @@ use function strpos; -/** - * @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 (strpos($exception->getMessage(), 'database is locked') !== false) { diff --git a/src/Driver/AbstractDB2Driver.php b/src/Driver/AbstractDB2Driver.php index f833c6b7063..3a08312d653 100644 --- a/src/Driver/AbstractDB2Driver.php +++ b/src/Driver/AbstractDB2Driver.php @@ -37,7 +37,7 @@ public function getSchemaManager(Connection $conn, AbstractPlatform $platform) 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5458', 'AbstractDB2Driver::getSchemaManager() is deprecated.' - . ' Use DB2Platform::createSchemaManager() instead.' + . ' Use DB2Platform::createSchemaManager() instead.', ); assert($platform instanceof DB2Platform); diff --git a/src/Driver/AbstractMySQLDriver.php b/src/Driver/AbstractMySQLDriver.php index af23c7da660..d8f3fb35c5b 100644 --- a/src/Driver/AbstractMySQLDriver.php +++ b/src/Driver/AbstractMySQLDriver.php @@ -53,7 +53,7 @@ public function createDatabasePlatformForVersion($version) 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5060', 'MySQL 5.6 support is deprecated and will be removed in DBAL 4.' - . ' Consider upgrading to MySQL 5.7 or later.' + . ' Consider upgrading to MySQL 5.7 or later.', ); return $this->getDatabasePlatform(); @@ -73,12 +73,12 @@ private function getOracleMysqlVersionNumber(string $versionString): string preg_match( '/^(?P\d+)(?:\.(?P\d+)(?:\.(?P\d+))?)?/', $versionString, - $versionParts + $versionParts, ) === 0 ) { throw Exception::invalidPlatformVersionSpecified( $versionString, - '..' + '..', ); } @@ -107,12 +107,12 @@ private function getMariaDbMysqlVersionNumber(string $versionString): string preg_match( '/^(?:5\.5\.5-)?(mariadb-)?(?P\d+)\.(?P\d+)\.(?P\d+)/i', $versionString, - $versionParts + $versionParts, ) === 0 ) { throw Exception::invalidPlatformVersionSpecified( $versionString, - '^(?:5\.5\.5-)?(mariadb-)?..' + '^(?:5\.5\.5-)?(mariadb-)?..', ); } @@ -142,7 +142,7 @@ public function getSchemaManager(Connection $conn, AbstractPlatform $platform) 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5458', 'AbstractMySQLDriver::getSchemaManager() is deprecated.' - . ' Use MySQLPlatform::createSchemaManager() instead.' + . ' Use MySQLPlatform::createSchemaManager() instead.', ); assert($platform instanceof AbstractMySQLPlatform); diff --git a/src/Driver/AbstractOracleDriver.php b/src/Driver/AbstractOracleDriver.php index 7d7b89b1577..d912109a0e0 100644 --- a/src/Driver/AbstractOracleDriver.php +++ b/src/Driver/AbstractOracleDriver.php @@ -38,7 +38,7 @@ public function getSchemaManager(Connection $conn, AbstractPlatform $platform) 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5458', 'AbstractOracleDriver::getSchemaManager() is deprecated.' - . ' Use OraclePlatform::createSchemaManager() instead.' + . ' Use OraclePlatform::createSchemaManager() instead.', ); assert($platform instanceof OraclePlatform); diff --git a/src/Driver/AbstractOracleDriver/EasyConnectString.php b/src/Driver/AbstractOracleDriver/EasyConnectString.php index 1ea6226bbff..91bc6a7e1b0 100644 --- a/src/Driver/AbstractOracleDriver/EasyConnectString.php +++ b/src/Driver/AbstractOracleDriver/EasyConnectString.php @@ -86,9 +86,7 @@ public static function fromConnectionParameters(array $params): self ]); } - /** - * @param mixed[] $params - */ + /** @param mixed[] $params */ private static function renderParams(array $params): string { $chunks = []; @@ -106,9 +104,7 @@ private static function renderParams(array $params): string return implode('', $chunks); } - /** - * @param mixed $value - */ + /** @param mixed $value */ private static function renderValue($value): string { if (is_array($value)) { diff --git a/src/Driver/AbstractPostgreSQLDriver.php b/src/Driver/AbstractPostgreSQLDriver.php index 85ad3802d5e..69e4baff31e 100644 --- a/src/Driver/AbstractPostgreSQLDriver.php +++ b/src/Driver/AbstractPostgreSQLDriver.php @@ -31,7 +31,7 @@ public function createDatabasePlatformForVersion($version) if (preg_match('/^(?P\d+)(?:\.(?P\d+)(?:\.(?P\d+))?)?/', $version, $versionParts) === 0) { throw Exception::invalidPlatformVersionSpecified( $version, - '..' + '..', ); } @@ -48,7 +48,7 @@ public function createDatabasePlatformForVersion($version) 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5060', 'PostgreSQL 9 support is deprecated and will be removed in DBAL 4.' - . ' Consider upgrading to Postgres 10 or later.' + . ' Consider upgrading to Postgres 10 or later.', ); return new PostgreSQL94Platform(); @@ -73,7 +73,7 @@ public function getSchemaManager(Connection $conn, AbstractPlatform $platform) 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5458', 'AbstractPostgreSQLDriver::getSchemaManager() is deprecated.' - . ' Use PostgreSQLPlatform::createSchemaManager() instead.' + . ' Use PostgreSQLPlatform::createSchemaManager() instead.', ); assert($platform instanceof PostgreSQLPlatform); diff --git a/src/Driver/AbstractSQLServerDriver.php b/src/Driver/AbstractSQLServerDriver.php index c8e2cd27614..c5d79feeff5 100644 --- a/src/Driver/AbstractSQLServerDriver.php +++ b/src/Driver/AbstractSQLServerDriver.php @@ -38,7 +38,7 @@ public function getSchemaManager(Connection $conn, AbstractPlatform $platform) 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5458', 'AbstractSQLServerDriver::getSchemaManager() is deprecated.' - . ' Use SQLServerPlatform::createSchemaManager() instead.' + . ' Use SQLServerPlatform::createSchemaManager() instead.', ); assert($platform instanceof SQLServerPlatform); diff --git a/src/Driver/AbstractSQLiteDriver.php b/src/Driver/AbstractSQLiteDriver.php index 99f65382982..3c9d2c7141a 100644 --- a/src/Driver/AbstractSQLiteDriver.php +++ b/src/Driver/AbstractSQLiteDriver.php @@ -37,7 +37,7 @@ public function getSchemaManager(Connection $conn, AbstractPlatform $platform) 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5458', 'AbstractSQLiteDriver::getSchemaManager() is deprecated.' - . ' Use SqlitePlatform::createSchemaManager() instead.' + . ' Use SqlitePlatform::createSchemaManager() instead.', ); assert($platform instanceof SqlitePlatform); diff --git a/src/Driver/Exception.php b/src/Driver/Exception.php index 0b108963a0f..f963563b83c 100644 --- a/src/Driver/Exception.php +++ b/src/Driver/Exception.php @@ -6,9 +6,7 @@ use Throwable; -/** - * @psalm-immutable - */ +/** @psalm-immutable */ interface Exception extends Throwable { /** diff --git a/src/Driver/Exception/UnknownParameterType.php b/src/Driver/Exception/UnknownParameterType.php index c989184d6b6..01a9b3d0c54 100644 --- a/src/Driver/Exception/UnknownParameterType.php +++ b/src/Driver/Exception/UnknownParameterType.php @@ -15,9 +15,7 @@ */ final class UnknownParameterType extends AbstractException { - /** - * @param mixed $type - */ + /** @param mixed $type */ public static function new($type): self { return new self(sprintf('Unknown parameter type, %d given.', $type)); diff --git a/src/Driver/FetchUtils.php b/src/Driver/FetchUtils.php index 240cef4a001..50e02b1a29c 100644 --- a/src/Driver/FetchUtils.php +++ b/src/Driver/FetchUtils.php @@ -4,9 +4,7 @@ namespace Doctrine\DBAL\Driver; -/** - * @internal - */ +/** @internal */ final class FetchUtils { /** diff --git a/src/Driver/IBMDB2/Connection.php b/src/Driver/IBMDB2/Connection.php index aca2a02ce92..6a2aa802e9d 100644 --- a/src/Driver/IBMDB2/Connection.php +++ b/src/Driver/IBMDB2/Connection.php @@ -104,7 +104,7 @@ public function lastInsertId($name = null) Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4687', - 'The usage of Connection::lastInsertId() with a sequence name is deprecated.' + 'The usage of Connection::lastInsertId() with a sequence name is deprecated.', ); } @@ -143,9 +143,7 @@ public function rollBack(): bool return $result; } - /** - * @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 56f2913ed82..4cfb135d04a 100644 --- a/src/Driver/IBMDB2/Statement.php +++ b/src/Driver/IBMDB2/Statement.php @@ -67,7 +67,7 @@ public function bindValue($param, $value, $type = ParameterType::STRING): bool 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5558', 'Not passing $type to Statement::bindValue() is deprecated.' - . ' Pass the type corresponding to the parameter being bound.' + . ' Pass the type corresponding to the parameter being bound.', ); } @@ -85,7 +85,7 @@ public function bindParam($param, &$variable, $type = ParameterType::STRING, $le 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5563', '%s is deprecated. Use bindValue() instead.', - __METHOD__ + __METHOD__, ); assert(is_int($param)); @@ -95,7 +95,7 @@ public function bindParam($param, &$variable, $type = ParameterType::STRING, $le 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5558', 'Not passing $type to Statement::bindParam() is deprecated.' - . ' Pass the type corresponding to the parameter being bound.' + . ' Pass the type corresponding to the parameter being bound.', ); } @@ -141,7 +141,7 @@ public function execute($params = null): ResultInterface 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5556', 'Passing $params to Statement::execute() is deprecated. Bind parameters using' - . ' Statement::bindParam() or Statement::bindValue() instead.' + . ' Statement::bindParam() or Statement::bindValue() instead.', ); } diff --git a/src/Driver/Middleware/AbstractConnectionMiddleware.php b/src/Driver/Middleware/AbstractConnectionMiddleware.php index e88c194ea40..6dab1cf13ac 100644 --- a/src/Driver/Middleware/AbstractConnectionMiddleware.php +++ b/src/Driver/Middleware/AbstractConnectionMiddleware.php @@ -55,7 +55,7 @@ public function lastInsertId($name = null) Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4687', - 'The usage of Connection::lastInsertId() with a sequence name is deprecated.' + 'The usage of Connection::lastInsertId() with a sequence name is deprecated.', ); } @@ -98,15 +98,13 @@ public function getServerVersion() return $this->wrappedConnection->getServerVersion(); } - /** - * @return resource|object - */ + /** @return resource|object */ public function getNativeConnection() { if (! method_exists($this->wrappedConnection, 'getNativeConnection')) { throw new LogicException(sprintf( 'The driver connection %s does not support accessing the native connection.', - get_class($this->wrappedConnection) + get_class($this->wrappedConnection), )); } diff --git a/src/Driver/Middleware/AbstractDriverMiddleware.php b/src/Driver/Middleware/AbstractDriverMiddleware.php index 29f2283f5f0..6914176f46c 100644 --- a/src/Driver/Middleware/AbstractDriverMiddleware.php +++ b/src/Driver/Middleware/AbstractDriverMiddleware.php @@ -45,7 +45,7 @@ public function getSchemaManager(Connection $conn, AbstractPlatform $platform) 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5458', 'AbstractDriverMiddleware::getSchemaManager() is deprecated.' - . ' Use AbstractPlatform::createSchemaManager() instead.' + . ' Use AbstractPlatform::createSchemaManager() instead.', ); return $this->wrappedDriver->getSchemaManager($conn, $platform); diff --git a/src/Driver/Middleware/AbstractStatementMiddleware.php b/src/Driver/Middleware/AbstractStatementMiddleware.php index 9b61b595d5d..70e8df637ce 100644 --- a/src/Driver/Middleware/AbstractStatementMiddleware.php +++ b/src/Driver/Middleware/AbstractStatementMiddleware.php @@ -28,7 +28,7 @@ public function bindValue($param, $value, $type = ParameterType::STRING) 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5558', 'Not passing $type to Statement::bindValue() is deprecated.' - . ' Pass the type corresponding to the parameter being bound.' + . ' Pass the type corresponding to the parameter being bound.', ); } @@ -46,7 +46,7 @@ public function bindParam($param, &$variable, $type = ParameterType::STRING, $le 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5563', '%s is deprecated. Use bindValue() instead.', - __METHOD__ + __METHOD__, ); if (func_num_args() < 3) { @@ -54,7 +54,7 @@ public function bindParam($param, &$variable, $type = ParameterType::STRING, $le 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5558', 'Not passing $type to Statement::bindParam() is deprecated.' - . ' Pass the type corresponding to the parameter being bound.' + . ' Pass the type corresponding to the parameter being bound.', ); } diff --git a/src/Driver/Mysqli/Connection.php b/src/Driver/Mysqli/Connection.php index db9fd5244ee..78112d8254f 100644 --- a/src/Driver/Mysqli/Connection.php +++ b/src/Driver/Mysqli/Connection.php @@ -20,9 +20,7 @@ final class Connection implements ServerInfoAwareConnection private mysqli $connection; - /** - * @internal The connection can be only instantiated by its driver. - */ + /** @internal The connection can be only instantiated by its driver. */ public function __construct(mysqli $connection) { $this->connection = $connection; @@ -41,7 +39,7 @@ public function getWrappedResourceHandle(): mysqli 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5037', '%s is deprecated, call getNativeConnection() instead.', - __METHOD__ + __METHOD__, ); return $this->getNativeConnection(); @@ -104,7 +102,7 @@ public function lastInsertId($name = null) Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4687', - 'The usage of Connection::lastInsertId() with a sequence name is deprecated.' + 'The usage of Connection::lastInsertId() with a sequence name is deprecated.', ); } diff --git a/src/Driver/Mysqli/Driver.php b/src/Driver/Mysqli/Driver.php index 41a66a732b5..af305230f80 100644 --- a/src/Driver/Mysqli/Driver.php +++ b/src/Driver/Mysqli/Driver.php @@ -64,7 +64,7 @@ public function connect(array $params) $params['dbname'] ?? null, $params['port'] ?? null, $params['unix_socket'] ?? null, - $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 763b4eb777b..8c6bbb476e3 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, ); } @@ -36,7 +36,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 962175679c2..6fb46316ea4 100644 --- a/src/Driver/Mysqli/Exception/InvalidOption.php +++ b/src/Driver/Mysqli/Exception/InvalidOption.php @@ -15,13 +15,11 @@ */ final class InvalidOption extends AbstractException { - /** - * @param mixed $value - */ + /** @param mixed $value */ public static function fromOption(int $option, $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 d2edf9381ed..2e66f8d6984 100644 --- a/src/Driver/Mysqli/Initializer/Options.php +++ b/src/Driver/Mysqli/Initializer/Options.php @@ -15,9 +15,7 @@ final class Options implements Initializer /** @var array */ private array $options; - /** - * @param array $options - */ + /** @param array $options */ public function __construct(array $options) { $this->options = $options; diff --git a/src/Driver/Mysqli/Statement.php b/src/Driver/Mysqli/Statement.php index 4714d80b929..7b7c93129b3 100644 --- a/src/Driver/Mysqli/Statement.php +++ b/src/Driver/Mysqli/Statement.php @@ -52,9 +52,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(mysqli_stmt $stmt) { $this->stmt = $stmt; @@ -75,7 +73,7 @@ public function bindParam($param, &$variable, $type = ParameterType::STRING, $le 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5563', '%s is deprecated. Use bindValue() instead.', - __METHOD__ + __METHOD__, ); assert(is_int($param)); @@ -85,7 +83,7 @@ public function bindParam($param, &$variable, $type = ParameterType::STRING, $le 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5558', 'Not passing $type to Statement::bindParam() is deprecated.' - . ' Pass the type corresponding to the parameter being bound.' + . ' Pass the type corresponding to the parameter being bound.', ); } @@ -111,7 +109,7 @@ public function bindValue($param, $value, $type = ParameterType::STRING): bool 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5558', 'Not passing $type to Statement::bindValue() is deprecated.' - . ' Pass the type corresponding to the parameter being bound.' + . ' Pass the type corresponding to the parameter being bound.', ); } @@ -136,7 +134,7 @@ public function execute($params = null): ResultInterface 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5556', 'Passing $params to Statement::execute() is deprecated. Bind parameters using' - . ' Statement::bindParam() or Statement::bindValue() instead.' + . ' Statement::bindParam() or Statement::bindValue() instead.', ); } diff --git a/src/Driver/OCI8/Connection.php b/src/Driver/OCI8/Connection.php index 26663fed5df..da4f61aeba5 100644 --- a/src/Driver/OCI8/Connection.php +++ b/src/Driver/OCI8/Connection.php @@ -58,9 +58,7 @@ public function getServerVersion(): string return $matches[1]; } - /** - * @throws Parser\Exception - */ + /** @throws Parser\Exception */ public function prepare(string $sql): DriverStatement { $visitor = new ConvertPositionalToNamedPlaceholders(); @@ -123,7 +121,7 @@ public function lastInsertId($name = null) Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4687', - 'The usage of Connection::lastInsertId() with a sequence name is deprecated.' + 'The usage of Connection::lastInsertId() with a sequence name is deprecated.', ); $result = $this->query('SELECT ' . $name . '.CURRVAL FROM DUAL')->fetchOne(); @@ -164,9 +162,7 @@ public function rollBack(): bool return true; } - /** - * @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 ebf2235503e..e2a1126297d 100644 --- a/src/Driver/OCI8/ConvertPositionalToNamedPlaceholders.php +++ b/src/Driver/OCI8/ConvertPositionalToNamedPlaceholders.php @@ -48,9 +48,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 8f77da75905..08add4faf76 100644 --- a/src/Driver/OCI8/Result.php +++ b/src/Driver/OCI8/Result.php @@ -129,9 +129,7 @@ private function fetch(int $mode) return $result; } - /** - * @return array - */ + /** @return array */ private function fetchAll(int $mode, int $fetchStructure): array { oci_fetch_all( @@ -139,7 +137,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 99b4e2f4473..e707f721c1e 100644 --- a/src/Driver/OCI8/Statement.php +++ b/src/Driver/OCI8/Statement.php @@ -61,7 +61,7 @@ public function bindValue($param, $value, $type = ParameterType::STRING): bool 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5558', 'Not passing $type to Statement::bindValue() is deprecated.' - . ' Pass the type corresponding to the parameter being bound.' + . ' Pass the type corresponding to the parameter being bound.', ); } @@ -79,7 +79,7 @@ public function bindParam($param, &$variable, $type = ParameterType::STRING, $le 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5563', '%s is deprecated. Use bindValue() instead.', - __METHOD__ + __METHOD__, ); if (func_num_args() < 3) { @@ -87,7 +87,7 @@ public function bindParam($param, &$variable, $type = ParameterType::STRING, $le 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5558', 'Not passing $type to Statement::bindParam() is deprecated.' - . ' Pass the type corresponding to the parameter being bound.' + . ' Pass the type corresponding to the parameter being bound.', ); } @@ -115,7 +115,7 @@ public function bindParam($param, &$variable, $type = ParameterType::STRING, $le $param, $variable, $length ?? -1, - $this->convertParameterType($type) + $this->convertParameterType($type), ); } @@ -146,7 +146,7 @@ public function execute($params = null): ResultInterface 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5556', 'Passing $params to Statement::execute() is deprecated. Bind parameters using' - . ' Statement::bindParam() or Statement::bindValue() instead.' + . ' Statement::bindParam() or Statement::bindValue() instead.', ); foreach ($params as $key => $val) { diff --git a/src/Driver/PDO/Connection.php b/src/Driver/PDO/Connection.php index 857efa1eb9e..e0b6221f41c 100644 --- a/src/Driver/PDO/Connection.php +++ b/src/Driver/PDO/Connection.php @@ -17,9 +17,7 @@ final class Connection implements ServerInfoAwareConnection { private PDO $connection; - /** - * @internal The connection can be only instantiated by its driver. - */ + /** @internal The connection can be only instantiated by its driver. */ public function __construct(PDO $connection) { $connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); @@ -98,7 +96,7 @@ public function lastInsertId($name = null) Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4687', - 'The usage of Connection::lastInsertId() with a sequence name is deprecated.' + 'The usage of Connection::lastInsertId() with a sequence name is deprecated.', ); return $this->connection->lastInsertId($name); @@ -127,16 +125,14 @@ public function getNativeConnection(): PDO return $this->connection; } - /** - * @deprecated Call {@see getNativeConnection()} instead. - */ + /** @deprecated Call {@see getNativeConnection()} instead. */ public function getWrappedConnection(): PDO { Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5037', '%s is deprecated, call getNativeConnection() instead.', - __METHOD__ + __METHOD__, ); return $this->getNativeConnection(); diff --git a/src/Driver/PDO/MySQL/Driver.php b/src/Driver/PDO/MySQL/Driver.php index 8aeb2696496..505b0fa692c 100644 --- a/src/Driver/PDO/MySQL/Driver.php +++ b/src/Driver/PDO/MySQL/Driver.php @@ -28,7 +28,7 @@ public function connect(array $params) $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 705db611879..fb9944bb8c1 100644 --- a/src/Driver/PDO/OCI/Driver.php +++ b/src/Driver/PDO/OCI/Driver.php @@ -28,7 +28,7 @@ public function connect(array $params) $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 b90e472622a..acb94ced819 100644 --- a/src/Driver/PDO/PgSQL/Driver.php +++ b/src/Driver/PDO/PgSQL/Driver.php @@ -28,7 +28,7 @@ public function connect(array $params) $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 a388b2a6c9f..88957d23ca8 100644 --- a/src/Driver/PDO/Result.php +++ b/src/Driver/PDO/Result.php @@ -13,9 +13,7 @@ final class Result implements ResultInterface { private PDOStatement $statement; - /** - * @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(PDOStatement $statement) { $this->statement = $statement; diff --git a/src/Driver/PDO/SQLSrv/Connection.php b/src/Driver/PDO/SQLSrv/Connection.php index cc9b571e932..9015f5558ff 100644 --- a/src/Driver/PDO/SQLSrv/Connection.php +++ b/src/Driver/PDO/SQLSrv/Connection.php @@ -22,7 +22,7 @@ public function __construct(PDOConnection $connection) public function prepare(string $sql): StatementInterface { return new Statement( - $this->connection->prepare($sql) + $this->connection->prepare($sql), ); } @@ -38,11 +38,11 @@ public function lastInsertId($name = null) Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4687', - 'The usage of Connection::lastInsertId() with a sequence name is deprecated.' + 'The usage of Connection::lastInsertId() with a sequence name is deprecated.', ); $statement = $this->prepare( - 'SELECT CONVERT(VARCHAR(MAX), current_value) FROM sys.sequences WHERE name = ?' + 'SELECT CONVERT(VARCHAR(MAX), current_value) FROM sys.sequences WHERE name = ?', ); $statement->bindValue(1, $name); @@ -55,16 +55,14 @@ public function getNativeConnection(): PDO return $this->connection->getNativeConnection(); } - /** - * @deprecated Call {@see getNativeConnection()} instead. - */ + /** @deprecated Call {@see getNativeConnection()} instead. */ public function getWrappedConnection(): PDO { Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5037', '%s is deprecated, call getNativeConnection() instead.', - __METHOD__ + __METHOD__, ); return $this->connection->getWrappedConnection(); diff --git a/src/Driver/PDO/SQLSrv/Driver.php b/src/Driver/PDO/SQLSrv/Driver.php index b664950f269..eba640e6e23 100644 --- a/src/Driver/PDO/SQLSrv/Driver.php +++ b/src/Driver/PDO/SQLSrv/Driver.php @@ -42,7 +42,7 @@ public function connect(array $params) $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 e4ab5e119fa..edabd410ac8 100644 --- a/src/Driver/PDO/SQLSrv/Statement.php +++ b/src/Driver/PDO/SQLSrv/Statement.php @@ -14,9 +14,7 @@ final class Statement extends AbstractStatementMiddleware { private PDOStatement $statement; - /** - * @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(PDOStatement $statement) { parent::__construct($statement); @@ -46,7 +44,7 @@ public function bindParam( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5563', '%s is deprecated. Use bindValue() instead.', - __METHOD__ + __METHOD__, ); if (func_num_args() < 3) { @@ -54,7 +52,7 @@ public function bindParam( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5558', 'Not passing $type to Statement::bindParam() is deprecated.' - . ' Pass the type corresponding to the parameter being bound.' + . ' Pass the type corresponding to the parameter being bound.', ); } @@ -62,7 +60,7 @@ public function bindParam( Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4533', - 'The $driverOptions argument of Statement::bindParam() is deprecated.' + 'The $driverOptions argument of Statement::bindParam() is deprecated.', ); } @@ -93,7 +91,7 @@ public function bindValue($param, $value, $type = ParameterType::STRING): bool 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5558', 'Not passing $type to Statement::bindValue() is deprecated.' - . ' Pass the type corresponding to the parameter being bound.' + . ' Pass the type corresponding to the parameter being bound.', ); } diff --git a/src/Driver/PDO/SQLite/Driver.php b/src/Driver/PDO/SQLite/Driver.php index 9ce8a0302ba..9d56526c519 100644 --- a/src/Driver/PDO/SQLite/Driver.php +++ b/src/Driver/PDO/SQLite/Driver.php @@ -32,7 +32,7 @@ public function connect(array $params) if (isset($driverOptions['userDefinedFunctions'])) { $this->userDefinedFunctions = array_merge( $this->userDefinedFunctions, - $driverOptions['userDefinedFunctions'] + $driverOptions['userDefinedFunctions'], ); unset($driverOptions['userDefinedFunctions']); } @@ -42,7 +42,7 @@ public function connect(array $params) $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 cdc1cf6a519..aaf494ccbcf 100644 --- a/src/Driver/PDO/Statement.php +++ b/src/Driver/PDO/Statement.php @@ -30,9 +30,7 @@ final class Statement implements StatementInterface private PDOStatement $stmt; - /** - * @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(PDOStatement $stmt) { $this->stmt = $stmt; @@ -48,7 +46,7 @@ public function bindValue($param, $value, $type = ParameterType::STRING) 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5558', 'Not passing $type to Statement::bindValue() is deprecated.' - . ' Pass the type corresponding to the parameter being bound.' + . ' Pass the type corresponding to the parameter being bound.', ); } @@ -83,7 +81,7 @@ public function bindParam( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5563', '%s is deprecated. Use bindValue() instead.', - __METHOD__ + __METHOD__, ); if (func_num_args() < 3) { @@ -91,7 +89,7 @@ public function bindParam( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5558', 'Not passing $type to Statement::bindParam() is deprecated.' - . ' Pass the type corresponding to the parameter being bound.' + . ' Pass the type corresponding to the parameter being bound.', ); } @@ -99,7 +97,7 @@ public function bindParam( Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4533', - 'The $driverOptions argument of Statement::bindParam() is deprecated.' + 'The $driverOptions argument of Statement::bindParam() is deprecated.', ); } @@ -111,7 +109,7 @@ public function bindParam( $variable, $type, $length ?? 0, - ...array_slice(func_get_args(), 4) + ...array_slice(func_get_args(), 4), ); } catch (PDOException $exception) { throw Exception::new($exception); @@ -128,7 +126,7 @@ public function execute($params = null): ResultInterface 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5556', 'Passing $params to Statement::execute() is deprecated. Bind parameters using' - . ' Statement::bindParam() or Statement::bindValue() instead.' + . ' Statement::bindParam() or Statement::bindValue() instead.', ); } diff --git a/src/Driver/SQLSrv/Connection.php b/src/Driver/SQLSrv/Connection.php index 0295db7e5b0..ba1c58c174e 100644 --- a/src/Driver/SQLSrv/Connection.php +++ b/src/Driver/SQLSrv/Connection.php @@ -97,7 +97,7 @@ public function lastInsertId($name = null) Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4687', - 'The usage of Connection::lastInsertId() with a sequence name is deprecated.' + 'The usage of Connection::lastInsertId() with a sequence name is deprecated.', ); $result = $this->prepare('SELECT CONVERT(VARCHAR(MAX), current_value) FROM sys.sequences WHERE name = ?') @@ -136,9 +136,7 @@ public function rollBack(): bool return true; } - /** - * @return resource - */ + /** @return resource */ public function getNativeConnection() { return $this->connection; diff --git a/src/Driver/SQLSrv/Result.php b/src/Driver/SQLSrv/Result.php index 0e24002cc26..db17e928d08 100644 --- a/src/Driver/SQLSrv/Result.php +++ b/src/Driver/SQLSrv/Result.php @@ -110,9 +110,7 @@ public function free(): void } } - /** - * @return mixed|false - */ + /** @return mixed|false */ private function fetch(int $fetchType) { return sqlsrv_fetch_array($this->statement, $fetchType) ?? false; diff --git a/src/Driver/SQLSrv/Statement.php b/src/Driver/SQLSrv/Statement.php index e5525482832..1244ba51a4a 100644 --- a/src/Driver/SQLSrv/Statement.php +++ b/src/Driver/SQLSrv/Statement.php @@ -93,7 +93,7 @@ public function bindValue($param, $value, $type = ParameterType::STRING): bool 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5558', 'Not passing $type to Statement::bindValue() is deprecated.' - . ' Pass the type corresponding to the parameter being bound.' + . ' Pass the type corresponding to the parameter being bound.', ); } @@ -114,7 +114,7 @@ public function bindParam($param, &$variable, $type = ParameterType::STRING, $le 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5563', '%s is deprecated. Use bindValue() instead.', - __METHOD__ + __METHOD__, ); assert(is_int($param)); @@ -124,7 +124,7 @@ public function bindParam($param, &$variable, $type = ParameterType::STRING, $le 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5558', 'Not passing $type to Statement::bindParam() is deprecated.' - . ' Pass the type corresponding to the parameter being bound.' + . ' Pass the type corresponding to the parameter being bound.', ); } @@ -147,7 +147,7 @@ public function execute($params = null): ResultInterface 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5556', 'Passing $params to Statement::execute() is deprecated. Bind parameters using' - . ' Statement::bindParam() or Statement::bindValue() instead.' + . ' Statement::bindParam() or Statement::bindValue() instead.', ); foreach ($params as $key => $val) { diff --git a/src/Event/ConnectionEventArgs.php b/src/Event/ConnectionEventArgs.php index ee5ae961d78..aa52ce89db3 100644 --- a/src/Event/ConnectionEventArgs.php +++ b/src/Event/ConnectionEventArgs.php @@ -17,9 +17,7 @@ public function __construct(Connection $connection) $this->connection = $connection; } - /** - * @return Connection - */ + /** @return Connection */ public function getConnection() { return $this->connection; diff --git a/src/Event/Listeners/OracleSessionInit.php b/src/Event/Listeners/OracleSessionInit.php index d6d1fd9d169..6949f6e544c 100644 --- a/src/Event/Listeners/OracleSessionInit.php +++ b/src/Event/Listeners/OracleSessionInit.php @@ -35,9 +35,7 @@ class OracleSessionInit implements EventSubscriber 'NLS_NUMERIC_CHARACTERS' => '.,', ]; - /** - * @param string[] $oracleSessionVars - */ + /** @param string[] $oracleSessionVars */ public function __construct(array $oracleSessionVars = []) { $this->_defaultSessionVars = array_merge($this->_defaultSessionVars, $oracleSessionVars); diff --git a/src/Event/Listeners/SQLSessionInit.php b/src/Event/Listeners/SQLSessionInit.php index f7a4e9129d3..09e0b19ce2f 100644 --- a/src/Event/Listeners/SQLSessionInit.php +++ b/src/Event/Listeners/SQLSessionInit.php @@ -15,9 +15,7 @@ class SQLSessionInit implements EventSubscriber /** @var string */ protected $sql; - /** - * @param string $sql - */ + /** @param string $sql */ public function __construct($sql) { $this->sql = $sql; diff --git a/src/Event/SchemaAlterTableAddColumnEventArgs.php b/src/Event/SchemaAlterTableAddColumnEventArgs.php index ef040176091..b3295dd7cff 100644 --- a/src/Event/SchemaAlterTableAddColumnEventArgs.php +++ b/src/Event/SchemaAlterTableAddColumnEventArgs.php @@ -30,25 +30,19 @@ public function __construct(Column $column, TableDiff $tableDiff, AbstractPlatfo $this->platform = $platform; } - /** - * @return Column - */ + /** @return Column */ public function getColumn() { return $this->column; } - /** - * @return TableDiff - */ + /** @return TableDiff */ public function getTableDiff() { return $this->tableDiff; } - /** - * @return AbstractPlatform - */ + /** @return AbstractPlatform */ public function getPlatform() { return $this->platform; @@ -68,7 +62,7 @@ public function addSql($sql) 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/3580', 'Passing multiple SQL statements as an array to SchemaAlterTableAddColumnEventaArrgs::addSql() ' . - 'is deprecated. Pass each statement as an individual argument instead.' + 'is deprecated. Pass each statement as an individual argument instead.', ); } @@ -77,9 +71,7 @@ public function addSql($sql) return $this; } - /** - * @return string[] - */ + /** @return string[] */ public function getSql() { return $this->sql; diff --git a/src/Event/SchemaAlterTableChangeColumnEventArgs.php b/src/Event/SchemaAlterTableChangeColumnEventArgs.php index 4c9d457c8ea..f9fa09618d8 100644 --- a/src/Event/SchemaAlterTableChangeColumnEventArgs.php +++ b/src/Event/SchemaAlterTableChangeColumnEventArgs.php @@ -29,25 +29,19 @@ public function __construct(ColumnDiff $columnDiff, TableDiff $tableDiff, Abstra $this->platform = $platform; } - /** - * @return ColumnDiff - */ + /** @return ColumnDiff */ public function getColumnDiff() { return $this->columnDiff; } - /** - * @return TableDiff - */ + /** @return TableDiff */ public function getTableDiff() { return $this->tableDiff; } - /** - * @return AbstractPlatform - */ + /** @return AbstractPlatform */ public function getPlatform() { return $this->platform; @@ -67,9 +61,7 @@ public function addSql($sql) return $this; } - /** - * @return string[] - */ + /** @return string[] */ public function getSql() { return $this->sql; diff --git a/src/Event/SchemaAlterTableEventArgs.php b/src/Event/SchemaAlterTableEventArgs.php index 26ba94194e9..ca7133b8d31 100644 --- a/src/Event/SchemaAlterTableEventArgs.php +++ b/src/Event/SchemaAlterTableEventArgs.php @@ -26,17 +26,13 @@ public function __construct(TableDiff $tableDiff, AbstractPlatform $platform) $this->platform = $platform; } - /** - * @return TableDiff - */ + /** @return TableDiff */ public function getTableDiff() { return $this->tableDiff; } - /** - * @return AbstractPlatform - */ + /** @return AbstractPlatform */ public function getPlatform() { return $this->platform; @@ -56,9 +52,7 @@ public function addSql($sql) return $this; } - /** - * @return string[] - */ + /** @return string[] */ public function getSql() { return $this->sql; diff --git a/src/Event/SchemaAlterTableRemoveColumnEventArgs.php b/src/Event/SchemaAlterTableRemoveColumnEventArgs.php index 58ec9086ce0..751fb5c8e01 100644 --- a/src/Event/SchemaAlterTableRemoveColumnEventArgs.php +++ b/src/Event/SchemaAlterTableRemoveColumnEventArgs.php @@ -29,25 +29,19 @@ public function __construct(Column $column, TableDiff $tableDiff, AbstractPlatfo $this->platform = $platform; } - /** - * @return Column - */ + /** @return Column */ public function getColumn() { return $this->column; } - /** - * @return TableDiff - */ + /** @return TableDiff */ public function getTableDiff() { return $this->tableDiff; } - /** - * @return AbstractPlatform - */ + /** @return AbstractPlatform */ public function getPlatform() { return $this->platform; @@ -67,9 +61,7 @@ public function addSql($sql) return $this; } - /** - * @return string[] - */ + /** @return string[] */ public function getSql() { return $this->sql; diff --git a/src/Event/SchemaAlterTableRenameColumnEventArgs.php b/src/Event/SchemaAlterTableRenameColumnEventArgs.php index c64c3389b57..e26634f7b5a 100644 --- a/src/Event/SchemaAlterTableRenameColumnEventArgs.php +++ b/src/Event/SchemaAlterTableRenameColumnEventArgs.php @@ -25,9 +25,7 @@ class SchemaAlterTableRenameColumnEventArgs extends SchemaEventArgs /** @var string[] */ private array $sql = []; - /** - * @param string $oldColumnName - */ + /** @param string $oldColumnName */ public function __construct($oldColumnName, Column $column, TableDiff $tableDiff, AbstractPlatform $platform) { $this->oldColumnName = $oldColumnName; @@ -36,33 +34,25 @@ public function __construct($oldColumnName, Column $column, TableDiff $tableDiff $this->platform = $platform; } - /** - * @return string - */ + /** @return string */ public function getOldColumnName() { return $this->oldColumnName; } - /** - * @return Column - */ + /** @return Column */ public function getColumn() { return $this->column; } - /** - * @return TableDiff - */ + /** @return TableDiff */ public function getTableDiff() { return $this->tableDiff; } - /** - * @return AbstractPlatform - */ + /** @return AbstractPlatform */ public function getPlatform() { return $this->platform; @@ -82,9 +72,7 @@ public function addSql($sql) return $this; } - /** - * @return string[] - */ + /** @return string[] */ public function getSql() { return $this->sql; diff --git a/src/Event/SchemaColumnDefinitionEventArgs.php b/src/Event/SchemaColumnDefinitionEventArgs.php index 0a55c71f1bf..922639ba881 100644 --- a/src/Event/SchemaColumnDefinitionEventArgs.php +++ b/src/Event/SchemaColumnDefinitionEventArgs.php @@ -53,41 +53,31 @@ public function setColumn(?Column $column = null) return $this; } - /** - * @return Column|null - */ + /** @return Column|null */ public function getColumn() { return $this->column; } - /** - * @return mixed[] - */ + /** @return mixed[] */ public function getTableColumn() { return $this->tableColumn; } - /** - * @return string - */ + /** @return string */ public function getTable() { return $this->table; } - /** - * @return string - */ + /** @return string */ public function getDatabase() { return $this->database; } - /** - * @return Connection - */ + /** @return Connection */ public function getConnection() { return $this->connection; diff --git a/src/Event/SchemaCreateTableColumnEventArgs.php b/src/Event/SchemaCreateTableColumnEventArgs.php index 25831e064fd..7161652d3ec 100644 --- a/src/Event/SchemaCreateTableColumnEventArgs.php +++ b/src/Event/SchemaCreateTableColumnEventArgs.php @@ -29,25 +29,19 @@ public function __construct(Column $column, Table $table, AbstractPlatform $plat $this->platform = $platform; } - /** - * @return Column - */ + /** @return Column */ public function getColumn() { return $this->column; } - /** - * @return Table - */ + /** @return Table */ public function getTable() { return $this->table; } - /** - * @return AbstractPlatform - */ + /** @return AbstractPlatform */ public function getPlatform() { return $this->platform; @@ -67,9 +61,7 @@ public function addSql($sql) return $this; } - /** - * @return string[] - */ + /** @return string[] */ public function getSql() { return $this->sql; diff --git a/src/Event/SchemaCreateTableEventArgs.php b/src/Event/SchemaCreateTableEventArgs.php index 964ce6e65bd..b0844c61d80 100644 --- a/src/Event/SchemaCreateTableEventArgs.php +++ b/src/Event/SchemaCreateTableEventArgs.php @@ -39,33 +39,25 @@ public function __construct(Table $table, array $columns, array $options, Abstra $this->platform = $platform; } - /** - * @return Table - */ + /** @return Table */ public function getTable() { return $this->table; } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public function getColumns() { return $this->columns; } - /** - * @return mixed[] - */ + /** @return mixed[] */ public function getOptions() { return $this->options; } - /** - * @return AbstractPlatform - */ + /** @return AbstractPlatform */ public function getPlatform() { return $this->platform; @@ -85,9 +77,7 @@ public function addSql($sql) return $this; } - /** - * @return string[] - */ + /** @return string[] */ public function getSql() { return $this->sql; diff --git a/src/Event/SchemaDropTableEventArgs.php b/src/Event/SchemaDropTableEventArgs.php index a02ea97c03e..e6f1eebc8a5 100644 --- a/src/Event/SchemaDropTableEventArgs.php +++ b/src/Event/SchemaDropTableEventArgs.php @@ -30,17 +30,13 @@ public function __construct($table, AbstractPlatform $platform) $this->platform = $platform; } - /** - * @return string|Table - */ + /** @return string|Table */ public function getTable() { return $this->table; } - /** - * @return AbstractPlatform - */ + /** @return AbstractPlatform */ public function getPlatform() { return $this->platform; @@ -58,9 +54,7 @@ public function setSql($sql) return $this; } - /** - * @return string|null - */ + /** @return string|null */ public function getSql() { return $this->sql; diff --git a/src/Event/SchemaEventArgs.php b/src/Event/SchemaEventArgs.php index 8ca32e24b35..18cb49f380a 100644 --- a/src/Event/SchemaEventArgs.php +++ b/src/Event/SchemaEventArgs.php @@ -11,9 +11,7 @@ class SchemaEventArgs extends EventArgs { private bool $preventDefault = false; - /** - * @return SchemaEventArgs - */ + /** @return SchemaEventArgs */ public function preventDefault() { $this->preventDefault = true; @@ -21,9 +19,7 @@ public function preventDefault() return $this; } - /** - * @return bool - */ + /** @return bool */ public function isDefaultPrevented() { return $this->preventDefault; diff --git a/src/Event/SchemaIndexDefinitionEventArgs.php b/src/Event/SchemaIndexDefinitionEventArgs.php index b1b33a3c82f..d9290aaec7e 100644 --- a/src/Event/SchemaIndexDefinitionEventArgs.php +++ b/src/Event/SchemaIndexDefinitionEventArgs.php @@ -47,33 +47,25 @@ public function setIndex(?Index $index = null) return $this; } - /** - * @return Index|null - */ + /** @return Index|null */ public function getIndex() { return $this->index; } - /** - * @return mixed[] - */ + /** @return mixed[] */ public function getTableIndex() { return $this->tableIndex; } - /** - * @return string - */ + /** @return string */ public function getTable() { return $this->table; } - /** - * @return Connection - */ + /** @return Connection */ public function getConnection() { return $this->connection; diff --git a/src/Exception.php b/src/Exception.php index b8d7804d5d3..6e3b22557be 100644 --- a/src/Exception.php +++ b/src/Exception.php @@ -12,9 +12,7 @@ use function spl_object_hash; use function sprintf; -/** - * @psalm-immutable - */ +/** @psalm-immutable */ class Exception extends \Exception { public static function notSupported(string $method): self @@ -22,9 +20,7 @@ public static function notSupported(string $method): self return new self(sprintf("Operation '%s' is not supported by platform.", $method)); } - /** - * @param mixed $invalidPlatform - */ + /** @param mixed $invalidPlatform */ public static function invalidPlatformType($invalidPlatform): self { if (is_object($invalidPlatform)) { @@ -32,8 +28,8 @@ public static function invalidPlatformType($invalidPlatform): self sprintf( "Option 'platform' must be a subtype of '%s', instance of '%s' given", AbstractPlatform::class, - get_class($invalidPlatform) - ) + get_class($invalidPlatform), + ), ); } @@ -41,8 +37,8 @@ public static function invalidPlatformType($invalidPlatform): self sprintf( "Option 'platform' must be an object and subtype of '%s'. Got '%s'", AbstractPlatform::class, - gettype($invalidPlatform) - ) + gettype($invalidPlatform), + ), ); } @@ -59,14 +55,12 @@ public static function invalidPlatformVersionSpecified(string $version, string $ 'Invalid platform version "%s" specified. ' . 'The platform version has to be specified in the format: "%s".', $version, - $expectedFormat - ) + $expectedFormat, + ), ); } - /** - * @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 driverRequired(?string $url = null): self { if ($url !== null) { @@ -74,8 +68,8 @@ public static function driverRequired(?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, + ), ); } @@ -83,9 +77,7 @@ public static function driverRequired(?string $url = null): self 'instance is given to DriverManager::getConnection().'); } - /** - * @param string[] $knownDrivers - */ + /** @param string[] $knownDrivers */ public static function unknownDriver(string $unknownDriverName, array $knownDrivers): self { return new self("The given 'driver' " . $unknownDriverName . ' is unknown, ' . @@ -101,7 +93,7 @@ public static function invalidWrapperClass(string $wrapperClass): self public static function invalidDriverClass(string $driverClass): self { return new self( - "The given 'driverClass' " . $driverClass . ' has to implement the ' . Driver::class . ' interface.' + "The given 'driverClass' " . $driverClass . ' has to implement the ' . Driver::class . ' interface.', ); } @@ -134,14 +126,14 @@ public static function typeNotFound(string $name): self public static function typeNotRegistered(Type $type): self { return new self( - sprintf('Type of the class %s@%s is not registered.', get_class($type), spl_object_hash($type)) + sprintf('Type of the class %s@%s is not registered.', get_class($type), spl_object_hash($type)), ); } public static function typeAlreadyRegistered(Type $type): self { return new self( - sprintf('Type of the class %s@%s is already registered.', get_class($type), spl_object_hash($type)) + sprintf('Type of the class %s@%s is already registered.', get_class($type), spl_object_hash($type)), ); } } diff --git a/src/Exception/ConnectionLost.php b/src/Exception/ConnectionLost.php index 46a4247576e..c45085839c6 100644 --- a/src/Exception/ConnectionLost.php +++ b/src/Exception/ConnectionLost.php @@ -2,9 +2,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 87eb1381acb..dc71c82cbaf 100644 --- a/src/Exception/DatabaseDoesNotExist.php +++ b/src/Exception/DatabaseDoesNotExist.php @@ -2,9 +2,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 d87ad3e655d..49b7326cd1f 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 diff --git a/src/Exception/InvalidArgumentException.php b/src/Exception/InvalidArgumentException.php index 0b06140740f..7f58510f01b 100644 --- a/src/Exception/InvalidArgumentException.php +++ b/src/Exception/InvalidArgumentException.php @@ -11,9 +11,7 @@ */ class InvalidArgumentException extends Exception { - /** - * @return self - */ + /** @return self */ public static function fromEmptyCriteria() { return new self('Empty criteria was used, expected non-empty criteria'); diff --git a/src/Exception/InvalidLockMode.php b/src/Exception/InvalidLockMode.php index 9a4d6c77bc9..f1780c45956 100644 --- a/src/Exception/InvalidLockMode.php +++ b/src/Exception/InvalidLockMode.php @@ -6,9 +6,7 @@ use function sprintf; -/** - * @psalm-immutable - */ +/** @psalm-immutable */ class InvalidLockMode extends Exception { public static function fromLockMode(int $lockMode): self @@ -17,8 +15,8 @@ public static function fromLockMode(int $lockMode): self sprintf( 'Lock mode %d is invalid. The valid values are LockMode::NONE, LockMode::OPTIMISTIC' . ', LockMode::PESSIMISTIC_READ and LockMode::PESSIMISTIC_WRITE', - $lockMode - ) + $lockMode, + ), ); } } diff --git a/src/Exception/NoKeyValue.php b/src/Exception/NoKeyValue.php index 34093704aa1..545ade3ec1f 100644 --- a/src/Exception/NoKeyValue.php +++ b/src/Exception/NoKeyValue.php @@ -18,8 +18,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/SchemaDoesNotExist.php b/src/Exception/SchemaDoesNotExist.php index cbb0658b840..de6fa5c006d 100644 --- a/src/Exception/SchemaDoesNotExist.php +++ b/src/Exception/SchemaDoesNotExist.php @@ -2,9 +2,7 @@ namespace Doctrine\DBAL\Exception; -/** - * @psalm-immutable - */ +/** @psalm-immutable */ class SchemaDoesNotExist extends DatabaseObjectNotFoundException { } diff --git a/src/ExpandArrayParameters.php b/src/ExpandArrayParameters.php index 9aa9a6e23d7..3d7046817d1 100644 --- a/src/ExpandArrayParameters.php +++ b/src/ExpandArrayParameters.php @@ -76,9 +76,7 @@ public function getSQL(): string return implode('', $this->convertedSQL); } - /** - * @return list - */ + /** @return list */ public function getParameters(): array { return $this->convertedParameteres; @@ -118,9 +116,7 @@ private function acceptParameter($key, $value): void $this->appendTypedParameter($value, $type - Connection::ARRAY_PARAM_OFFSET); } - /** - * @return array - */ + /** @return array */ public function getTypes(): array { return $this->convertedTypes; diff --git a/src/FetchMode.php b/src/FetchMode.php index 79fa6a3f378..4909bc623e3 100644 --- a/src/FetchMode.php +++ b/src/FetchMode.php @@ -9,8 +9,10 @@ class FetchMode { /** @link PDO::FETCH_ASSOC */ public const ASSOCIATIVE = 2; + /** @link PDO::FETCH_NUM */ public const NUMERIC = 3; + /** @link PDO::FETCH_COLUMN */ public const COLUMN = 7; } diff --git a/src/Id/TableGenerator.php b/src/Id/TableGenerator.php index dd818a321b4..7d7f210e219 100644 --- a/src/Id/TableGenerator.php +++ b/src/Id/TableGenerator.php @@ -85,7 +85,7 @@ public function __construct(Connection $conn, $generatorTableName = 'sequences') $this->conn = DriverManager::getConnection( $conn->getParams(), $conn->getConfiguration(), - $conn->getEventManager() + $conn->getEventManager(), ); $this->generatorTableName = $generatorTableName; @@ -147,7 +147,7 @@ public function nextValue($sequence) } else { $this->conn->insert( $this->generatorTableName, - ['sequence_name' => $sequence, 'sequence_value' => 1, 'sequence_increment_by' => 1] + ['sequence_name' => $sequence, 'sequence_value' => 1, 'sequence_increment_by' => 1], ); $value = 1; } @@ -159,7 +159,7 @@ public function nextValue($sequence) throw new Exception( 'Error occurred while generating ID with TableGenerator, aborted generation: ' . $e->getMessage(), 0, - $e + $e, ); } diff --git a/src/Id/TableGeneratorSchemaVisitor.php b/src/Id/TableGeneratorSchemaVisitor.php index f47c9a914be..9b4724ddfde 100644 --- a/src/Id/TableGeneratorSchemaVisitor.php +++ b/src/Id/TableGeneratorSchemaVisitor.php @@ -11,17 +11,13 @@ use Doctrine\DBAL\Schema\Visitor\Visitor; use Doctrine\Deprecations\Deprecation; -/** - * @deprecated - */ +/** @deprecated */ class TableGeneratorSchemaVisitor implements Visitor { /** @var string */ private $generatorTableName; - /** - * @param string $generatorTableName - */ + /** @param string $generatorTableName */ public function __construct($generatorTableName = 'sequences') { Deprecation::trigger( diff --git a/src/Logging/Connection.php b/src/Logging/Connection.php index 9ef5a661744..5ab111ec2f7 100644 --- a/src/Logging/Connection.php +++ b/src/Logging/Connection.php @@ -14,9 +14,7 @@ final class Connection extends AbstractConnectionMiddleware { private LoggerInterface $logger; - /** - * @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, LoggerInterface $logger) { parent::__construct($connection); @@ -34,7 +32,7 @@ public function prepare(string $sql): DriverStatement return new Statement( parent::prepare($sql), $this->logger, - $sql + $sql, ); } diff --git a/src/Logging/DebugStack.php b/src/Logging/DebugStack.php index 24a2d68cfbe..e8539e5841a 100644 --- a/src/Logging/DebugStack.php +++ b/src/Logging/DebugStack.php @@ -38,7 +38,7 @@ public function __construct() Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4967', - 'DebugStack is deprecated.' + 'DebugStack is deprecated.', ); } diff --git a/src/Logging/Driver.php b/src/Logging/Driver.php index 0ba2aef6265..10cea8f035f 100644 --- a/src/Logging/Driver.php +++ b/src/Logging/Driver.php @@ -12,9 +12,7 @@ final class Driver extends AbstractDriverMiddleware { private LoggerInterface $logger; - /** - * @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, LoggerInterface $logger) { parent::__construct($driver); @@ -31,7 +29,7 @@ public function connect(array $params) return new Connection( parent::connect($params), - $this->logger + $this->logger, ); } diff --git a/src/Logging/LoggerChain.php b/src/Logging/LoggerChain.php index c9c51bfbcbc..3c62a1d8e00 100644 --- a/src/Logging/LoggerChain.php +++ b/src/Logging/LoggerChain.php @@ -14,15 +14,13 @@ class LoggerChain implements SQLLogger /** @var iterable */ private iterable $loggers; - /** - * @param iterable $loggers - */ + /** @param iterable $loggers */ public function __construct(iterable $loggers = []) { Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4967', - 'LoggerChain is deprecated' + 'LoggerChain is deprecated', ); $this->loggers = $loggers; diff --git a/src/Logging/Statement.php b/src/Logging/Statement.php index 55d1d628c2b..95d60358678 100644 --- a/src/Logging/Statement.php +++ b/src/Logging/Statement.php @@ -26,9 +26,7 @@ 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, LoggerInterface $logger, string $sql) { parent::__construct($statement); @@ -48,7 +46,7 @@ public function bindParam($param, &$variable, $type = ParameterType::STRING, $le 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5563', '%s is deprecated. Use bindValue() instead.', - __METHOD__ + __METHOD__, ); if (func_num_args() < 3) { @@ -56,7 +54,7 @@ public function bindParam($param, &$variable, $type = ParameterType::STRING, $le 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5558', 'Not passing $type to Statement::bindParam() is deprecated.' - . ' Pass the type corresponding to the parameter being bound.' + . ' Pass the type corresponding to the parameter being bound.', ); } @@ -76,7 +74,7 @@ public function bindValue($param, $value, $type = ParameterType::STRING) 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5558', 'Not passing $type to Statement::bindValue() is deprecated.' - . ' Pass the type corresponding to the parameter being bound.' + . ' Pass the type corresponding to the parameter being bound.', ); } diff --git a/src/Platforms/AbstractMySQLPlatform.php b/src/Platforms/AbstractMySQLPlatform.php index 51c71166c9c..814f4c46094 100644 --- a/src/Platforms/AbstractMySQLPlatform.php +++ b/src/Platforms/AbstractMySQLPlatform.php @@ -76,7 +76,7 @@ public function getIdentifierQuoteCharacter() Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5388', - 'AbstractMySQLPlatform::getIdentifierQuoteCharacter() is deprecated. Use quoteIdentifier() instead.' + 'AbstractMySQLPlatform::getIdentifierQuoteCharacter() is deprecated. Use quoteIdentifier() instead.', ); return '`'; @@ -227,7 +227,7 @@ protected function getVarcharTypeDeclarationSQLSnippet($length, $fixed/*, $lengt 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/3263', 'Relying on the default string column length on MySQL is deprecated' - . ', specify the length explicitly.' + . ', specify the length explicitly.', ); } @@ -245,7 +245,7 @@ protected function getBinaryTypeDeclarationSQLSnippet($length, $fixed/*, $length 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/3263', 'Relying on the default binary column length on MySQL is deprecated' - . ', specify the length explicitly.' + . ', specify the length explicitly.', ); } @@ -333,7 +333,7 @@ public function prefersIdentityColumns() Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pulls/1519', - 'AbstractMySQLPlatform::prefersIdentityColumns() is deprecated.' + 'AbstractMySQLPlatform::prefersIdentityColumns() is deprecated.', ); return true; @@ -394,9 +394,7 @@ public function getListTableColumnsSQL($table, $database = null) ' ORDER BY ORDINAL_POSITION ASC'; } - /** - * @deprecated The SQL used for schema introspection is an implementation detail and should not be relied upon. - */ + /** @deprecated The SQL used for schema introspection is an implementation detail and should not be relied upon. */ public function getListTableMetadataSQL(string $table, ?string $database = null): string { return sprintf( @@ -414,7 +412,7 @@ public function getListTableMetadataSQL(string $table, ?string $database = null) SQL , $this->getDatabaseNameSQL($database), - $this->quoteStringLiteral($table) + $this->quoteStringLiteral($table), ); } @@ -434,7 +432,7 @@ public function getCreateTablesSQL(array $tables): array foreach ($table->getForeignKeys() as $foreignKey) { $sql[] = $this->getCreateForeignKeySQL( $foreignKey, - $table->getQuotedName($this) + $table->getQuotedName($this), ); } } elseif (count($table->getForeignKeys()) > 0) { @@ -442,7 +440,7 @@ public function getCreateTablesSQL(array $tables): array 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5414', 'Relying on the DBAL not generating DDL for foreign keys on MySQL engines' - . ' other than InnoDB is deprecated. Define foreign key constraints only if they are necessary.' + . ' other than InnoDB is deprecated. Define foreign key constraints only if they are necessary.', ); } } @@ -499,7 +497,7 @@ protected function _getCreateTableSQL($name, array $columns, array $options = [] 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5414', 'Relying on the DBAL not generating DDL for foreign keys on MySQL engines' - . ' other than InnoDB is deprecated. Define foreign key constraints only if they are necessary.' + . ' other than InnoDB is deprecated. Define foreign key constraints only if they are necessary.', ); } } @@ -546,7 +544,7 @@ private function buildTableOptions(array $options): string Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/5214', - 'The "collate" option is deprecated in favor of "collation" and will be removed in 4.0.' + 'The "collate" option is deprecated in favor of "collation" and will be removed in 4.0.', ); $options['collation'] = $options['collate']; } @@ -687,7 +685,7 @@ public function getAlterTableSQL(TableDiff $diff) $sql = array_merge( $this->getPreAlterTableIndexForeignKeySQL($diff), $sql, - $this->getPostAlterTableIndexForeignKeySQL($diff) + $this->getPostAlterTableIndexForeignKeySQL($diff), ); } @@ -751,7 +749,7 @@ protected function getPreAlterTableIndexForeignKeySQL(TableDiff $diff) $sql, $this->getPreAlterTableAlterIndexForeignKeySQL($diff), parent::getPreAlterTableIndexForeignKeySQL($diff), - $this->getPreAlterTableRenameIndexForeignKeySQL($diff) + $this->getPreAlterTableRenameIndexForeignKeySQL($diff), ); return $sql; @@ -877,7 +875,7 @@ private function getRemainingForeignKeyConstraintsRequiringRenamedIndexes(TableD /** @var ForeignKeyConstraint[] $remainingForeignKeys */ $remainingForeignKeys = array_diff_key( $diff->fromTable->getForeignKeys(), - $diff->removedForeignKeys + $diff->removedForeignKeys, ); foreach ($remainingForeignKeys as $foreignKey) { @@ -900,7 +898,7 @@ protected function getPostAlterTableIndexForeignKeySQL(TableDiff $diff) { return array_merge( parent::getPostAlterTableIndexForeignKeySQL($diff), - $this->getPostAlterTableRenameIndexForeignKeySQL($diff) + $this->getPostAlterTableRenameIndexForeignKeySQL($diff), ); } @@ -1058,7 +1056,7 @@ public function getDropIndexSQL($index, $table = null) 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4798', 'Passing $index as an Index object to %s is deprecated. Pass it as a quoted name instead.', - __METHOD__ + __METHOD__, ); $indexName = $index->getQuotedName($this); @@ -1066,7 +1064,7 @@ public function getDropIndexSQL($index, $table = null) $indexName = $index; } else { throw new InvalidArgumentException( - __METHOD__ . '() expects $index parameter to be string or ' . Index::class . '.' + __METHOD__ . '() expects $index parameter to be string or ' . Index::class . '.', ); } @@ -1075,13 +1073,13 @@ public function getDropIndexSQL($index, $table = null) 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4798', 'Passing $table as a Table object to %s is deprecated. Pass it as a quoted name instead.', - __METHOD__ + __METHOD__, ); $table = $table->getQuotedName($this); } elseif (! is_string($table)) { throw new InvalidArgumentException( - __METHOD__ . '() expects $table parameter to be string or ' . Table::class . '.' + __METHOD__ . '() expects $table parameter to be string or ' . Table::class . '.', ); } @@ -1130,7 +1128,7 @@ public function getName() Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4749', - 'AbstractMySQLPlatform::getName() is deprecated. Identify platforms by their class.' + 'AbstractMySQLPlatform::getName() is deprecated. Identify platforms by their class.', ); return 'mysql'; @@ -1193,7 +1191,7 @@ public function getVarcharMaxLength() Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/3263', - 'AbstractMySQLPlatform::getVarcharMaxLength() is deprecated.' + 'AbstractMySQLPlatform::getVarcharMaxLength() is deprecated.', ); return 65535; @@ -1209,7 +1207,7 @@ public function getBinaryMaxLength() Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/3263', - 'AbstractMySQLPlatform::getBinaryMaxLength() is deprecated.' + 'AbstractMySQLPlatform::getBinaryMaxLength() is deprecated.', ); return 65535; @@ -1226,7 +1224,7 @@ protected function getReservedKeywordsClass() 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4510', 'AbstractMySQLPlatform::getReservedKeywordsClass() is deprecated,' - . ' use AbstractMySQLPlatform::createReservedKeywordsList() instead.' + . ' use AbstractMySQLPlatform::createReservedKeywordsList() instead.', ); return Keywords\MySQLKeywords::class; @@ -1245,13 +1243,13 @@ public function getDropTemporaryTableSQL($table) 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4798', 'Passing $table as a Table object to %s is deprecated. Pass it as a quoted name instead.', - __METHOD__ + __METHOD__, ); $table = $table->getQuotedName($this); } elseif (! is_string($table)) { throw new InvalidArgumentException( - __METHOD__ . '() expects $table parameter to be string or ' . Table::class . '.' + __METHOD__ . '() expects $table parameter to be string or ' . Table::class . '.', ); } diff --git a/src/Platforms/AbstractPlatform.php b/src/Platforms/AbstractPlatform.php index 1e127f8ccd9..e61722a80db 100644 --- a/src/Platforms/AbstractPlatform.php +++ b/src/Platforms/AbstractPlatform.php @@ -267,7 +267,7 @@ public function getBinaryTypeDeclarationSQL(array $column) 'Binary column length %d is greater than supported by the platform (%d).' . ' Reduce the column length or use a BLOB column instead.', $column['length'], - $maxLength + $maxLength, ); } @@ -416,7 +416,7 @@ public function getDoctrineTypeMapping($dbType) if (! isset($this->doctrineTypeMapping[$dbType])) { throw new Exception( - 'Unknown database type ' . $dbType . ' requested, ' . static::class . ' may not support it.' + 'Unknown database type ' . $dbType . ' requested, ' . static::class . ' may not support it.', ); } @@ -454,7 +454,7 @@ protected function initializeCommentedDoctrineTypes() 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5058', '%s is deprecated and will be removed in Doctrine DBAL 4.0.', - __METHOD__ + __METHOD__, ); $this->doctrineTypeComments = []; @@ -483,7 +483,7 @@ public function isCommentedDoctrineType(Type $doctrineType) 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5058', '%s is deprecated and will be removed in Doctrine DBAL 4.0. Use Type::requiresSQLCommentHint() instead.', - __METHOD__ + __METHOD__, ); if ($this->doctrineTypeComments === null) { @@ -506,7 +506,7 @@ public function markDoctrineTypeCommented($doctrineType) 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5058', '%s is deprecated and will be removed in Doctrine DBAL 4.0. Use Type::requiresSQLCommentHint() instead.', - __METHOD__ + __METHOD__, ); if ($this->doctrineTypeComments === null) { @@ -531,7 +531,7 @@ public function getDoctrineTypeComment(Type $doctrineType) 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5107', '%s is deprecated and will be removed in Doctrine DBAL 4.0.', - __METHOD__ + __METHOD__, ); return '(DC2Type:' . $doctrineType->getName() . ')'; @@ -550,7 +550,7 @@ protected function getColumnComment(Column $column) 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5107', '%s is deprecated and will be removed in Doctrine DBAL 4.0.', - __METHOD__ + __METHOD__, ); $comment = $column->getComment(); @@ -574,7 +574,7 @@ public function getIdentifierQuoteCharacter() Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5388', - 'AbstractPlatform::getIdentifierQuoteCharacter() is deprecated. Use quoteIdentifier() instead.' + 'AbstractPlatform::getIdentifierQuoteCharacter() is deprecated. Use quoteIdentifier() instead.', ); return '"'; @@ -592,7 +592,7 @@ public function getSqlCommentStartString() Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pulls/4724', - 'AbstractPlatform::getSqlCommentStartString() is deprecated.' + 'AbstractPlatform::getSqlCommentStartString() is deprecated.', ); return '--'; @@ -610,7 +610,7 @@ public function getSqlCommentEndString() Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pulls/4724', - 'AbstractPlatform::getSqlCommentEndString() is deprecated.' + 'AbstractPlatform::getSqlCommentEndString() is deprecated.', ); return "\n"; @@ -626,7 +626,7 @@ public function getCharMaxLength(): int Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/3263', - 'AbstractPlatform::getCharMaxLength() is deprecated.' + 'AbstractPlatform::getCharMaxLength() is deprecated.', ); return $this->getVarcharMaxLength(); @@ -644,7 +644,7 @@ public function getVarcharMaxLength() Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/3263', - 'AbstractPlatform::getVarcharMaxLength() is deprecated.' + 'AbstractPlatform::getVarcharMaxLength() is deprecated.', ); return 4000; @@ -662,7 +662,7 @@ public function getVarcharDefaultLength() Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/3263', - 'Relying on the default varchar column length is deprecated, specify the length explicitly.' + 'Relying on the default varchar column length is deprecated, specify the length explicitly.', ); return 255; @@ -680,7 +680,7 @@ public function getBinaryMaxLength() Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/3263', - 'AbstractPlatform::getBinaryMaxLength() is deprecated.' + 'AbstractPlatform::getBinaryMaxLength() is deprecated.', ); return 4000; @@ -698,7 +698,7 @@ public function getBinaryDefaultLength() Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/3263', - 'Relying on the default binary column length is deprecated, specify the length explicitly.' + 'Relying on the default binary column length is deprecated, specify the length explicitly.', ); return 255; @@ -717,7 +717,7 @@ public function getWildcards() 'doctrine/dbal', 'https://github.com/doctrine/dbal/pulls/4724', 'AbstractPlatform::getWildcards() is deprecated.' - . ' Use AbstractPlatform::getLikeWildcardCharacters() instead.' + . ' Use AbstractPlatform::getLikeWildcardCharacters() instead.', ); return ['%', '_']; @@ -749,7 +749,7 @@ public function getAvgExpression($column) Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pulls/4724', - 'AbstractPlatform::getAvgExpression() is deprecated. Use AVG() in SQL instead.' + 'AbstractPlatform::getAvgExpression() is deprecated. Use AVG() in SQL instead.', ); return 'AVG(' . $column . ')'; @@ -771,7 +771,7 @@ public function getCountExpression($column) Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pulls/4724', - 'AbstractPlatform::getCountExpression() is deprecated. Use COUNT() in SQL instead.' + 'AbstractPlatform::getCountExpression() is deprecated. Use COUNT() in SQL instead.', ); return 'COUNT(' . $column . ')'; @@ -791,7 +791,7 @@ public function getMaxExpression($column) Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pulls/4724', - 'AbstractPlatform::getMaxExpression() is deprecated. Use MAX() in SQL instead.' + 'AbstractPlatform::getMaxExpression() is deprecated. Use MAX() in SQL instead.', ); return 'MAX(' . $column . ')'; @@ -811,7 +811,7 @@ public function getMinExpression($column) Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pulls/4724', - 'AbstractPlatform::getMinExpression() is deprecated. Use MIN() in SQL instead.' + 'AbstractPlatform::getMinExpression() is deprecated. Use MIN() in SQL instead.', ); return 'MIN(' . $column . ')'; @@ -831,7 +831,7 @@ public function getSumExpression($column) Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pulls/4724', - 'AbstractPlatform::getSumExpression() is deprecated. Use SUM() in SQL instead.' + 'AbstractPlatform::getSumExpression() is deprecated. Use SUM() in SQL instead.', ); return 'SUM(' . $column . ')'; @@ -855,7 +855,7 @@ public function getMd5Expression($column) Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pulls/4724', - 'AbstractPlatform::getMd5Expression() is deprecated.' + 'AbstractPlatform::getMd5Expression() is deprecated.', ); return 'MD5(' . $column . ')'; @@ -887,7 +887,7 @@ public function getSqrtExpression($column) Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pulls/4724', - 'AbstractPlatform::getSqrtExpression() is deprecated. Use SQRT() in SQL instead.' + 'AbstractPlatform::getSqrtExpression() is deprecated. Use SQRT() in SQL instead.', ); return 'SQRT(' . $column . ')'; @@ -908,7 +908,7 @@ public function getRoundExpression($column, $decimals = 0) Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pulls/4724', - 'AbstractPlatform::getRoundExpression() is deprecated. Use ROUND() in SQL instead.' + 'AbstractPlatform::getRoundExpression() is deprecated. Use ROUND() in SQL instead.', ); return 'ROUND(' . $column . ', ' . $decimals . ')'; @@ -979,7 +979,7 @@ public function getRtrimExpression($str) Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pulls/4724', - 'AbstractPlatform::getRtrimExpression() is deprecated. Use RTRIM() in SQL instead.' + 'AbstractPlatform::getRtrimExpression() is deprecated. Use RTRIM() in SQL instead.', ); return 'RTRIM(' . $str . ')'; @@ -999,7 +999,7 @@ public function getLtrimExpression($str) Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pulls/4724', - 'AbstractPlatform::getLtrimExpression() is deprecated. Use LTRIM() in SQL instead.' + 'AbstractPlatform::getLtrimExpression() is deprecated. Use LTRIM() in SQL instead.', ); return 'LTRIM(' . $str . ')'; @@ -1020,7 +1020,7 @@ public function getUpperExpression($str) Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pulls/4724', - 'AbstractPlatform::getUpperExpression() is deprecated. Use UPPER() in SQL instead.' + 'AbstractPlatform::getUpperExpression() is deprecated. Use UPPER() in SQL instead.', ); return 'UPPER(' . $str . ')'; @@ -1041,7 +1041,7 @@ public function getLowerExpression($str) Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pulls/4724', - 'AbstractPlatform::getLowerExpression() is deprecated. Use LOWER() in SQL instead.' + 'AbstractPlatform::getLowerExpression() is deprecated. Use LOWER() in SQL instead.', ); return 'LOWER(' . $str . ')'; @@ -1075,7 +1075,7 @@ public function getNowExpression() Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4753', - 'AbstractPlatform::getNowExpression() is deprecated. Generate dates within the application.' + 'AbstractPlatform::getNowExpression() is deprecated. Generate dates within the application.', ); return 'NOW()'; @@ -1137,7 +1137,7 @@ public function getNotExpression($expression) Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pulls/4724', - 'AbstractPlatform::getNotExpression() is deprecated. Use NOT() in SQL instead.' + 'AbstractPlatform::getNotExpression() is deprecated. Use NOT() in SQL instead.', ); return 'NOT(' . $expression . ')'; @@ -1157,7 +1157,7 @@ public function getIsNullExpression($expression) Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pulls/4724', - 'AbstractPlatform::getIsNullExpression() is deprecated. Use IS NULL in SQL instead.' + 'AbstractPlatform::getIsNullExpression() is deprecated. Use IS NULL in SQL instead.', ); return $expression . ' IS NULL'; @@ -1177,7 +1177,7 @@ public function getIsNotNullExpression($expression) Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pulls/4724', - 'AbstractPlatform::getIsNotNullExpression() is deprecated. Use IS NOT NULL in SQL instead.' + 'AbstractPlatform::getIsNotNullExpression() is deprecated. Use IS NOT NULL in SQL instead.', ); return $expression . ' IS NOT NULL'; @@ -1205,7 +1205,7 @@ public function getBetweenExpression($expression, $value1, $value2) Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pulls/4724', - 'AbstractPlatform::getBetweenExpression() is deprecated. Use BETWEEN in SQL instead.' + 'AbstractPlatform::getBetweenExpression() is deprecated. Use BETWEEN in SQL instead.', ); return $expression . ' BETWEEN ' . $value1 . ' AND ' . $value2; @@ -1225,7 +1225,7 @@ public function getAcosExpression($value) Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pulls/4724', - 'AbstractPlatform::getAcosExpression() is deprecated. Use ACOS() in SQL instead.' + 'AbstractPlatform::getAcosExpression() is deprecated. Use ACOS() in SQL instead.', ); return 'ACOS(' . $value . ')'; @@ -1245,7 +1245,7 @@ public function getSinExpression($value) Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pulls/4724', - 'AbstractPlatform::getSinExpression() is deprecated. Use SIN() in SQL instead.' + 'AbstractPlatform::getSinExpression() is deprecated. Use SIN() in SQL instead.', ); return 'SIN(' . $value . ')'; @@ -1263,7 +1263,7 @@ public function getPiExpression() Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pulls/4724', - 'AbstractPlatform::getPiExpression() is deprecated. Use PI() in SQL instead.' + 'AbstractPlatform::getPiExpression() is deprecated. Use PI() in SQL instead.', ); return 'PI()'; @@ -1283,7 +1283,7 @@ public function getCosExpression($value) Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pulls/4724', - 'AbstractPlatform::getCosExpression() is deprecated. Use COS() in SQL instead.' + 'AbstractPlatform::getCosExpression() is deprecated. Use COS() in SQL instead.', ); return 'COS(' . $value . ')'; @@ -1322,7 +1322,7 @@ public function getDateAddSecondsExpression($date, $seconds) Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/3498', - 'Passing $seconds as an integer is deprecated. Pass it as a numeric string instead.' + 'Passing $seconds as an integer is deprecated. Pass it as a numeric string instead.', ); } @@ -1345,7 +1345,7 @@ public function getDateSubSecondsExpression($date, $seconds) Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/3498', - 'Passing $seconds as an integer is deprecated. Pass it as a numeric string instead.' + 'Passing $seconds as an integer is deprecated. Pass it as a numeric string instead.', ); } @@ -1368,7 +1368,7 @@ public function getDateAddMinutesExpression($date, $minutes) Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/3498', - 'Passing $minutes as an integer is deprecated. Pass it as a numeric string instead.' + 'Passing $minutes as an integer is deprecated. Pass it as a numeric string instead.', ); } @@ -1391,7 +1391,7 @@ public function getDateSubMinutesExpression($date, $minutes) Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/3498', - 'Passing $minutes as an integer is deprecated. Pass it as a numeric string instead.' + 'Passing $minutes as an integer is deprecated. Pass it as a numeric string instead.', ); } @@ -1414,7 +1414,7 @@ public function getDateAddHourExpression($date, $hours) Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/3498', - 'Passing $hours as an integer is deprecated. Pass it as a numeric string instead.' + 'Passing $hours as an integer is deprecated. Pass it as a numeric string instead.', ); } @@ -1437,7 +1437,7 @@ public function getDateSubHourExpression($date, $hours) Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/3498', - 'Passing $hours as an integer is deprecated. Pass it as a numeric string instead.' + 'Passing $hours as an integer is deprecated. Pass it as a numeric string instead.', ); } @@ -1460,7 +1460,7 @@ public function getDateAddDaysExpression($date, $days) Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/3498', - 'Passing $days as an integer is deprecated. Pass it as a numeric string instead.' + 'Passing $days as an integer is deprecated. Pass it as a numeric string instead.', ); } @@ -1483,7 +1483,7 @@ public function getDateSubDaysExpression($date, $days) Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/3498', - 'Passing $days as an integer is deprecated. Pass it as a numeric string instead.' + 'Passing $days as an integer is deprecated. Pass it as a numeric string instead.', ); } @@ -1506,7 +1506,7 @@ public function getDateAddWeeksExpression($date, $weeks) Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/3498', - 'Passing $weeks as an integer is deprecated. Pass it as a numeric string instead.' + 'Passing $weeks as an integer is deprecated. Pass it as a numeric string instead.', ); } @@ -1529,7 +1529,7 @@ public function getDateSubWeeksExpression($date, $weeks) Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/3498', - 'Passing $weeks as an integer is deprecated. Pass it as a numeric string instead.' + 'Passing $weeks as an integer is deprecated. Pass it as a numeric string instead.', ); } @@ -1552,7 +1552,7 @@ public function getDateAddMonthExpression($date, $months) Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/3498', - 'Passing $months as an integer is deprecated. Pass it as a numeric string instead.' + 'Passing $months as an integer is deprecated. Pass it as a numeric string instead.', ); } @@ -1575,7 +1575,7 @@ public function getDateSubMonthExpression($date, $months) Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/3498', - 'Passing $months as an integer is deprecated. Pass it as a numeric string instead.' + 'Passing $months as an integer is deprecated. Pass it as a numeric string instead.', ); } @@ -1598,7 +1598,7 @@ public function getDateAddQuartersExpression($date, $quarters) Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/3498', - 'Passing $quarters as an integer is deprecated. Pass it as a numeric string instead.' + 'Passing $quarters as an integer is deprecated. Pass it as a numeric string instead.', ); } @@ -1621,7 +1621,7 @@ public function getDateSubQuartersExpression($date, $quarters) Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/3498', - 'Passing $quarters as an integer is deprecated. Pass it as a numeric string instead.' + 'Passing $quarters as an integer is deprecated. Pass it as a numeric string instead.', ); } @@ -1644,7 +1644,7 @@ public function getDateAddYearsExpression($date, $years) Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/3498', - 'Passing $years as an integer is deprecated. Pass it as a numeric string instead.' + 'Passing $years as an integer is deprecated. Pass it as a numeric string instead.', ); } @@ -1667,7 +1667,7 @@ public function getDateSubYearsExpression($date, $years) Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/3498', - 'Passing $years as an integer is deprecated. Pass it as a numeric string instead.' + 'Passing $years as an integer is deprecated. Pass it as a numeric string instead.', ); } @@ -1799,7 +1799,7 @@ public function getDropTableSQL($table) 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4798', 'Passing $table as a Table object to %s is deprecated. Pass it as a quoted name instead.', - __METHOD__ + __METHOD__, ); $table = $table->getQuotedName($this); @@ -1807,7 +1807,7 @@ public function getDropTableSQL($table) if (! is_string($table)) { throw new InvalidArgumentException( - __METHOD__ . '() expects $table parameter to be string or ' . Table::class . '.' + __METHOD__ . '() expects $table parameter to be string or ' . Table::class . '.', ); } @@ -1843,7 +1843,7 @@ public function getDropTemporaryTableSQL($table) 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4798', 'Passing $table as a Table object to %s is deprecated. Pass it as a quoted name instead.', - __METHOD__ + __METHOD__, ); $table = $table->getQuotedName($this); @@ -1869,13 +1869,13 @@ public function getDropIndexSQL($index, $table = null) 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4798', 'Passing $index as an Index object to %s is deprecated. Pass it as a quoted name instead.', - __METHOD__ + __METHOD__, ); $index = $index->getQuotedName($this); } elseif (! is_string($index)) { throw new InvalidArgumentException( - __METHOD__ . '() expects $index parameter to be string or ' . Index::class . '.' + __METHOD__ . '() expects $index parameter to be string or ' . Index::class . '.', ); } @@ -1899,7 +1899,7 @@ public function getDropConstraintSQL($constraint, $table) 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4798', 'Passing $constraint as a Constraint object to %s is deprecated. Pass it as a quoted name instead.', - __METHOD__ + __METHOD__, ); } else { $constraint = new Identifier($constraint); @@ -1910,7 +1910,7 @@ public function getDropConstraintSQL($constraint, $table) 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4798', 'Passing $table as a Table object to %s is deprecated. Pass it as a quoted name instead.', - __METHOD__ + __METHOD__, ); } else { $table = new Identifier($table); @@ -1938,7 +1938,7 @@ public function getDropForeignKeySQL($foreignKey, $table) 'https://github.com/doctrine/dbal/issues/4798', 'Passing $foreignKey as a ForeignKeyConstraint object to %s is deprecated.' . ' Pass it as a quoted name instead.', - __METHOD__ + __METHOD__, ); } else { $foreignKey = new Identifier($foreignKey); @@ -1949,7 +1949,7 @@ public function getDropForeignKeySQL($foreignKey, $table) 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4798', 'Passing $table as a Table object to %s is deprecated. Pass it as a quoted name instead.', - __METHOD__ + __METHOD__, ); } else { $table = new Identifier($table); @@ -1985,7 +1985,7 @@ public function getCreateTableSQL(Table $table, $createFlags = self::CREATE_INDE { if (! is_int($createFlags)) { throw new InvalidArgumentException( - 'Second argument of AbstractPlatform::getCreateTableSQL() has to be integer.' + 'Second argument of AbstractPlatform::getCreateTableSQL() has to be integer.', ); } @@ -1993,7 +1993,7 @@ public function getCreateTableSQL(Table $table, $createFlags = self::CREATE_INDE Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5416', - 'Unsetting the CREATE_INDEXES flag in AbstractPlatform::getCreateTableSQL() is deprecated.' + 'Unsetting the CREATE_INDEXES flag in AbstractPlatform::getCreateTableSQL() is deprecated.', ); } @@ -2003,14 +2003,14 @@ public function getCreateTableSQL(Table $table, $createFlags = self::CREATE_INDE 'https://github.com/doctrine/dbal/pull/5416', 'Not setting the CREATE_FOREIGNKEYS flag in AbstractPlatform::getCreateTableSQL()' . ' is deprecated. In order to build the statements that create multiple tables' - . ' referencing each other via foreign keys, use AbstractPlatform::getCreateTablesSQL().' + . ' referencing each other via foreign keys, use AbstractPlatform::getCreateTablesSQL().', ); } return $this->buildCreateTableSQL( $table, ($createFlags & self::CREATE_INDEXES) > 0, - ($createFlags & self::CREATE_FOREIGNKEYS) > 0 + ($createFlags & self::CREATE_FOREIGNKEYS) > 0, ); } @@ -2146,7 +2146,7 @@ public function getCreateTablesSQL(array $tables): array foreach ($table->getForeignKeys() as $foreignKey) { $sql[] = $this->getCreateForeignKeySQL( $foreignKey, - $table->getQuotedName($this) + $table->getQuotedName($this), ); } } @@ -2167,7 +2167,7 @@ public function getDropTablesSQL(array $tables): array foreach ($table->getForeignKeys() as $foreignKey) { $sql[] = $this->getDropForeignKeySQL( $foreignKey->getQuotedName($this), - $table->getQuotedName($this) + $table->getQuotedName($this), ); } } @@ -2186,7 +2186,7 @@ protected function getCommentOnTableSQL(string $tableName, ?string $comment): st return sprintf( 'COMMENT ON TABLE %s IS %s', $tableName->getQuotedName($this), - $this->quoteStringLiteral((string) $comment) + $this->quoteStringLiteral((string) $comment), ); } @@ -2206,7 +2206,7 @@ public function getCommentOnColumnSQL($tableName, $columnName, $comment) 'COMMENT ON COLUMN %s.%s IS %s', $tableName->getQuotedName($this), $columnName->getQuotedName($this), - $this->quoteStringLiteral((string) $comment) + $this->quoteStringLiteral((string) $comment), ); } @@ -2277,9 +2277,7 @@ protected function _getCreateTableSQL($name, array $columns, array $options = [] return $sql; } - /** - * @return string - */ + /** @return string */ public function getCreateTemporaryTableSnippetSQL() { return 'CREATE TEMPORARY TABLE'; @@ -2329,7 +2327,7 @@ public function getDropSequenceSQL($sequence) 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4798', 'Passing $sequence as a Sequence object to %s is deprecated. Pass it as a quoted name instead.', - __METHOD__ + __METHOD__, ); $sequence = $sequence->getQuotedName($this); @@ -2357,7 +2355,7 @@ public function getCreateConstraintSQL(Constraint $constraint, $table) 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4798', 'Passing $table as a Table object to %s is deprecated. Pass it as a quoted name instead.', - __METHOD__ + __METHOD__, ); $table = $table->getQuotedName($this); @@ -2375,7 +2373,7 @@ public function getCreateConstraintSQL(Constraint $constraint, $table) $query .= ' UNIQUE'; } else { throw new InvalidArgumentException( - 'Can only create primary or unique constraints, no common indexes with getCreateConstraintSQL().' + 'Can only create primary or unique constraints, no common indexes with getCreateConstraintSQL().', ); } } elseif ($constraint instanceof UniqueConstraint) { @@ -2408,7 +2406,7 @@ public function getCreateIndexSQL(Index $index, $table) 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4798', 'Passing $table as a Table object to %s is deprecated. Pass it as a quoted name instead.', - __METHOD__ + __METHOD__, ); $table = $table->getQuotedName($this); @@ -2469,7 +2467,7 @@ public function getCreatePrimaryKeySQL(Index $index, $table) 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4798', 'Passing $table as a Table object to %s is deprecated. Pass it as a quoted name instead.', - __METHOD__ + __METHOD__, ); $table = $table->getQuotedName($this); @@ -2571,7 +2569,7 @@ public function getCreateForeignKeySQL(ForeignKeyConstraint $foreignKey, $table) 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4798', 'Passing $table as a Table object to %s is deprecated. Pass it as a quoted name instead.', - __METHOD__ + __METHOD__, ); $table = $table->getQuotedName($this); @@ -2710,9 +2708,7 @@ protected function onSchemaAlterTable(TableDiff $diff, &$sql) return $eventArgs->isDefaultPrevented(); } - /** - * @return string[] - */ + /** @return string[] */ protected function getPreAlterTableIndexForeignKeySQL(TableDiff $diff) { $tableName = $diff->getName($this)->getQuotedName($this); @@ -2743,9 +2739,7 @@ protected function getPreAlterTableIndexForeignKeySQL(TableDiff $diff) return $sql; } - /** - * @return string[] - */ + /** @return string[] */ protected function getPostAlterTableIndexForeignKeySQL(TableDiff $diff) { $sql = []; @@ -2779,7 +2773,7 @@ protected function getPostAlterTableIndexForeignKeySQL(TableDiff $diff) $oldIndexName = new Identifier($oldIndexName); $sql = array_merge( $sql, - $this->getRenameIndexSQL($oldIndexName->getQuotedName($this), $index, $tableName) + $this->getRenameIndexSQL($oldIndexName->getQuotedName($this), $index, $tableName), ); } @@ -3067,7 +3061,7 @@ public function getCustomTypeDeclarationSQL(array $column) 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5527', '%s is deprecated.', - __METHOD__ + __METHOD__, ); return $column['columnDefinition']; @@ -3085,7 +3079,7 @@ public function getIndexFieldDeclarationListSQL(Index $index): string 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5527', '%s is deprecated.', - __METHOD__ + __METHOD__, ); return implode(', ', $index->getQuotedColumns($this)); @@ -3105,7 +3099,7 @@ public function getColumnsFieldDeclarationListSQL(array $columns): string 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5527', '%s is deprecated.', - __METHOD__ + __METHOD__, ); $ret = []; @@ -3142,7 +3136,7 @@ public function getTemporaryTableSQL() Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pulls/4724', - 'AbstractPlatform::getTemporaryTableSQL() is deprecated.' + 'AbstractPlatform::getTemporaryTableSQL() is deprecated.', ); return 'TEMPORARY'; @@ -3271,7 +3265,7 @@ public function getUniqueFieldDeclarationSQL() Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pulls/4724', - 'AbstractPlatform::getUniqueFieldDeclarationSQL() is deprecated. Use UNIQUE in SQL instead.' + 'AbstractPlatform::getUniqueFieldDeclarationSQL() is deprecated. Use UNIQUE in SQL instead.', ); return 'UNIQUE'; @@ -3318,7 +3312,7 @@ public function prefersIdentityColumns() Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pulls/1519', - 'AbstractPlatform::prefersIdentityColumns() is deprecated.' + 'AbstractPlatform::prefersIdentityColumns() is deprecated.', ); return false; @@ -3470,7 +3464,7 @@ public function getListNamespacesSQL() 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4503', 'AbstractPlatform::getListNamespacesSQL() is deprecated,' - . ' use AbstractSchemaManager::listSchemaNames() instead.' + . ' use AbstractSchemaManager::listSchemaNames() instead.', ); throw Exception::notSupported(__METHOD__); @@ -3543,7 +3537,7 @@ public function getListUsersSQL() Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pulls/4724', - 'AbstractPlatform::getListUsersSQL() is deprecated.' + 'AbstractPlatform::getListUsersSQL() is deprecated.', ); throw Exception::notSupported(__METHOD__); @@ -3805,7 +3799,7 @@ public function usesSequenceEmulatedIdentityColumns() 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5513', '%s is deprecated.', - __METHOD__ + __METHOD__, ); return false; @@ -3842,7 +3836,7 @@ public function supportsIndexes() Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pulls/4724', - 'AbstractPlatform::supportsIndexes() is deprecated.' + 'AbstractPlatform::supportsIndexes() is deprecated.', ); return true; @@ -3878,7 +3872,7 @@ public function supportsAlterTable() Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pulls/4724', - 'AbstractPlatform::supportsAlterTable() is deprecated. All platforms must implement altering tables.' + 'AbstractPlatform::supportsAlterTable() is deprecated. All platforms must implement altering tables.', ); return true; @@ -3896,7 +3890,7 @@ public function supportsTransactions() Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pulls/4724', - 'AbstractPlatform::supportsTransactions() is deprecated.' + 'AbstractPlatform::supportsTransactions() is deprecated.', ); return true; @@ -3934,7 +3928,7 @@ public function supportsPrimaryConstraints() Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pulls/4724', - 'AbstractPlatform::supportsPrimaryConstraints() is deprecated.' + 'AbstractPlatform::supportsPrimaryConstraints() is deprecated.', ); return true; @@ -3952,7 +3946,7 @@ public function supportsForeignKeyConstraints() Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5409', - 'AbstractPlatform::supportsForeignKeyConstraints() is deprecated.' + 'AbstractPlatform::supportsForeignKeyConstraints() is deprecated.', ); return true; @@ -3983,7 +3977,7 @@ public function canEmulateSchemas() Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4805', - 'AbstractPlatform::canEmulateSchemas() is deprecated.' + 'AbstractPlatform::canEmulateSchemas() is deprecated.', ); return false; @@ -4018,7 +4012,7 @@ public function supportsCreateDropDatabase() 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5513', '%s is deprecated.', - __METHOD__ + __METHOD__, ); return true; @@ -4036,7 +4030,7 @@ public function supportsGettingAffectedRows() Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pulls/4724', - 'AbstractPlatform::supportsGettingAffectedRows() is deprecated.' + 'AbstractPlatform::supportsGettingAffectedRows() is deprecated.', ); return true; @@ -4075,7 +4069,7 @@ public function hasNativeGuidType() 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5509', '%s is deprecated.', - __METHOD__ + __METHOD__, ); return false; @@ -4094,7 +4088,7 @@ public function hasNativeJsonType() 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5509', '%s is deprecated.', - __METHOD__ + __METHOD__, ); return false; @@ -4112,7 +4106,7 @@ public function supportsViews() Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pulls/4724', - 'AbstractPlatform::supportsViews() is deprecated. All platforms must implement support for views.' + 'AbstractPlatform::supportsViews() is deprecated. All platforms must implement support for views.', ); return true; @@ -4186,14 +4180,14 @@ final public function modifyLimitQuery($query, $limit, $offset = 0): string if ($offset < 0) { throw new Exception(sprintf( 'Offset must be a positive integer or zero, %d given', - $offset + $offset, )); } if ($offset > 0 && ! $this->supportsLimitOffset()) { throw new Exception(sprintf( 'Platform %s does not support offset values in limit queries.', - $this->getName() + $this->getName(), )); } @@ -4239,7 +4233,7 @@ public function supportsLimitOffset() 'doctrine/dbal', 'https://github.com/doctrine/dbal/pulls/4724', 'AbstractPlatform::supportsViews() is deprecated.' - . ' All platforms must implement support for offsets in modify limit clauses.' + . ' All platforms must implement support for offsets in modify limit clauses.', ); return true; @@ -4379,7 +4373,7 @@ protected function getReservedKeywordsClass() 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4510', 'AbstractPlatform::getReservedKeywordsClass() is deprecated,' - . ' use AbstractPlatform::createReservedKeywordsList() instead.' + . ' use AbstractPlatform::createReservedKeywordsList() instead.', ); throw Exception::notSupported(__METHOD__); @@ -4415,7 +4409,7 @@ public function getStringLiteralQuoteCharacter() 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5388', 'AbstractPlatform::getStringLiteralQuoteCharacter() is deprecated.' - . ' Use quoteStringLiteral() instead.' + . ' Use quoteStringLiteral() instead.', ); return "'"; @@ -4434,7 +4428,7 @@ final public function escapeStringForLike(string $inputString, string $escapeCha return preg_replace( '~([' . preg_quote($this->getLikeWildcardCharacters() . $escapeChar, '~') . '])~u', addcslashes($escapeChar, '\\') . '$1', - $inputString + $inputString, ); } @@ -4453,9 +4447,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 f847c090637..59c9be956f5 100644 --- a/src/Platforms/DB2Platform.php +++ b/src/Platforms/DB2Platform.php @@ -35,7 +35,7 @@ public function getCharMaxLength(): int Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/3263', - 'DB2Platform::getCharMaxLength() is deprecated.' + 'DB2Platform::getCharMaxLength() is deprecated.', ); return 254; @@ -51,7 +51,7 @@ public function getBinaryMaxLength() Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/3263', - 'DB2Platform::getBinaryMaxLength() is deprecated.' + 'DB2Platform::getBinaryMaxLength() is deprecated.', ); return 32704; @@ -67,7 +67,7 @@ public function getBinaryDefaultLength() Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/3263', - 'Relying on the default binary column length is deprecated, specify the length explicitly.' + 'Relying on the default binary column length is deprecated, specify the length explicitly.', ); return 1; @@ -128,7 +128,7 @@ public function isCommentedDoctrineType(Type $doctrineType) 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5058', '%s is deprecated and will be removed in Doctrine DBAL 4.0. Use Type::requiresSQLCommentHint() instead.', - __METHOD__ + __METHOD__, ); if ($doctrineType->getName() === Types::BOOLEAN) { @@ -150,7 +150,7 @@ protected function getVarcharTypeDeclarationSQLSnippet($length, $fixed/*, $lengt 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/3263', 'Relying on the default string column length on IBM DB2 is deprecated' - . ', specify the length explicitly.' + . ', specify the length explicitly.', ); } @@ -168,7 +168,7 @@ protected function getBinaryTypeDeclarationSQLSnippet($length, $fixed/*, $length 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/3263', 'Relying on the default binary column length on IBM DB2 is deprecated' - . ', specify the length explicitly.' + . ', specify the length explicitly.', ); } @@ -192,7 +192,7 @@ public function getName() Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4749', - 'DB2Platform::getName() is deprecated. Identify platforms by their class.' + 'DB2Platform::getName() is deprecated. Identify platforms by their class.', ); return 'db2'; @@ -477,7 +477,7 @@ public function supportsCreateDropDatabase() 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5513', '%s is deprecated.', - __METHOD__ + __METHOD__, ); return false; @@ -587,7 +587,7 @@ public function getAlterTableSQL(TableDiff $diff) $commentsSQL[] = $this->getCommentOnColumnSQL( $diff->getName($this)->getQuotedName($this), $column->getQuotedName($this), - $comment + $comment, ); } @@ -608,7 +608,7 @@ public function getAlterTableSQL(TableDiff $diff) $commentsSQL[] = $this->getCommentOnColumnSQL( $diff->getName($this)->getQuotedName($this), $columnDiff->column->getQuotedName($this), - $this->getColumnComment($columnDiff->column) + $this->getColumnComment($columnDiff->column), ); if (count($columnDiff->changedProperties) === 1) { @@ -650,14 +650,14 @@ public function getAlterTableSQL(TableDiff $diff) $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), ); } @@ -860,7 +860,7 @@ protected function doModifyLimitQuery($query, $limit, $offset) return sprintf( 'SELECT db22.* FROM (SELECT db21.*, ROW_NUMBER() OVER() AS DC_ROWNUM FROM (%s) db21) db22 WHERE %s', $query, - implode(' AND ', $where) + implode(' AND ', $where), ); } @@ -919,7 +919,7 @@ public function prefersIdentityColumns() Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pulls/1519', - 'DB2Platform::prefersIdentityColumns() is deprecated.' + 'DB2Platform::prefersIdentityColumns() is deprecated.', ); return true; @@ -966,15 +966,13 @@ protected function getReservedKeywordsClass() 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4510', 'DB2Platform::getReservedKeywordsClass() is deprecated,' - . ' use DB2Platform::createReservedKeywordsList() instead.' + . ' use DB2Platform::createReservedKeywordsList() instead.', ); return Keywords\DB2Keywords::class; } - /** - * @deprecated The SQL used for schema introspection is an implementation detail and should not be relied upon. - */ + /** @deprecated The SQL used for schema introspection is an implementation detail and should not be relied upon. */ public function getListTableCommentsSQL(string $table): string { return sprintf( @@ -984,7 +982,7 @@ public function getListTableCommentsSQL(string $table): string WHERE NAME = UPPER( %s ) SQL , - $this->quoteStringLiteral($table) + $this->quoteStringLiteral($table), ); } diff --git a/src/Platforms/DateIntervalUnit.php b/src/Platforms/DateIntervalUnit.php index c1f3ca59218..a95c4e28bfd 100644 --- a/src/Platforms/DateIntervalUnit.php +++ b/src/Platforms/DateIntervalUnit.php @@ -22,9 +22,7 @@ final class DateIntervalUnit public const YEAR = 'YEAR'; - /** - * @codeCoverageIgnore - */ + /** @codeCoverageIgnore */ private function __construct() { } diff --git a/src/Platforms/Keywords/DB2Keywords.php b/src/Platforms/Keywords/DB2Keywords.php index 5c2f0e48132..ee8cb1d67fe 100644 --- a/src/Platforms/Keywords/DB2Keywords.php +++ b/src/Platforms/Keywords/DB2Keywords.php @@ -19,7 +19,7 @@ public function getName() Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5433', - 'DB2Keywords::getName() is deprecated.' + 'DB2Keywords::getName() is deprecated.', ); return 'DB2'; diff --git a/src/Platforms/Keywords/KeywordList.php b/src/Platforms/Keywords/KeywordList.php index 291d4208c4a..5842773952b 100644 --- a/src/Platforms/Keywords/KeywordList.php +++ b/src/Platforms/Keywords/KeywordList.php @@ -32,9 +32,7 @@ public function isKeyword($word) return isset($this->keywords[strtoupper($word)]); } - /** - * @return void - */ + /** @return void */ protected function initializeKeywords() { $this->keywords = array_flip(array_map('strtoupper', $this->getKeywords())); diff --git a/src/Platforms/Keywords/MariaDBKeywords.php b/src/Platforms/Keywords/MariaDBKeywords.php index 97758e61c68..06c5612549d 100644 --- a/src/Platforms/Keywords/MariaDBKeywords.php +++ b/src/Platforms/Keywords/MariaDBKeywords.php @@ -6,15 +6,13 @@ class MariaDBKeywords extends MySQLKeywords { - /** - * @deprecated - */ + /** @deprecated */ public function getName(): string { Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5433', - 'MariaDBKeywords::getName() is deprecated.' + 'MariaDBKeywords::getName() is deprecated.', ); return 'MariaDB'; diff --git a/src/Platforms/Keywords/MariaDb102Keywords.php b/src/Platforms/Keywords/MariaDb102Keywords.php index 880fe4e0289..f9b50de540e 100644 --- a/src/Platforms/Keywords/MariaDb102Keywords.php +++ b/src/Platforms/Keywords/MariaDb102Keywords.php @@ -13,15 +13,13 @@ */ final class MariaDb102Keywords extends MariaDBKeywords { - /** - * @deprecated - */ + /** @deprecated */ public function getName(): string { Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5433', - 'MariaDb102Keywords::getName() is deprecated.' + 'MariaDb102Keywords::getName() is deprecated.', ); return 'MariaDb102'; diff --git a/src/Platforms/Keywords/MySQL57Keywords.php b/src/Platforms/Keywords/MySQL57Keywords.php index a20048bb0db..65dcea50005 100644 --- a/src/Platforms/Keywords/MySQL57Keywords.php +++ b/src/Platforms/Keywords/MySQL57Keywords.php @@ -21,7 +21,7 @@ public function getName() Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5433', - 'MySQL57Keywords::getName() is deprecated.' + 'MySQL57Keywords::getName() is deprecated.', ); return 'MySQL57'; diff --git a/src/Platforms/Keywords/MySQL80Keywords.php b/src/Platforms/Keywords/MySQL80Keywords.php index 67d899ffcb9..1ed030afac5 100644 --- a/src/Platforms/Keywords/MySQL80Keywords.php +++ b/src/Platforms/Keywords/MySQL80Keywords.php @@ -21,7 +21,7 @@ public function getName() Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5433', - 'MySQL80Keywords::getName() is deprecated.' + 'MySQL80Keywords::getName() is deprecated.', ); return 'MySQL80'; diff --git a/src/Platforms/Keywords/MySQLKeywords.php b/src/Platforms/Keywords/MySQLKeywords.php index 043375fb973..4f7fe998d56 100644 --- a/src/Platforms/Keywords/MySQLKeywords.php +++ b/src/Platforms/Keywords/MySQLKeywords.php @@ -19,7 +19,7 @@ public function getName() Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5433', - 'MySQLKeywords::getName() is deprecated.' + 'MySQLKeywords::getName() is deprecated.', ); return 'MySQL'; diff --git a/src/Platforms/Keywords/OracleKeywords.php b/src/Platforms/Keywords/OracleKeywords.php index b9211b2a85e..d49ddd58e11 100644 --- a/src/Platforms/Keywords/OracleKeywords.php +++ b/src/Platforms/Keywords/OracleKeywords.php @@ -19,7 +19,7 @@ public function getName() Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5433', - 'OracleKeywords::getName() is deprecated.' + 'OracleKeywords::getName() is deprecated.', ); return 'Oracle'; diff --git a/src/Platforms/Keywords/PostgreSQL100Keywords.php b/src/Platforms/Keywords/PostgreSQL100Keywords.php index 3dfdc3327eb..5153d2c8abf 100644 --- a/src/Platforms/Keywords/PostgreSQL100Keywords.php +++ b/src/Platforms/Keywords/PostgreSQL100Keywords.php @@ -13,15 +13,13 @@ */ class PostgreSQL100Keywords extends PostgreSQL94Keywords { - /** - * @deprecated - */ + /** @deprecated */ public function getName(): string { Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5433', - 'PostgreSQL100Keywords::getName() is deprecated.' + 'PostgreSQL100Keywords::getName() is deprecated.', ); return 'PostgreSQL100'; diff --git a/src/Platforms/Keywords/PostgreSQLKeywords.php b/src/Platforms/Keywords/PostgreSQLKeywords.php index c5fe14f6d0a..8714c6db61c 100644 --- a/src/Platforms/Keywords/PostgreSQLKeywords.php +++ b/src/Platforms/Keywords/PostgreSQLKeywords.php @@ -19,7 +19,7 @@ public function getName() Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5433', - 'PostgreSQLKeywords::getName() is deprecated.' + 'PostgreSQLKeywords::getName() is deprecated.', ); return 'PostgreSQL'; diff --git a/src/Platforms/Keywords/ReservedKeywordsValidator.php b/src/Platforms/Keywords/ReservedKeywordsValidator.php index c98f6d7a39a..e168e8b1ce7 100644 --- a/src/Platforms/Keywords/ReservedKeywordsValidator.php +++ b/src/Platforms/Keywords/ReservedKeywordsValidator.php @@ -15,9 +15,7 @@ use function implode; use function str_replace; -/** - * @deprecated Use database documentation instead. - */ +/** @deprecated Use database documentation instead. */ class ReservedKeywordsValidator implements Visitor { /** @var KeywordList[] */ @@ -26,23 +24,19 @@ class ReservedKeywordsValidator implements Visitor /** @var string[] */ private array $violations = []; - /** - * @param KeywordList[] $keywordLists - */ + /** @param KeywordList[] $keywordLists */ public function __construct(array $keywordLists) { Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5431', - 'ReservedKeywordsValidator is deprecated. Use database documentation instead.' + 'ReservedKeywordsValidator is deprecated. Use database documentation instead.', ); $this->keywordLists = $keywordLists; } - /** - * @return string[] - */ + /** @return string[] */ public function getViolations() { return $this->violations; @@ -91,7 +85,7 @@ public function acceptColumn(Table $table, Column $column) { $this->addViolation( 'Table ' . $table->getName() . ' column ' . $column->getName(), - $this->isReservedWord($column->getName()) + $this->isReservedWord($column->getName()), ); } @@ -130,7 +124,7 @@ public function acceptTable(Table $table) { $this->addViolation( 'Table ' . $table->getName(), - $this->isReservedWord($table->getName()) + $this->isReservedWord($table->getName()), ); } } diff --git a/src/Platforms/Keywords/SQLServerKeywords.php b/src/Platforms/Keywords/SQLServerKeywords.php index 64f23048ef0..48953baa250 100644 --- a/src/Platforms/Keywords/SQLServerKeywords.php +++ b/src/Platforms/Keywords/SQLServerKeywords.php @@ -20,7 +20,7 @@ public function getName() Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5433', - 'SQLServerKeywords::getName() is deprecated.' + 'SQLServerKeywords::getName() is deprecated.', ); return 'SQLServer'; diff --git a/src/Platforms/Keywords/SQLiteKeywords.php b/src/Platforms/Keywords/SQLiteKeywords.php index 93b8e28f72c..65351078e94 100644 --- a/src/Platforms/Keywords/SQLiteKeywords.php +++ b/src/Platforms/Keywords/SQLiteKeywords.php @@ -19,7 +19,7 @@ public function getName() Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5433', - 'SQLiteKeywords::getName() is deprecated.' + 'SQLiteKeywords::getName() is deprecated.', ); return 'SQLite'; diff --git a/src/Platforms/MariaDBPlatform.php b/src/Platforms/MariaDBPlatform.php index 1795cc7702f..9e3d3ddb9a1 100644 --- a/src/Platforms/MariaDBPlatform.php +++ b/src/Platforms/MariaDBPlatform.php @@ -33,16 +33,14 @@ public function getJsonTypeDeclarationSQL(array $column): string return 'LONGTEXT'; } - /** - * @deprecated Implement {@see createReservedKeywordsList()} instead. - */ + /** @deprecated Implement {@see createReservedKeywordsList()} instead. */ protected function getReservedKeywordsClass(): string { Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4510', 'MariaDb1027Platform::getReservedKeywordsClass() is deprecated,' - . ' use MariaDb1027Platform::createReservedKeywordsList() instead.' + . ' use MariaDb1027Platform::createReservedKeywordsList() instead.', ); return Keywords\MariaDb102Keywords::class; 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 243a10f2ab2..513c08b6e1f 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 CollationMetadataProvider */ diff --git a/src/Platforms/MySQL/CollationMetadataProvider/ConnectionCollationMetadataProvider.php b/src/Platforms/MySQL/CollationMetadataProvider/ConnectionCollationMetadataProvider.php index 401c940e003..8dc2421a0c1 100644 --- a/src/Platforms/MySQL/CollationMetadataProvider/ConnectionCollationMetadataProvider.php +++ b/src/Platforms/MySQL/CollationMetadataProvider/ConnectionCollationMetadataProvider.php @@ -8,9 +8,7 @@ use Doctrine\DBAL\Exception; use Doctrine\DBAL\Platforms\MySQL\CollationMetadataProvider; -/** - * @internal - */ +/** @internal */ final class ConnectionCollationMetadataProvider implements CollationMetadataProvider { /** @var Connection */ @@ -21,9 +19,7 @@ public function __construct(Connection $connection) $this->connection = $connection; } - /** - * @throws Exception - */ + /** @throws Exception */ public function getCollationCharset(string $collation): ?string { $charset = $this->connection->fetchOne( @@ -33,7 +29,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 74e7fe3baf9..5951a574475 100644 --- a/src/Platforms/MySQL/Comparator.php +++ b/src/Platforms/MySQL/Comparator.php @@ -21,9 +21,7 @@ class Comparator extends BaseComparator /** @var CollationMetadataProvider */ private $collationMetadataProvider; - /** - * @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, CollationMetadataProvider $collationMetadataProvider) { parent::__construct($platform); @@ -38,7 +36,7 @@ public function diffTable(Table $fromTable, Table $toTable) { return parent::diffTable( $this->normalizeColumns($fromTable), - $this->normalizeColumns($toTable) + $this->normalizeColumns($toTable), ); } diff --git a/src/Platforms/MySQL57Platform.php b/src/Platforms/MySQL57Platform.php index 5ed975e696f..ea11ee6365c 100644 --- a/src/Platforms/MySQL57Platform.php +++ b/src/Platforms/MySQL57Platform.php @@ -27,7 +27,7 @@ public function hasNativeJsonType() 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5509', '%s is deprecated.', - __METHOD__ + __METHOD__, ); return true; @@ -81,7 +81,7 @@ protected function getReservedKeywordsClass() 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4510', 'MySQL57Platform::getReservedKeywordsClass() is deprecated,' - . ' use MySQL57Platform::createReservedKeywordsList() instead.' + . ' use MySQL57Platform::createReservedKeywordsList() instead.', ); return Keywords\MySQL57Keywords::class; diff --git a/src/Platforms/MySQL80Platform.php b/src/Platforms/MySQL80Platform.php index 536a79f4b7b..dd6599de15c 100644 --- a/src/Platforms/MySQL80Platform.php +++ b/src/Platforms/MySQL80Platform.php @@ -20,7 +20,7 @@ protected function getReservedKeywordsClass() 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4510', 'MySQL80Platform::getReservedKeywordsClass() is deprecated,' - . ' use MySQL80Platform::createReservedKeywordsList() instead.' + . ' use MySQL80Platform::createReservedKeywordsList() instead.', ); return Keywords\MySQL80Keywords::class; diff --git a/src/Platforms/OraclePlatform.php b/src/Platforms/OraclePlatform.php index cf0ae5bf839..96b576c1937 100644 --- a/src/Platforms/OraclePlatform.php +++ b/src/Platforms/OraclePlatform.php @@ -78,7 +78,7 @@ public function getNowExpression($type = 'timestamp') Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4753', - 'OraclePlatform::getNowExpression() is deprecated. Generate dates within the application.' + 'OraclePlatform::getNowExpression() is deprecated. Generate dates within the application.', ); switch ($type) { @@ -189,7 +189,7 @@ public function getCreatePrimaryKeySQL(Index $index, $table): string 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4798', 'Passing $table as a Table object to %s is deprecated. Pass it as a quoted name instead.', - __METHOD__ + __METHOD__, ); $table = $table->getQuotedName($this); @@ -364,7 +364,7 @@ protected function getVarcharTypeDeclarationSQLSnippet($length, $fixed/*, $lengt 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/3263', 'Relying on the default string column length on Oracle is deprecated' - . ', specify the length explicitly.' + . ', specify the length explicitly.', ); } @@ -382,7 +382,7 @@ protected function getBinaryTypeDeclarationSQLSnippet($length, $fixed/*, $length 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/3263', 'Relying on the default binary column length on Oracle is deprecated' - . ', specify the length explicitly.' + . ', specify the length explicitly.', ); } @@ -399,7 +399,7 @@ public function getBinaryMaxLength() Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/3263', - 'OraclePlatform::getBinaryMaxLength() is deprecated.' + 'OraclePlatform::getBinaryMaxLength() is deprecated.', ); return 2000; @@ -569,7 +569,7 @@ public function getCreateAutoincrementSql($name, $table, $start = 1) $sequenceName = $this->getIdentitySequenceName( $tableIdentifier->isQuoted() ? $quotedTableName : $unquotedTableName, - $nameIdentifier->isQuoted() ? $quotedName : $unquotedName + $nameIdentifier->isQuoted() ? $quotedName : $unquotedName, ); $sequence = new Sequence($sequenceName, $start); $sql[] = $this->getCreateSequenceSQL($sequence); @@ -614,7 +614,7 @@ public function getDropAutoincrementSql($table) $autoincrementIdentifierName = $this->getAutoincrementIdentifierName($table); $identitySequenceName = $this->getIdentitySequenceName( $table->isQuoted() ? $table->getQuotedName($this) : $table->getName(), - '' + '', ); return [ @@ -759,7 +759,7 @@ public function getListTableColumnsSQL($table, $database = null) $colCommentsOwnerCondition, $tabColumnsTableName, $table, - $tabColumnsOwnerCondition + $tabColumnsOwnerCondition, ); } @@ -774,7 +774,7 @@ public function getDropForeignKeySQL($foreignKey, $table) 'https://github.com/doctrine/dbal/issues/4798', 'Passing $foreignKey as a ForeignKeyConstraint object to %s is deprecated.' . ' Pass it as a quoted name instead.', - __METHOD__ + __METHOD__, ); } else { $foreignKey = new Identifier($foreignKey); @@ -785,7 +785,7 @@ public function getDropForeignKeySQL($foreignKey, $table) 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4798', 'Passing $table as a Table object to %s is deprecated. Pass it as a quoted name instead.', - __METHOD__ + __METHOD__, ); } else { $table = new Identifier($table); @@ -885,7 +885,7 @@ public function getAlterTableSQL(TableDiff $diff) $commentsSQL[] = $this->getCommentOnColumnSQL( $diff->getName($this)->getQuotedName($this), $column->getQuotedName($this), - $comment + $comment, ); } @@ -935,7 +935,7 @@ public function getAlterTableSQL(TableDiff $diff) $commentsSQL[] = $this->getCommentOnColumnSQL( $diff->getName($this)->getQuotedName($this), $column->getQuotedName($this), - $this->getColumnComment($column) + $this->getColumnComment($column), ); } @@ -980,14 +980,14 @@ public function getAlterTableSQL(TableDiff $diff) $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), ); } @@ -1049,7 +1049,7 @@ public function usesSequenceEmulatedIdentityColumns() 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5513', '%s is deprecated.', - __METHOD__ + __METHOD__, ); return true; @@ -1094,7 +1094,7 @@ public function getName() Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4749', - 'OraclePlatform::getName() is deprecated. Identify platforms by their class.' + 'OraclePlatform::getName() is deprecated. Identify platforms by their class.', ); return 'oracle'; @@ -1261,7 +1261,7 @@ protected function getReservedKeywordsClass() 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4510', 'OraclePlatform::getReservedKeywordsClass() is deprecated,' - . ' use OraclePlatform::createReservedKeywordsList() instead.' + . ' use OraclePlatform::createReservedKeywordsList() instead.', ); return Keywords\OracleKeywords::class; @@ -1275,9 +1275,7 @@ public function getBlobTypeDeclarationSQL(array $column) return 'BLOB'; } - /** - * @deprecated The SQL used for schema introspection is an implementation detail and should not be relied upon. - */ + /** @deprecated The SQL used for schema introspection is an implementation detail and should not be relied upon. */ public function getListTableCommentsSQL(string $table, ?string $database = null): string { $tableCommentsName = 'user_tab_comments'; @@ -1286,7 +1284,7 @@ public function getListTableCommentsSQL(string $table, ?string $database = null) if ($database !== null && $database !== '/') { $tableCommentsName = 'all_tab_comments'; $ownerCondition = ' AND owner = ' . $this->quoteStringLiteral( - $this->normalizeIdentifier($database)->getName() + $this->normalizeIdentifier($database)->getName(), ); } @@ -1297,7 +1295,7 @@ public function getListTableCommentsSQL(string $table, ?string $database = null) , $tableCommentsName, $this->quoteStringLiteral($this->normalizeIdentifier($table)->getName()), - $ownerCondition + $ownerCondition, ); } diff --git a/src/Platforms/PostgreSQL100Platform.php b/src/Platforms/PostgreSQL100Platform.php index 04e3448e669..aa023ba794a 100644 --- a/src/Platforms/PostgreSQL100Platform.php +++ b/src/Platforms/PostgreSQL100Platform.php @@ -15,16 +15,14 @@ */ class PostgreSQL100Platform extends PostgreSQL94Platform { - /** - * @deprecated Implement {@see createReservedKeywordsList()} instead. - */ + /** @deprecated Implement {@see createReservedKeywordsList()} instead. */ protected function getReservedKeywordsClass(): string { Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4510', 'PostgreSQL100Platform::getReservedKeywordsClass() is deprecated,' - . ' use PostgreSQL100Platform::createReservedKeywordsList() instead.' + . ' use PostgreSQL100Platform::createReservedKeywordsList() instead.', ); return PostgreSQL100Keywords::class; diff --git a/src/Platforms/PostgreSQLPlatform.php b/src/Platforms/PostgreSQLPlatform.php index 9f65b329190..067c089cf7c 100644 --- a/src/Platforms/PostgreSQLPlatform.php +++ b/src/Platforms/PostgreSQLPlatform.php @@ -97,7 +97,7 @@ public function getNowExpression() Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4753', - 'PostgreSQLPlatform::getNowExpression() is deprecated. Generate dates within the application.' + 'PostgreSQLPlatform::getNowExpression() is deprecated. Generate dates within the application.', ); return 'LOCALTIMESTAMP(0)'; @@ -179,7 +179,7 @@ public function getDefaultSchemaName() 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5513', '%s is deprecated.', - __METHOD__ + __METHOD__, ); return 'public'; @@ -214,7 +214,7 @@ public function usesSequenceEmulatedIdentityColumns() 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5513', '%s is deprecated.', - __METHOD__ + __METHOD__, ); return true; @@ -231,7 +231,7 @@ public function getIdentitySequenceName($tableName, $columnName) 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5513', '%s is deprecated.', - __METHOD__ + __METHOD__, ); return $tableName . '_' . $columnName . '_seq'; @@ -258,7 +258,7 @@ public function hasNativeGuidType() 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5509', '%s is deprecated.', - __METHOD__ + __METHOD__, ); return true; @@ -285,7 +285,7 @@ public function getListNamespacesSQL() 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4503', 'PostgreSQLPlatform::getListNamespacesSQL() is deprecated,' - . ' use PostgreSQLSchemaManager::listSchemaNames() instead.' + . ' use PostgreSQLSchemaManager::listSchemaNames() instead.', ); return "SELECT schema_name AS nspname @@ -388,7 +388,7 @@ public function getListTableConstraintsSQL($table) ) SQL , - $table + $table, ); } @@ -436,7 +436,7 @@ private function getTableWhereClause($table, $classAlias = 'c', $namespaceAlias $classAlias, $table, $namespaceAlias, - $schema + $schema, ); } @@ -539,7 +539,7 @@ public function getAlterTableSQL(TableDiff $diff) $commentsSQL[] = $this->getCommentOnColumnSQL( $diff->getName($this)->getQuotedName($this), $column->getQuotedName($this), - $comment + $comment, ); } @@ -621,7 +621,7 @@ public function getAlterTableSQL(TableDiff $diff) $commentsSQL[] = $this->getCommentOnColumnSQL( $diff->getName($this)->getQuotedName($this), $column->getQuotedName($this), - $newComment + $newComment, ); } @@ -656,14 +656,14 @@ public function getAlterTableSQL(TableDiff $diff) $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), ); } @@ -734,7 +734,7 @@ public function getCommentOnColumnSQL($tableName, $columnName, $comment) 'COMMENT ON COLUMN %s.%s IS %s', $tableName->getQuotedName($this), $columnName->getQuotedName($this), - $comment + $comment, ); } @@ -905,16 +905,14 @@ public function convertBooleans($item) return $this->doConvertBooleans( $item, - /** - * @param mixed $value - */ + /** @param mixed $value */ static function ($value) { if ($value === null) { return 'NULL'; } return $value === true ? 'true' : 'false'; - } + }, ); } @@ -929,12 +927,10 @@ public function convertBooleansToDatabaseValue($item) return $this->doConvertBooleans( $item, - /** - * @param mixed $value - */ + /** @param mixed $value */ static function ($value): ?int { return $value === null ? null : (int) $value; - } + }, ); } @@ -1092,7 +1088,7 @@ public function getName() Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4749', - 'PostgreSQLPlatform::getName() is deprecated. Identify platforms by their class.' + 'PostgreSQLPlatform::getName() is deprecated. Identify platforms by their class.', ); return 'postgresql'; @@ -1197,7 +1193,7 @@ public function getVarcharMaxLength() Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/3263', - 'PostgreSQLPlatform::getVarcharMaxLength() is deprecated.' + 'PostgreSQLPlatform::getVarcharMaxLength() is deprecated.', ); return 65535; @@ -1211,7 +1207,7 @@ public function getBinaryMaxLength() Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/3263', - 'PostgreSQLPlatform::getBinaryMaxLength() is deprecated.' + 'PostgreSQLPlatform::getBinaryMaxLength() is deprecated.', ); return 0; @@ -1227,7 +1223,7 @@ public function getBinaryDefaultLength() Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/3263', - 'Relying on the default binary column length is deprecated, specify the length explicitly.' + 'Relying on the default binary column length is deprecated, specify the length explicitly.', ); return 0; @@ -1244,7 +1240,7 @@ public function hasNativeJsonType() 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5509', '%s is deprecated.', - __METHOD__ + __METHOD__, ); return true; @@ -1261,7 +1257,7 @@ protected function getReservedKeywordsClass() 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4510', 'PostgreSQLPlatform::getReservedKeywordsClass() is deprecated,' - . ' use PostgreSQLPlatform::createReservedKeywordsList() instead.' + . ' use PostgreSQLPlatform::createReservedKeywordsList() instead.', ); return Keywords\PostgreSQL94Keywords::class; @@ -1326,9 +1322,7 @@ private function getOldColumnComment(ColumnDiff $columnDiff): ?string return $columnDiff->fromColumn !== null ? $this->getColumnComment($columnDiff->fromColumn) : null; } - /** - * @deprecated The SQL used for schema introspection is an implementation detail and should not be relied upon. - */ + /** @deprecated The SQL used for schema introspection is an implementation detail and should not be relied upon. */ public function getListTableMetadataSQL(string $table, ?string $schema = null): string { if ($schema !== null) { @@ -1340,7 +1334,7 @@ public function getListTableMetadataSQL(string $table, ?string $schema = null): SELECT obj_description(%s::regclass) AS table_comment; SQL , - $this->quoteStringLiteral($table) + $this->quoteStringLiteral($table), ); } diff --git a/src/Platforms/SQLServer/Comparator.php b/src/Platforms/SQLServer/Comparator.php index 49f170b0ac5..e231e808394 100644 --- a/src/Platforms/SQLServer/Comparator.php +++ b/src/Platforms/SQLServer/Comparator.php @@ -15,9 +15,7 @@ class Comparator extends BaseComparator { private string $databaseCollation; - /** - * @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, string $databaseCollation) { parent::__construct($platform); diff --git a/src/Platforms/SQLServerPlatform.php b/src/Platforms/SQLServerPlatform.php index 4c8f72b8bfe..bce53115cd3 100644 --- a/src/Platforms/SQLServerPlatform.php +++ b/src/Platforms/SQLServerPlatform.php @@ -110,7 +110,7 @@ public function prefersIdentityColumns() Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pulls/1519', - 'SQLServerPlatform::prefersIdentityColumns() is deprecated.' + 'SQLServerPlatform::prefersIdentityColumns() is deprecated.', ); return true; @@ -153,7 +153,7 @@ public function getDefaultSchemaName() 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5513', '%s is deprecated.', - __METHOD__ + __METHOD__, ); return 'dbo'; @@ -224,7 +224,7 @@ public function hasNativeGuidType() 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5509', '%s is deprecated.', - __METHOD__ + __METHOD__, ); return true; @@ -259,13 +259,13 @@ public function getDropIndexSQL($index, $table = null) 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4798', 'Passing $index as an Index object to %s is deprecated. Pass it as a quoted name instead.', - __METHOD__ + __METHOD__, ); $index = $index->getQuotedName($this); } elseif (! is_string($index)) { throw new InvalidArgumentException( - __METHOD__ . '() expects $index parameter to be string or ' . Index::class . '.' + __METHOD__ . '() expects $index parameter to be string or ' . Index::class . '.', ); } @@ -274,13 +274,13 @@ public function getDropIndexSQL($index, $table = null) 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4798', 'Passing $table as an Table object to %s is deprecated. Pass it as a quoted name instead.', - __METHOD__ + __METHOD__, ); $table = $table->getQuotedName($this); } elseif (! is_string($table)) { throw new InvalidArgumentException( - __METHOD__ . '() expects $table parameter to be string or ' . Table::class . '.' + __METHOD__ . '() expects $table parameter to be string or ' . Table::class . '.', ); } @@ -374,7 +374,7 @@ public function getCreatePrimaryKeySQL(Index $index, $table) 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4798', 'Passing $table as a Table object to %s is deprecated. Pass it as a quoted name instead.', - __METHOD__ + __METHOD__, ); $identifier = $table->getQuotedName($this); @@ -427,7 +427,7 @@ protected function getCreateColumnCommentSQL($tableName, $columnName, $comment) 'TABLE', $tableSQL, 'COLUMN', - $columnName + $columnName, ); } @@ -540,7 +540,7 @@ public function getAlterTableSQL(TableDiff $diff) $commentsSql[] = $this->getCreateColumnCommentSQL( $diff->name, $column->getQuotedName($this), - $comment + $comment, ); } @@ -569,7 +569,7 @@ public function getAlterTableSQL(TableDiff $diff) $commentsSql[] = $this->getAlterColumnCommentSQL( $diff->name, $column->getQuotedName($this), - $comment + $comment, ); } elseif ($hasFromComment && ! $hasComment) { $commentsSql[] = $this->getDropColumnCommentSQL($diff->name, $column->getQuotedName($this)); @@ -577,7 +577,7 @@ public function getAlterTableSQL(TableDiff $diff) $commentsSql[] = $this->getCreateColumnCommentSQL( $diff->name, $column->getQuotedName($this), - $comment + $comment, ); } } @@ -592,7 +592,7 @@ public function getAlterTableSQL(TableDiff $diff) if ($requireDropDefaultConstraint) { $queryParts[] = $this->getAlterTableDropDefaultConstraintClause( $diff->name, - $columnDiff->oldColumnName + $columnDiff->oldColumnName, ); } @@ -629,7 +629,7 @@ public function getAlterTableSQL(TableDiff $diff) $queryParts[] = $this->getAlterTableDropDefaultConstraintClause( $diff->name, - $oldColumnName->getQuotedName($this) + $oldColumnName->getQuotedName($this), ); $queryParts[] = $this->getAlterTableAddDefaultConstraintClause($diff->name, $column); } @@ -672,7 +672,7 @@ public function getAlterTableSQL(TableDiff $diff) $sql = array_merge( $this->getPreAlterTableIndexForeignKeySQL($diff), $sql, - $this->getPostAlterTableIndexForeignKeySQL($diff) + $this->getPostAlterTableIndexForeignKeySQL($diff), ); return array_merge($sql, $tableSql, $columnSql); @@ -772,7 +772,7 @@ protected function getAlterColumnCommentSQL($tableName, $columnName, $comment) 'TABLE', $tableSQL, 'COLUMN', - $columnName + $columnName, ); } @@ -810,7 +810,7 @@ protected function getDropColumnCommentSQL($tableName, $columnName) 'TABLE', $tableSQL, 'COLUMN', - $columnName + $columnName, ); } @@ -823,7 +823,7 @@ protected function getRenameIndexSQL($oldIndexName, Index $index, $tableName) "EXEC sp_rename N'%s.%s', N'%s', N'INDEX'", $tableName, $oldIndexName, - $index->getQuotedName($this) + $index->getQuotedName($this), ), ]; } @@ -1160,7 +1160,7 @@ public function getListNamespacesSQL() 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4503', 'SQLServerPlatform::getListNamespacesSQL() is deprecated,' - . ' use SQLServerSchemaManager::listSchemaNames() instead.' + . ' use SQLServerSchemaManager::listSchemaNames() instead.', ); return "SELECT name FROM sys.schemas WHERE name NOT IN('guest', 'INFORMATION_SCHEMA', 'sys')"; @@ -1263,7 +1263,7 @@ protected function getVarcharTypeDeclarationSQLSnippet($length, $fixed/*, $lengt 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/3263', 'Relying on the default string column length on SQL Server is deprecated' - . ', specify the length explicitly.' + . ', specify the length explicitly.', ); } @@ -1282,7 +1282,7 @@ protected function getBinaryTypeDeclarationSQLSnippet($length, $fixed/*, $length 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/3263', 'Relying on the default binary column length on SQL Server is deprecated' - . ', specify the length explicitly.' + . ', specify the length explicitly.', ); } @@ -1301,7 +1301,7 @@ public function getBinaryMaxLength() Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/3263', - 'SQLServerPlatform::getBinaryMaxLength() is deprecated.' + 'SQLServerPlatform::getBinaryMaxLength() is deprecated.', ); return 8000; @@ -1584,7 +1584,7 @@ protected function getReservedKeywordsClass() 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4510', 'SQLServerPlatform::getReservedKeywordsClass() is deprecated,' - . ' use SQLServerPlatform::createReservedKeywordsList() instead.' + . ' use SQLServerPlatform::createReservedKeywordsList() instead.', ); return Keywords\SQLServer2012Keywords::class; @@ -1693,13 +1693,11 @@ protected function getCommentOnTableSQL(string $tableName, ?string $comment): st SQL , $this->quoteStringLiteral((string) $comment), - $this->quoteStringLiteral($tableName) + $this->quoteStringLiteral($tableName), ); } - /** - * @deprecated The SQL used for schema introspection is an implementation detail and should not be relied upon. - */ + /** @deprecated The SQL used for schema introspection is an implementation detail and should not be relied upon. */ public function getListTableMetadataSQL(string $table): string { return sprintf( @@ -1713,13 +1711,11 @@ public function getListTableMetadataSQL(string $table): string (tbl.name=N%s and SCHEMA_NAME(tbl.schema_id)=N'dbo' and p.name=N'MS_Description') SQL , - $this->quoteStringLiteral($table) + $this->quoteStringLiteral($table), ); } - /** - * @param string $query - */ + /** @param string $query */ private function shouldAddOrderBy($query): bool { // Find the position of the last instance of ORDER BY and ensure it is not within a parenthetical statement diff --git a/src/Platforms/SQLite/Comparator.php b/src/Platforms/SQLite/Comparator.php index d27ee86d783..263f3561e8b 100644 --- a/src/Platforms/SQLite/Comparator.php +++ b/src/Platforms/SQLite/Comparator.php @@ -15,9 +15,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 3bed8afae51..687da7f48a8 100644 --- a/src/Platforms/SqlitePlatform.php +++ b/src/Platforms/SqlitePlatform.php @@ -63,7 +63,7 @@ public function getNowExpression($type = 'timestamp') Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4753', - 'SqlitePlatform::getNowExpression() is deprecated. Generate dates within the application.' + 'SqlitePlatform::getNowExpression() is deprecated. Generate dates within the application.', ); switch ($type) { @@ -218,7 +218,7 @@ public function prefersIdentityColumns() Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pulls/1519', - 'SqlitePlatform::prefersIdentityColumns() is deprecated.' + 'SqlitePlatform::prefersIdentityColumns() is deprecated.', ); return true; @@ -266,7 +266,7 @@ public function getTinyIntTypeDeclarationSQL(array $column) 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5511', '%s is deprecated. Use getSmallIntTypeDeclarationSQL() instead.', - __METHOD__ + __METHOD__, ); // SQLite autoincrement is implicit for INTEGER PKs, but not for TINYINT columns @@ -303,7 +303,7 @@ public function getMediumIntTypeDeclarationSQL(array $column) 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5511', '%s is deprecated. Use getIntegerTypeDeclarationSQL() instead.', - __METHOD__ + __METHOD__, ); // SQLite autoincrement is implicit for INTEGER PKs, but not for MEDIUMINT columns @@ -383,7 +383,7 @@ public function getForeignKeyDeclarationSQL(ForeignKeyConstraint $foreignKey) $this->emulateSchemaNamespacing($foreignKey->getQuotedForeignTableName($this)), $foreignKey->getQuotedForeignColumns($this), $foreignKey->getName(), - $foreignKey->getOptions() + $foreignKey->getOptions(), )); } @@ -487,7 +487,7 @@ public function getBinaryMaxLength() Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/3263', - 'SqlitePlatform::getBinaryMaxLength() is deprecated.' + 'SqlitePlatform::getBinaryMaxLength() is deprecated.', ); return 0; @@ -503,7 +503,7 @@ public function getBinaryDefaultLength() Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/3263', - 'Relying on the default binary column length is deprecated, specify the length explicitly.' + 'Relying on the default binary column length is deprecated, specify the length explicitly.', ); return 0; @@ -528,7 +528,7 @@ public function getListTableConstraintsSQL($table) return sprintf( "SELECT sql FROM sqlite_master WHERE type='index' AND tbl_name = %s AND sql NOT NULL ORDER BY name", - $this->quoteStringLiteral($table) + $this->quoteStringLiteral($table), ); } @@ -618,7 +618,7 @@ public function supportsCreateDropDatabase() 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5513', '%s is deprecated.', - __METHOD__ + __METHOD__, ); return false; @@ -660,7 +660,7 @@ public function getName() Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4749', - 'SqlitePlatform::getName() is deprecated. Identify platforms by their class.' + 'SqlitePlatform::getName() is deprecated. Identify platforms by their class.', ); return 'sqlite'; @@ -795,7 +795,7 @@ protected function getReservedKeywordsClass() 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4510', 'SqlitePlatform::getReservedKeywordsClass() is deprecated,' - . ' use SqlitePlatform::createReservedKeywordsList() instead.' + . ' use SqlitePlatform::createReservedKeywordsList() instead.', ); return Keywords\SQLiteKeywords::class; @@ -818,7 +818,7 @@ protected function getPostAlterTableIndexForeignKeySQL(TableDiff $diff) if (! $fromTable instanceof Table) { 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', ); } @@ -886,7 +886,7 @@ public function canEmulateSchemas() Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4805', - 'SqlitePlatform::canEmulateSchemas() is deprecated.' + 'SqlitePlatform::canEmulateSchemas() is deprecated.', ); return $this->schemaEmulationEnabled; @@ -995,7 +995,7 @@ public function getAlterTableSQL(TableDiff $diff) $fromTable = $diff->fromTable; if (! $fromTable instanceof Table) { 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', ); } @@ -1023,7 +1023,7 @@ public function getAlterTableSQL(TableDiff $diff) unset( $columns[$columnName], $oldColumnNames[$columnName], - $newColumnNames[$columnName] + $newColumnNames[$columnName], ); } @@ -1076,7 +1076,7 @@ public function getAlterTableSQL(TableDiff $diff) $this->getPrimaryIndexInAlteredTable($diff, $fromTable), [], $this->getForeignKeysInAlteredTable($diff, $fromTable), - $fromTable->getOptions() + $fromTable->getOptions(), ); $newTable->addOption('alter', true); @@ -1086,7 +1086,7 @@ public function getAlterTableSQL(TableDiff $diff) 'CREATE TEMPORARY TABLE %s AS SELECT %s FROM %s', $dataTable->getQuotedName($this), implode(', ', $oldColumnNames), - $fromTable->getQuotedName($this) + $fromTable->getQuotedName($this), ); $sql[] = $this->getDropTableSQL($fromTable); @@ -1096,7 +1096,7 @@ public function getAlterTableSQL(TableDiff $diff) $newTable->getQuotedName($this), implode(', ', $newColumnNames), implode(', ', $oldColumnNames), - $dataTable->getQuotedName($this) + $dataTable->getQuotedName($this), ); $sql[] = $this->getDropTableSQL($dataTable->getQuotedName($this)); @@ -1106,7 +1106,7 @@ public function getAlterTableSQL(TableDiff $diff) $sql[] = sprintf( 'ALTER TABLE %s RENAME TO %s', $newTable->getQuotedName($this), - $newName->getQuotedName($this) + $newName->getQuotedName($this), ); } @@ -1239,9 +1239,7 @@ private function getSimpleAlterTableSQL(TableDiff $diff) return array_merge($sql, $tableSql, $columnSql); } - /** - * @return string[] - */ + /** @return string[] */ private function getColumnNamesInAlteredTable(TableDiff $diff, Table $fromTable): array { $columns = []; @@ -1279,9 +1277,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(); @@ -1322,7 +1318,7 @@ private function getIndexesInAlteredTable(TableDiff $diff, Table $fromTable): ar $indexColumns, $index->isUnique(), $index->isPrimary(), - $index->getFlags() + $index->getFlags(), ); } @@ -1347,9 +1343,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(); @@ -1382,7 +1376,7 @@ private function getForeignKeysInAlteredTable(TableDiff $diff, Table $fromTable) $constraint->getForeignTableName(), $constraint->getForeignColumns(), $constraint->getName(), - $constraint->getOptions() + $constraint->getOptions(), ); } @@ -1411,9 +1405,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/Platforms/TrimMode.php b/src/Platforms/TrimMode.php index eb499ee4621..01356c0d3d9 100644 --- a/src/Platforms/TrimMode.php +++ b/src/Platforms/TrimMode.php @@ -14,9 +14,7 @@ final class TrimMode public const BOTH = 3; - /** - * @codeCoverageIgnore - */ + /** @codeCoverageIgnore */ private function __construct() { } diff --git a/src/Portability/Connection.php b/src/Portability/Connection.php index 4aa03e1b56f..fc1bdd9ad3c 100644 --- a/src/Portability/Connection.php +++ b/src/Portability/Connection.php @@ -31,7 +31,7 @@ public function prepare(string $sql): DriverStatement { return new Statement( parent::prepare($sql), - $this->converter + $this->converter, ); } @@ -39,7 +39,7 @@ public function query(string $sql): DriverResult { return new Result( parent::query($sql), - $this->converter + $this->converter, ); } } diff --git a/src/Portability/Driver.php b/src/Portability/Driver.php index 77b20dd2cb6..2425dde0382 100644 --- a/src/Portability/Driver.php +++ b/src/Portability/Driver.php @@ -36,7 +36,7 @@ public function connect(array $params) $portability = (new OptimizeFlags())( $this->getDatabasePlatform(), - $this->mode + $this->mode, ); $case = null; @@ -67,7 +67,7 @@ public function connect(array $params) 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 a5ea91c4d2b..da1eca98598 100644 --- a/src/Portability/Result.php +++ b/src/Portability/Result.php @@ -11,9 +11,7 @@ final class Result extends AbstractResultMiddleware { private Converter $converter; - /** - * @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, Converter $converter) { parent::__construct($result); @@ -27,7 +25,7 @@ public function __construct(ResultInterface $result, Converter $converter) public function fetchNumeric() { return $this->converter->convertNumeric( - parent::fetchNumeric() + parent::fetchNumeric(), ); } @@ -37,7 +35,7 @@ public function fetchNumeric() public function fetchAssociative() { return $this->converter->convertAssociative( - parent::fetchAssociative() + parent::fetchAssociative(), ); } @@ -47,7 +45,7 @@ public function fetchAssociative() public function fetchOne() { return $this->converter->convertOne( - parent::fetchOne() + parent::fetchOne(), ); } @@ -57,7 +55,7 @@ public function fetchOne() public function fetchAllNumeric(): array { return $this->converter->convertAllNumeric( - parent::fetchAllNumeric() + parent::fetchAllNumeric(), ); } @@ -67,7 +65,7 @@ public function fetchAllNumeric(): array public function fetchAllAssociative(): array { return $this->converter->convertAllAssociative( - parent::fetchAllAssociative() + parent::fetchAllAssociative(), ); } @@ -77,7 +75,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 a048c432e7e..9b3e74f5836 100644 --- a/src/Portability/Statement.php +++ b/src/Portability/Statement.php @@ -30,7 +30,7 @@ public function execute($params = null): ResultInterface { return new Result( parent::execute($params), - $this->converter + $this->converter, ); } } diff --git a/src/Query.php b/src/Query.php index dc24d2f363a..bfc9b14e2d3 100644 --- a/src/Query.php +++ b/src/Query.php @@ -50,17 +50,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/Expression/CompositeExpression.php b/src/Query/Expression/CompositeExpression.php index 7bf93264ec0..de1d929a0d0 100644 --- a/src/Query/Expression/CompositeExpression.php +++ b/src/Query/Expression/CompositeExpression.php @@ -54,7 +54,7 @@ public function __construct($type, array $parts = []) Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/3864', - 'Do not use CompositeExpression constructor directly, use static and() and or() factory methods.' + 'Do not use CompositeExpression constructor directly, use static and() and or() factory methods.', ); } @@ -90,7 +90,7 @@ public function addMultiple(array $parts = []) Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/3844', - 'CompositeExpression::addMultiple() is deprecated, use CompositeExpression::with() instead.' + 'CompositeExpression::addMultiple() is deprecated, use CompositeExpression::with() instead.', ); foreach ($parts as $part) { @@ -114,7 +114,7 @@ public function add($part) Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/3844', - 'CompositeExpression::add() is deprecated, use CompositeExpression::with() instead.' + 'CompositeExpression::add() is deprecated, use CompositeExpression::with() instead.', ); if ($part === null) { diff --git a/src/Query/Expression/ExpressionBuilder.php b/src/Query/Expression/ExpressionBuilder.php index 839e0ebedfe..d532b289465 100644 --- a/src/Query/Expression/ExpressionBuilder.php +++ b/src/Query/Expression/ExpressionBuilder.php @@ -73,7 +73,7 @@ public function andX($x = null) Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/3851', - 'ExpressionBuilder::andX() is deprecated, use ExpressionBuilder::and() instead.' + 'ExpressionBuilder::andX() is deprecated, use ExpressionBuilder::and() instead.', ); return new CompositeExpression(CompositeExpression::TYPE_AND, func_get_args()); @@ -92,7 +92,7 @@ public function orX($x = null) Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/3851', - 'ExpressionBuilder::orX() is deprecated, use ExpressionBuilder::or() instead.' + 'ExpressionBuilder::orX() is deprecated, use ExpressionBuilder::or() instead.', ); return new CompositeExpression(CompositeExpression::TYPE_OR, func_get_args()); diff --git a/src/Query/QueryBuilder.php b/src/Query/QueryBuilder.php index b790cdeab46..aebef6ae638 100644 --- a/src/Query/QueryBuilder.php +++ b/src/Query/QueryBuilder.php @@ -38,34 +38,22 @@ */ class QueryBuilder { - /** - * @deprecated - */ + /** @deprecated */ public const SELECT = 0; - /** - * @deprecated - */ + /** @deprecated */ public const DELETE = 1; - /** - * @deprecated - */ + /** @deprecated */ public const UPDATE = 2; - /** - * @deprecated - */ + /** @deprecated */ public const INSERT = 3; - /** - * @deprecated - */ + /** @deprecated */ public const STATE_DIRTY = 0; - /** - * @deprecated - */ + /** @deprecated */ public const STATE_CLEAN = 1; /** @@ -189,7 +177,7 @@ public function getType() 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5551', 'Relying on the type of the query being built is deprecated.' - . ' If necessary, track the type of the query being built outside of the builder.' + . ' If necessary, track the type of the query being built outside of the builder.', ); return $this->type; @@ -217,7 +205,7 @@ public function getState() Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5551', - 'Relying on the query builder state is deprecated as it is an internal concern.' + 'Relying on the query builder state is deprecated as it is an internal concern.', ); return $this->state; @@ -336,7 +324,7 @@ public function executeQuery(): Result $this->getSQL(), $this->params, $this->paramTypes, - $this->resultCacheProfile + $this->resultCacheProfile, ); } @@ -369,7 +357,7 @@ public function execute() Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4578', - 'QueryBuilder::execute() is deprecated, use QueryBuilder::executeQuery() for SQL queries instead.' + 'QueryBuilder::execute() is deprecated, use QueryBuilder::executeQuery() for SQL queries instead.', ); return $this->executeQuery(); @@ -378,7 +366,7 @@ public function execute() Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4578', - 'QueryBuilder::execute() is deprecated, use QueryBuilder::executeStatement() for SQL statements instead.' + 'QueryBuilder::execute() is deprecated, use QueryBuilder::executeStatement() for SQL statements instead.', ); return $this->connection->executeStatement($this->getSQL(), $this->params, $this->paramTypes); @@ -453,7 +441,7 @@ public function setParameter($key, $value, $type = ParameterType::STRING) 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5550', 'Using NULL as prepared statement parameter type is deprecated.' - . 'Omit or use Parameter::STRING instead' + . 'Omit or use Parameter::STRING instead', ); } @@ -666,7 +654,7 @@ public function select($select = null/*, string ...$selects*/) 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/3837', 'Passing an array for the first argument to QueryBuilder::select() is deprecated, ' . - 'pass each value as an individual variadic argument instead.' + 'pass each value as an individual variadic argument instead.', ); } @@ -725,7 +713,7 @@ public function addSelect($select = null/*, string ...$selects*/) 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/3837', 'Passing an array for the first argument to QueryBuilder::addSelect() is deprecated, ' . - 'pass each value as an individual variadic argument instead.' + 'pass each value as an individual variadic argument instead.', ); } @@ -1106,7 +1094,7 @@ public function groupBy($groupBy/*, string ...$groupBys*/) 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/3837', 'Passing an array for the first argument to QueryBuilder::groupBy() is deprecated, ' . - 'pass each value as an individual variadic argument instead.' + 'pass each value as an individual variadic argument instead.', ); } @@ -1144,7 +1132,7 @@ public function addGroupBy($groupBy/*, string ...$groupBys*/) 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/3837', 'Passing an array for the first argument to QueryBuilder::addGroupBy() is deprecated, ' . - 'pass each value as an individual variadic argument instead.' + 'pass each value as an individual variadic argument instead.', ); } @@ -1349,9 +1337,7 @@ public function resetQueryPart($queryPartName) return $this; } - /** - * @throws QueryException - */ + /** @throws QueryException */ private function getSQLForSelect(): string { $query = 'SELECT ' . ($this->sqlParts['distinct'] ? 'DISTINCT ' : '') . @@ -1367,7 +1353,7 @@ private function getSQLForSelect(): string return $this->connection->getDatabasePlatform()->modifyLimitQuery( $query, $this->maxResults, - $this->firstResult + $this->firstResult, ); } diff --git a/src/Query/QueryException.php b/src/Query/QueryException.php index 58e941e9843..90d1f47d932 100644 --- a/src/Query/QueryException.php +++ b/src/Query/QueryException.php @@ -6,9 +6,7 @@ use function implode; -/** - * @psalm-immutable - */ +/** @psalm-immutable */ class QueryException extends Exception { /** diff --git a/src/Result.php b/src/Result.php index 9ff923d1647..0426fd48f2e 100644 --- a/src/Result.php +++ b/src/Result.php @@ -18,9 +18,7 @@ class Result private DriverResult $result; private Connection $connection; - /** - * @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(DriverResult $result, Connection $connection) { $this->result = $result; @@ -225,9 +223,7 @@ public function iterateColumn(): Traversable } } - /** - * @throws Exception - */ + /** @throws Exception */ public function rowCount(): int { try { @@ -237,9 +233,7 @@ public function rowCount(): int } } - /** - * @throws Exception - */ + /** @throws Exception */ public function columnCount(): int { try { @@ -254,9 +248,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 8c270fb3231..2e392e661b2 100644 --- a/src/SQL/Builder/CreateSchemaObjectsSQLBuilder.php +++ b/src/SQL/Builder/CreateSchemaObjectsSQLBuilder.php @@ -29,7 +29,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/AbstractAsset.php b/src/Schema/AbstractAsset.php index 69e337602bb..ab8fdec0303 100644 --- a/src/Schema/AbstractAsset.php +++ b/src/Schema/AbstractAsset.php @@ -123,7 +123,7 @@ public function getFullQualifiedName($defaultNamespaceName) 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4814', 'AbstractAsset::getFullQualifiedName() is deprecated.' - . ' Use AbstractAsset::getNamespaceName() and ::getName() instead.' + . ' Use AbstractAsset::getNamespaceName() and ::getName() instead.', ); $name = $this->getName(); diff --git a/src/Schema/AbstractSchemaManager.php b/src/Schema/AbstractSchemaManager.php index 0359cda07da..449f07c2ada 100644 --- a/src/Schema/AbstractSchemaManager.php +++ b/src/Schema/AbstractSchemaManager.php @@ -49,9 +49,7 @@ abstract class AbstractSchemaManager */ protected $_platform; - /** - * @param T $platform - */ + /** @param T $platform */ public function __construct(Connection $connection, AbstractPlatform $platform) { $this->_conn = $connection; @@ -71,7 +69,7 @@ public function getDatabasePlatform() 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5387', 'AbstractSchemaManager::getDatabasePlatform() is deprecated.' - . ' Use Connection::getDatabasePlatform() instead.' + . ' Use Connection::getDatabasePlatform() instead.', ); return $this->_platform; @@ -96,7 +94,7 @@ public function tryMethod() Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4897', - 'AbstractSchemaManager::tryMethod() is deprecated.' + 'AbstractSchemaManager::tryMethod() is deprecated.', ); $args = func_get_args(); @@ -145,7 +143,7 @@ public function listNamespaceNames() 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4503', 'AbstractSchemaManager::listNamespaceNames() is deprecated,' - . ' use AbstractSchemaManager::listSchemaNames() instead.' + . ' use AbstractSchemaManager::listSchemaNames() instead.', ); $sql = $this->_platform->getListNamespacesSQL(); @@ -184,7 +182,7 @@ public function listSequences($database = null) Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/5284', - 'Passing $database to AbstractSchemaManager::listSequences() is deprecated.' + 'Passing $database to AbstractSchemaManager::listSequences() is deprecated.', ); } @@ -220,7 +218,7 @@ public function listTableColumns($table, $database = null) Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/5284', - 'Passing $database to AbstractSchemaManager::listTableColumns() is deprecated.' + 'Passing $database to AbstractSchemaManager::listTableColumns() is deprecated.', ); } @@ -247,7 +245,7 @@ protected function doListTableColumns($table, $database = null): array Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/5284', - 'Passing $database to AbstractSchemaManager::listTableColumns() is deprecated.' + 'Passing $database to AbstractSchemaManager::listTableColumns() is deprecated.', ); } @@ -255,7 +253,7 @@ protected function doListTableColumns($table, $database = null): array $table, $database, $this->selectTableColumns($database, $this->normalizeName($table)) - ->fetchAllAssociative() + ->fetchAllAssociative(), ); } @@ -294,9 +292,9 @@ protected function doListTableIndexes($table): array return $this->_getPortableTableIndexesList( $this->selectIndexColumns( $database, - $table + $table, )->fetchAllAssociative(), - $table + $table, ); } @@ -318,7 +316,7 @@ public function tablesExist($names) 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/3580', 'The usage of a string $tableNames in AbstractSchemaManager::tablesExist() is deprecated. ' . - 'Pass a one-element array instead.' + 'Pass a one-element array instead.', ); } @@ -356,8 +354,8 @@ protected function doListTableNames(): array return $this->filterAssetNames( $this->_getPortableTablesList( $this->selectTableNames($database) - ->fetchAllAssociative() - ) + ->fetchAllAssociative(), + ), ); } @@ -426,7 +424,7 @@ protected function doListTables(): array $this->_getPortableTableIndexesList($indexColumnsByTable[$tableName] ?? [], $tableName), [], $this->_getPortableTableForeignKeysList($foreignKeyColumnsByTable[$tableName] ?? []), - $tableOptionsByTable[$tableName] ?? [] + $tableOptionsByTable[$tableName] ?? [], ); } @@ -479,7 +477,7 @@ protected function doListTableDetails($name): Table $this->listTableIndexes($name), [], $foreignKeys, - $tableOptionsByTable[$normalizedName] ?? [] + $tableOptionsByTable[$normalizedName] ?? [], ); } @@ -580,7 +578,7 @@ protected function fetchForeignKeyColumnsByTable(string $databaseName): array } return $this->fetchAllAssociativeGrouped( - $this->selectForeignKeyColumns($databaseName) + $this->selectForeignKeyColumns($databaseName), ); } @@ -631,7 +629,7 @@ public function listTableForeignKeys($table, $database = null) Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/5284', - 'Passing $database to AbstractSchemaManager::listTableForeignKeys() is deprecated.' + 'Passing $database to AbstractSchemaManager::listTableForeignKeys() is deprecated.', ); } @@ -657,15 +655,15 @@ protected function doListTableForeignKeys($table, $database = null): array Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/5284', - 'Passing $database to AbstractSchemaManager::listTableForeignKeys() is deprecated.' + 'Passing $database to AbstractSchemaManager::listTableForeignKeys() is deprecated.', ); } return $this->_getPortableTableForeignKeysList( $this->selectForeignKeyColumns( $database, - $this->normalizeName($table) - )->fetchAllAssociative() + $this->normalizeName($table), + )->fetchAllAssociative(), ); } @@ -728,7 +726,7 @@ public function dropIndex($index, $table) 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4798', 'Passing $index as an Index object to %s is deprecated. Pass it as a quoted name instead.', - __METHOD__ + __METHOD__, ); $index = $index->getQuotedName($this->_platform); @@ -739,7 +737,7 @@ public function dropIndex($index, $table) 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4798', 'Passing $table as an Table object to %s is deprecated. Pass it as a quoted name instead.', - __METHOD__ + __METHOD__, ); $table = $table->getQuotedName($this->_platform); @@ -766,7 +764,7 @@ public function dropConstraint(Constraint $constraint, $table) 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4798', 'Passing $table as a Table object to %s is deprecated. Pass it as a quoted name instead.', - __METHOD__ + __METHOD__, ); $table = $table->getQuotedName($this->_platform); @@ -774,7 +772,7 @@ public function dropConstraint(Constraint $constraint, $table) $this->_execSql($this->_platform->getDropConstraintSQL( $constraint->getQuotedName($this->_platform), - $table + $table, )); } @@ -796,7 +794,7 @@ public function dropForeignKey($foreignKey, $table) 'https://github.com/doctrine/dbal/issues/4798', 'Passing $foreignKey as a ForeignKeyConstraint object to %s is deprecated.' . ' Pass it as a quoted name instead.', - __METHOD__ + __METHOD__, ); $foreignKey = $foreignKey->getQuotedName($this->_platform); @@ -807,7 +805,7 @@ public function dropForeignKey($foreignKey, $table) 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4798', 'Passing $table as a Table object to %s is deprecated. Pass it as a quoted name instead.', - __METHOD__ + __METHOD__, ); $table = $table->getQuotedName($this->_platform); @@ -856,9 +854,7 @@ public function dropView($name) /* create*() Methods */ - /** - * @throws Exception - */ + /** @throws Exception */ public function createSchemaObjects(Schema $schema): void { $this->_execSql($schema->toSql($this->_platform)); @@ -974,9 +970,7 @@ public function createView(View $view) /* dropAndCreate*() Methods */ - /** - * @throws Exception - */ + /** @throws Exception */ public function dropSchemaObjects(Schema $schema): void { $this->_execSql($schema->toDropSql($this->_platform)); @@ -1007,7 +1001,7 @@ public function dropAndCreateConstraint(Constraint $constraint, $table) . ' Use AbstractSchemaManager::dropIndex() and AbstractSchemaManager::createIndex(),' . ' AbstractSchemaManager::dropForeignKey() and AbstractSchemaManager::createForeignKey()' . ' or AbstractSchemaManager::dropUniqueConstraint()' - . ' and AbstractSchemaManager::createUniqueConstraint() instead.' + . ' and AbstractSchemaManager::createUniqueConstraint() instead.', ); $this->tryMethod('dropConstraint', $constraint, $table); @@ -1031,7 +1025,7 @@ public function dropAndCreateIndex(Index $index, $table) 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4897', 'AbstractSchemaManager::dropAndCreateIndex() is deprecated.' - . ' Use AbstractSchemaManager::dropIndex() and AbstractSchemaManager::createIndex() instead.' + . ' Use AbstractSchemaManager::dropIndex() and AbstractSchemaManager::createIndex() instead.', ); $this->tryMethod('dropIndex', $index->getQuotedName($this->_platform), $table); @@ -1057,7 +1051,7 @@ public function dropAndCreateForeignKey(ForeignKeyConstraint $foreignKey, $table 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4897', 'AbstractSchemaManager::dropAndCreateForeignKey() is deprecated.' - . ' Use AbstractSchemaManager::dropForeignKey() and AbstractSchemaManager::createForeignKey() instead.' + . ' Use AbstractSchemaManager::dropForeignKey() and AbstractSchemaManager::createForeignKey() instead.', ); $this->tryMethod('dropForeignKey', $foreignKey, $table); @@ -1079,7 +1073,7 @@ public function dropAndCreateSequence(Sequence $sequence) 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4897', 'AbstractSchemaManager::dropAndCreateSequence() is deprecated.' - . ' Use AbstractSchemaManager::dropSequence() and AbstractSchemaManager::createSequence() instead.' + . ' Use AbstractSchemaManager::dropSequence() and AbstractSchemaManager::createSequence() instead.', ); $this->tryMethod('dropSequence', $sequence->getQuotedName($this->_platform)); @@ -1101,7 +1095,7 @@ public function dropAndCreateTable(Table $table) 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4897', 'AbstractSchemaManager::dropAndCreateTable() is deprecated.' - . ' Use AbstractSchemaManager::dropTable() and AbstractSchemaManager::createTable() instead.' + . ' Use AbstractSchemaManager::dropTable() and AbstractSchemaManager::createTable() instead.', ); $this->tryMethod('dropTable', $table->getQuotedName($this->_platform)); @@ -1125,7 +1119,7 @@ public function dropAndCreateDatabase($database) 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4897', 'AbstractSchemaManager::dropAndCreateDatabase() is deprecated.' - . ' Use AbstractSchemaManager::dropDatabase() and AbstractSchemaManager::createDatabase() instead.' + . ' Use AbstractSchemaManager::dropDatabase() and AbstractSchemaManager::createDatabase() instead.', ); $this->tryMethod('dropDatabase', $database); @@ -1147,7 +1141,7 @@ public function dropAndCreateView(View $view) 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4897', 'AbstractSchemaManager::dropAndCreateView() is deprecated.' - . ' Use AbstractSchemaManager::dropView() and AbstractSchemaManager::createView() instead.' + . ' Use AbstractSchemaManager::dropView() and AbstractSchemaManager::createView() instead.', ); $this->tryMethod('dropView', $view->getQuotedName($this->_platform)); @@ -1246,7 +1240,7 @@ protected function getPortableNamespacesList(array $namespaces) 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4503', 'AbstractSchemaManager::getPortableNamespacesList() is deprecated,' - . ' use AbstractSchemaManager::listSchemaNames() instead.' + . ' use AbstractSchemaManager::listSchemaNames() instead.', ); $namespacesList = []; @@ -1283,7 +1277,7 @@ protected function getPortableNamespaceDefinition(array $namespace) 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4503', 'AbstractSchemaManager::getPortableNamespaceDefinition() is deprecated,' - . ' use AbstractSchemaManager::listSchemaNames() instead.' + . ' use AbstractSchemaManager::listSchemaNames() instead.', ); return $namespace; @@ -1441,7 +1435,7 @@ protected function _getPortableTableIndexesList($tableIndexes, $tableName = null $data['unique'], $data['primary'], $data['flags'], - $data['options'] + $data['options'], ); } @@ -1632,7 +1626,7 @@ public function getSchemaSearchPaths() Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4821', - 'AbstractSchemaManager::getSchemaSearchPaths() is deprecated.' + 'AbstractSchemaManager::getSchemaSearchPaths() is deprecated.', ); $database = $this->_conn->getDatabase(); @@ -1681,9 +1675,7 @@ public function removeDoctrineTypeFromComment($comment, $type) return str_replace('(DC2Type:' . $type . ')', '', $comment); } - /** - * @throws Exception - */ + /** @throws Exception */ private function getDatabase(string $methodName): string { $database = $this->_conn->getDatabase(); diff --git a/src/Schema/Column.php b/src/Schema/Column.php index 31963461c35..8a5703c0a22 100644 --- a/src/Schema/Column.php +++ b/src/Schema/Column.php @@ -95,9 +95,7 @@ public function setOptions(array $options) return $this; } - /** - * @return Column - */ + /** @return Column */ public function setType(Type $type) { $this->_type = $type; @@ -238,73 +236,55 @@ public function setColumnDefinition($value) return $this; } - /** - * @return Type - */ + /** @return Type */ public function getType() { return $this->_type; } - /** - * @return int|null - */ + /** @return int|null */ public function getLength() { return $this->_length; } - /** - * @return int - */ + /** @return int */ public function getPrecision() { return $this->_precision; } - /** - * @return int - */ + /** @return int */ public function getScale() { return $this->_scale; } - /** - * @return bool - */ + /** @return bool */ public function getUnsigned() { return $this->_unsigned; } - /** - * @return bool - */ + /** @return bool */ public function getFixed() { return $this->_fixed; } - /** - * @return bool - */ + /** @return bool */ public function getNotnull() { return $this->_notnull; } - /** - * @return string|null - */ + /** @return string|null */ public function getDefault() { return $this->_default; } - /** - * @return mixed[] - */ + /** @return mixed[] */ public function getPlatformOptions() { return $this->_platformOptions; @@ -330,17 +310,13 @@ public function getPlatformOption($name) return $this->_platformOptions[$name]; } - /** - * @return string|null - */ + /** @return string|null */ public function getColumnDefinition() { return $this->_columnDefinition; } - /** - * @return bool - */ + /** @return bool */ public function getAutoincrement() { return $this->_autoincrement; @@ -370,9 +346,7 @@ public function setComment($comment) return $this; } - /** - * @return string|null - */ + /** @return string|null */ public function getComment() { return $this->_comment; @@ -391,7 +365,7 @@ public function setCustomSchemaOption($name, $value) Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5476', - 'Column::setCustomSchemaOption() is deprecated. Use setPlatformOption() instead.' + 'Column::setCustomSchemaOption() is deprecated. Use setPlatformOption() instead.', ); $this->_customSchemaOptions[$name] = $value; @@ -411,7 +385,7 @@ public function hasCustomSchemaOption($name) Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5476', - 'Column::hasCustomSchemaOption() is deprecated. Use hasPlatformOption() instead.' + 'Column::hasCustomSchemaOption() is deprecated. Use hasPlatformOption() instead.', ); return isset($this->_customSchemaOptions[$name]); @@ -429,7 +403,7 @@ public function getCustomSchemaOption($name) Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5476', - 'Column::getCustomSchemaOption() is deprecated. Use getPlatformOption() instead.' + 'Column::getCustomSchemaOption() is deprecated. Use getPlatformOption() instead.', ); return $this->_customSchemaOptions[$name]; @@ -447,7 +421,7 @@ public function setCustomSchemaOptions(array $customSchemaOptions) Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5476', - 'Column::setCustomSchemaOptions() is deprecated. Use setPlatformOptions() instead.' + 'Column::setCustomSchemaOptions() is deprecated. Use setPlatformOptions() instead.', ); $this->_customSchemaOptions = $customSchemaOptions; @@ -465,15 +439,13 @@ public function getCustomSchemaOptions() Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5476', - 'Column::getCustomSchemaOptions() is deprecated. Use getPlatformOptions() instead.' + 'Column::getCustomSchemaOptions() is deprecated. Use getPlatformOptions() instead.', ); return $this->_customSchemaOptions; } - /** - * @return mixed[] - */ + /** @return mixed[] */ public function toArray() { return array_merge([ diff --git a/src/Schema/ColumnDiff.php b/src/Schema/ColumnDiff.php index 83402fd0f3e..4eccc242bc6 100644 --- a/src/Schema/ColumnDiff.php +++ b/src/Schema/ColumnDiff.php @@ -38,7 +38,7 @@ public function __construct( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4785', 'Not passing the $fromColumn to %s is deprecated.', - __METHOD__ + __METHOD__, ); } @@ -58,9 +58,7 @@ public function hasChanged($propertyName) return in_array($propertyName, $this->changedProperties, true); } - /** - * @return Identifier - */ + /** @return Identifier */ public function getOldColumnName() { $quote = $this->fromColumn !== null && $this->fromColumn->isQuoted(); diff --git a/src/Schema/Comparator.php b/src/Schema/Comparator.php index 166edcbd9ea..189dbb1a4f1 100644 --- a/src/Schema/Comparator.php +++ b/src/Schema/Comparator.php @@ -29,9 +29,7 @@ class Comparator { private ?AbstractPlatform $platform = null; - /** - * @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(?AbstractPlatform $platform = null) { if ($platform === null) { @@ -40,16 +38,14 @@ public function __construct(?AbstractPlatform $platform = null) 'https://github.com/doctrine/dbal/pull/4746', 'Not passing a $platform to %s is deprecated.' . ' Use AbstractSchemaManager::createComparator() to instantiate the comparator.', - __METHOD__ + __METHOD__, ); } $this->platform = $platform; } - /** - * @param list $args - */ + /** @param list $args */ public function __call(string $method, array $args): SchemaDiff { if ($method !== 'compareSchemas') { @@ -59,9 +55,7 @@ public function __call(string $method, array $args): SchemaDiff return $this->doCompareSchemas(...$args); } - /** - * @param list $args - */ + /** @param list $args */ public static function __callStatic(string $method, array $args): SchemaDiff { if ($method !== 'compareSchemas') { @@ -73,7 +67,7 @@ public static function __callStatic(string $method, array $args): SchemaDiff 'https://github.com/doctrine/dbal/pull/4707', 'Calling %s::%s() statically is deprecated.', self::class, - $method + $method, ); $comparator = new self(); @@ -122,7 +116,7 @@ private function doCompareSchemas( } else { $tableDifferences = $this->diffTable( $fromSchema->getTable($tableName), - $toSchema->getTable($tableName) + $toSchema->getTable($tableName), ); if ($tableDifferences !== false) { @@ -228,7 +222,7 @@ public function compare(Schema $fromSchema, Schema $toSchema) Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4707', - 'Method compare() is deprecated. Use a non-static call to compareSchemas() instead.' + 'Method compare() is deprecated. Use a non-static call to compareSchemas() instead.', ); return $this->compareSchemas($fromSchema, $toSchema); @@ -249,9 +243,7 @@ private function isAutoIncrementSequenceInSchema($schema, $sequence): bool return false; } - /** - * @return bool - */ + /** @return bool */ public function diffSequence(Sequence $sequence1, Sequence $sequence2) { if ($sequence1->getAllocationSize() !== $sequence2->getAllocationSize()) { @@ -315,7 +307,7 @@ public function diffTable(Table $fromTable, Table $toTable) $column->getName(), $toColumn, $changedProperties, - $column + $column, ); $changes++; @@ -425,7 +417,7 @@ private function detectColumnRenamings(TableDiff $tableDifferences): void $tableDifferences->renamedColumns[$removedColumnName] = $addedColumn; unset( $tableDifferences->addedColumns[$addedColumnName], - $tableDifferences->removedColumns[strtolower($removedColumnName)] + $tableDifferences->removedColumns[strtolower($removedColumnName)], ); } } @@ -470,14 +462,12 @@ private function detectIndexRenamings(TableDiff $tableDifferences): void $tableDifferences->renamedIndexes[$removedIndexName] = $addedIndex; unset( $tableDifferences->addedIndexes[$addedIndexName], - $tableDifferences->removedIndexes[$removedIndexName] + $tableDifferences->removedIndexes[$removedIndexName], ); } } - /** - * @return bool - */ + /** @return bool */ public function diffForeignKey(ForeignKeyConstraint $key1, ForeignKeyConstraint $key2) { if ( diff --git a/src/Schema/Constraint.php b/src/Schema/Constraint.php index 85338c783ea..f47ee1fd138 100644 --- a/src/Schema/Constraint.php +++ b/src/Schema/Constraint.php @@ -11,14 +11,10 @@ */ interface Constraint { - /** - * @return string - */ + /** @return string */ public function getName(); - /** - * @return string - */ + /** @return string */ public function getQuotedName(AbstractPlatform $platform); /** diff --git a/src/Schema/DB2SchemaManager.php b/src/Schema/DB2SchemaManager.php index e29b7c0ad1e..9d926040868 100644 --- a/src/Schema/DB2SchemaManager.php +++ b/src/Schema/DB2SchemaManager.php @@ -192,7 +192,7 @@ protected function _getPortableTableForeignKeyDefinition($tableForeignKey) $tableForeignKey['foreign_table'], $tableForeignKey['foreign_columns'], $tableForeignKey['name'], - $tableForeignKey['options'] + $tableForeignKey['options'], ); } 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/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/Index.php b/src/Schema/Index.php index c42c331a8a7..97ca1989d3d 100644 --- a/src/Schema/Index.php +++ b/src/Schema/Index.php @@ -77,9 +77,7 @@ public function __construct( } } - /** - * @throws InvalidArgumentException - */ + /** @throws InvalidArgumentException */ protected function _addColumn(string $column): void { $this->_columns[$column] = new Identifier($column); @@ -118,9 +116,7 @@ public function getQuotedColumns(AbstractPlatform $platform) return $columns; } - /** - * @return string[] - */ + /** @return string[] */ public function getUnquotedColumns() { return array_map([$this, 'trimQuotes'], $this->getColumns()); @@ -136,17 +132,13 @@ public function isSimpleIndex() return ! $this->_isPrimary && ! $this->_isUnique; } - /** - * @return bool - */ + /** @return bool */ public function isUnique() { return $this->_isUnique; } - /** - * @return bool - */ + /** @return bool */ public function isPrimary() { return $this->_isPrimary; @@ -326,9 +318,7 @@ public function getOption($name) return $this->options[strtolower($name)]; } - /** - * @return mixed[] - */ + /** @return mixed[] */ public function getOptions() { return $this->options; diff --git a/src/Schema/MySQLSchemaManager.php b/src/Schema/MySQLSchemaManager.php index 7a1fb629659..df55b59ce3f 100644 --- a/src/Schema/MySQLSchemaManager.php +++ b/src/Schema/MySQLSchemaManager.php @@ -31,9 +31,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", "\\'" => "'", @@ -198,7 +196,7 @@ protected function _getPortableTableColumnDefinition($tableColumn) preg_match( '([A-Za-z]+\(([0-9]+),([0-9]+)\))', $tableColumn['type'], - $match + $match, ) === 1 ) { $precision = $match[1]; @@ -368,7 +366,7 @@ protected function _getPortableTableForeignKeyDefinition($tableForeignKey): Fore [ 'onDelete' => $tableForeignKey['onDelete'], 'onUpdate' => $tableForeignKey['onUpdate'], - ] + ], ); } @@ -377,8 +375,8 @@ public function createComparator(): Comparator return new MySQL\Comparator( $this->_platform, new CachingCollationMetadataProvider( - new ConnectionCollationMetadataProvider($this->_conn) - ) + new ConnectionCollationMetadataProvider($this->_conn), + ), ); } @@ -551,9 +549,7 @@ protected function fetchTableOptionsByTable(string $databaseName, ?string $table return $tableOptions; } - /** - * @return string[]|true[] - */ + /** @return string[]|true[] */ private function parseCreateOptions(?string $string): array { $options = []; diff --git a/src/Schema/OracleSchemaManager.php b/src/Schema/OracleSchemaManager.php index 8ed7e7ea7f5..eb7a2a44c3a 100644 --- a/src/Schema/OracleSchemaManager.php +++ b/src/Schema/OracleSchemaManager.php @@ -267,7 +267,7 @@ protected function _getPortableTableForeignKeyDefinition($tableForeignKey): Fore $this->getQuotedIdentifierName($tableForeignKey['foreignTable']), array_values($tableForeignKey['foreign']), $this->getQuotedIdentifierName($tableForeignKey['name']), - ['onDelete' => $tableForeignKey['onDelete']] + ['onDelete' => $tableForeignKey['onDelete']], ); } @@ -281,7 +281,7 @@ protected function _getPortableSequenceDefinition($sequence) return new Sequence( $this->getQuotedIdentifierName($sequence['sequence_name']), (int) $sequence['increment_by'], - (int) $sequence['min_value'] + (int) $sequence['min_value'], ); } diff --git a/src/Schema/PostgreSQLSchemaManager.php b/src/Schema/PostgreSQLSchemaManager.php index cb9a39fc9a9..4040bf77ce9 100644 --- a/src/Schema/PostgreSQLSchemaManager.php +++ b/src/Schema/PostgreSQLSchemaManager.php @@ -103,7 +103,7 @@ public function getSchemaNames() 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4503', 'PostgreSQLSchemaManager::getSchemaNames() is deprecated,' - . ' use PostgreSQLSchemaManager::listSchemaNames() instead.' + . ' use PostgreSQLSchemaManager::listSchemaNames() instead.', ); return $this->listNamespaceNames(); @@ -120,7 +120,7 @@ public function listSchemaNames(): array FROM information_schema.schemata WHERE schema_name NOT LIKE 'pg\_%' AND schema_name != 'information_schema' -SQL +SQL, ); } @@ -134,7 +134,7 @@ public function getSchemaSearchPaths() Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4821', - 'PostgreSQLSchemaManager::getSchemaSearchPaths() is deprecated.' + 'PostgreSQLSchemaManager::getSchemaSearchPaths() is deprecated.', ); $params = $this->_conn->getParams(); @@ -220,7 +220,7 @@ protected function _getPortableTableForeignKeyDefinition($tableForeignKey) preg_match( '(ON UPDATE ([a-zA-Z0-9]+( (NULL|ACTION|DEFAULT))?))', $tableForeignKey['condef'], - $match + $match, ) === 1 ) { $onUpdate = $match[1]; @@ -230,7 +230,7 @@ protected function _getPortableTableForeignKeyDefinition($tableForeignKey) preg_match( '(ON DELETE ([a-zA-Z0-9]+( (NULL|ACTION|DEFAULT))?))', $tableForeignKey['condef'], - $match + $match, ) === 1 ) { $onDelete = $match[1]; @@ -250,7 +250,7 @@ protected function _getPortableTableForeignKeyDefinition($tableForeignKey) $foreignTable, $foreignColumns, $tableForeignKey['conname'], - ['onUpdate' => $onUpdate, 'onDelete' => $onDelete] + ['onUpdate' => $onUpdate, 'onDelete' => $onDelete], ); } @@ -289,7 +289,7 @@ protected function _getPortableTableIndexesList($tableIndexes, $tableName = null $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->_conn->fetchAllAssociative($columnNameSql); @@ -334,7 +334,7 @@ protected function getPortableNamespaceDefinition(array $namespace) 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4503', 'PostgreSQLSchemaManager::getPortableNamespaceDefinition() is deprecated,' - . ' use PostgreSQLSchemaManager::listSchemaNames() instead.' + . ' use PostgreSQLSchemaManager::listSchemaNames() instead.', ); return $namespace['nspname']; @@ -484,7 +484,7 @@ protected function _getPortableTableColumnDefinition($tableColumn) preg_match( '([A-Za-z]+\(([0-9]+),([0-9]+)\))', $tableColumn['complete_type'], - $match + $match, ) === 1 ) { $precision = $match[1]; @@ -508,7 +508,7 @@ protected function _getPortableTableColumnDefinition($tableColumn) $tableColumn['default'] !== null && preg_match( "('([^']+)'::)", $tableColumn['default'], - $match + $match, ) === 1 ) { $tableColumn['default'] = $match[1]; @@ -545,7 +545,7 @@ protected function _getPortableTableColumnDefinition($tableColumn) DEPRECATION, get_class($column->getType()), JsonType::class, - Types::JSON + Types::JSON, ); } diff --git a/src/Schema/SQLServerSchemaManager.php b/src/Schema/SQLServerSchemaManager.php index 801d9286315..e5c41cd0f89 100644 --- a/src/Schema/SQLServerSchemaManager.php +++ b/src/Schema/SQLServerSchemaManager.php @@ -90,7 +90,7 @@ public function listSchemaNames(): array SELECT name FROM sys.schemas WHERE name NOT IN('guest', 'INFORMATION_SCHEMA', 'sys') -SQL +SQL, ); } @@ -253,7 +253,7 @@ protected function _getPortableTableForeignKeyDefinition($tableForeignKey) $tableForeignKey['foreign_table'], $tableForeignKey['foreign_columns'], $tableForeignKey['name'], - $tableForeignKey['options'] + $tableForeignKey['options'], ); } @@ -288,7 +288,7 @@ protected function getPortableNamespaceDefinition(array $namespace) 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4503', 'SQLServerSchemaManager::getPortableNamespaceDefinition() is deprecated,' - . ' use SQLServerSchemaManager::listSchemaNames() instead.' + . ' use SQLServerSchemaManager::listSchemaNames() instead.', ); return $namespace['name']; @@ -315,8 +315,8 @@ public function alterTable(TableDiff $tableDiff) sprintf( 'ALTER TABLE %s DROP CONSTRAINT %s', $tableDiff->name, - $constraint - ) + $constraint, + ), ); } } @@ -350,21 +350,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) { @@ -521,7 +517,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/Schema.php b/src/Schema/Schema.php index c6ef2468c5c..703c83c59e1 100644 --- a/src/Schema/Schema.php +++ b/src/Schema/Schema.php @@ -97,7 +97,7 @@ public function hasExplicitForeignKeyIndexes() Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4822', - 'Schema::hasExplicitForeignKeyIndexes() is deprecated.' + 'Schema::hasExplicitForeignKeyIndexes() is deprecated.', ); return $this->_schemaConfig->hasExplicitForeignKeyIndexes(); @@ -191,9 +191,7 @@ public function getTable($name) return $this->_tables[$name]; } - /** - * @param string $name - */ + /** @param string $name */ private function getFullQualifiedAssetName($name): string { $name = $this->getUnquotedAssetName($name); @@ -266,7 +264,7 @@ public function getTableNames() 'https://github.com/doctrine/dbal/pull/4800', 'Schema::getTableNames() is deprecated.' . ' Use Schema::getTables() and Table::getName() instead.', - __METHOD__ + __METHOD__, ); return array_keys($this->_tables); @@ -301,9 +299,7 @@ public function getSequence($name) return $this->_sequences[$name]; } - /** - * @return Sequence[] - */ + /** @return Sequence[] */ public function getSequences() { return $this->_sequences; @@ -489,7 +485,7 @@ public function visit(Visitor $visitor) Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5435', - 'Schema::visit() is deprecated.' + 'Schema::visit() is deprecated.', ); $visitor->acceptSchema($this); diff --git a/src/Schema/SchemaConfig.php b/src/Schema/SchemaConfig.php index 92e0701f075..5e394514bf8 100644 --- a/src/Schema/SchemaConfig.php +++ b/src/Schema/SchemaConfig.php @@ -35,7 +35,7 @@ public function hasExplicitForeignKeyIndexes() Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4822', - 'SchemaConfig::hasExplicitForeignKeyIndexes() is deprecated.' + 'SchemaConfig::hasExplicitForeignKeyIndexes() is deprecated.', ); return $this->hasExplicitForeignKeyIndexes; @@ -53,7 +53,7 @@ public function setExplicitForeignKeyIndexes($flag) Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4822', - 'SchemaConfig::setExplicitForeignKeyIndexes() is deprecated.' + 'SchemaConfig::setExplicitForeignKeyIndexes() is deprecated.', ); $this->hasExplicitForeignKeyIndexes = (bool) $flag; @@ -69,9 +69,7 @@ public function setMaxIdentifierLength($length) $this->maxIdentifierLength = (int) $length; } - /** - * @return int - */ + /** @return int */ public function getMaxIdentifierLength() { return $this->maxIdentifierLength; diff --git a/src/Schema/SchemaDiff.php b/src/Schema/SchemaDiff.php index 020abaddf50..0fa3f5fa6bf 100644 --- a/src/Schema/SchemaDiff.php +++ b/src/Schema/SchemaDiff.php @@ -95,9 +95,7 @@ public function toSaveSql(AbstractPlatform $platform) return $this->_toSql($platform, true); } - /** - * @return string[] - */ + /** @return string[] */ public function toSql(AbstractPlatform $platform) { return $this->_toSql($platform, false); diff --git a/src/Schema/SchemaException.php b/src/Schema/SchemaException.php index d4e22380ef4..89d529ae785 100644 --- a/src/Schema/SchemaException.php +++ b/src/Schema/SchemaException.php @@ -7,9 +7,7 @@ use function implode; use function sprintf; -/** - * @psalm-immutable - */ +/** @psalm-immutable */ class SchemaException extends Exception { public const TABLE_DOESNT_EXIST = 10; @@ -44,7 +42,7 @@ public static function indexNameInvalid($indexName) { 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, ); } @@ -58,7 +56,7 @@ public static function indexDoesNotExist($indexName, $table) { return new self( sprintf("Index '%s' does not exist on table '%s'.", $indexName, $table), - self::INDEX_DOESNT_EXIST + self::INDEX_DOESNT_EXIST, ); } @@ -72,7 +70,7 @@ public static function indexAlreadyExists($indexName, $table) { 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, ); } @@ -86,7 +84,7 @@ public static function columnDoesNotExist($columnName, $table) { return new self( sprintf("There is no column with name '%s' on table '%s'.", $columnName, $table), - self::COLUMN_DOESNT_EXIST + self::COLUMN_DOESNT_EXIST, ); } @@ -99,7 +97,7 @@ public static function namespaceAlreadyExists($namespaceName) { return new self( sprintf("The namespace with name '%s' already exists.", $namespaceName), - self::NAMESPACE_ALREADY_EXISTS + self::NAMESPACE_ALREADY_EXISTS, ); } @@ -123,7 +121,7 @@ public static function columnAlreadyExists($tableName, $columnName) { return new self( "The column '" . $columnName . "' on table '" . $tableName . "' already exists.", - self::COLUMN_ALREADY_EXISTS + self::COLUMN_ALREADY_EXISTS, ); } @@ -157,7 +155,7 @@ public static function uniqueConstraintDoesNotExist($constraintName, $table) { 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, ); } @@ -171,20 +169,18 @@ public static function foreignKeyDoesNotExist($fkName, $table) { return new self( sprintf("There exists no foreign key with the name '%s' on table '%s'.", $fkName, $table), - self::FOREIGNKEY_DOESNT_EXIST + self::FOREIGNKEY_DOESNT_EXIST, ); } - /** - * @return SchemaException - */ + /** @return SchemaException */ public static function namedForeignKeyRequired(Table $localTable, ForeignKeyConstraint $foreignKey) { return new self( 'The performed schema operation on ' . $localTable->getName() . ' requires a named foreign key, ' . 'but the given foreign key from (' . implode(', ', $foreignKey->getColumns()) . ') onto foreign table ' . "'" . $foreignKey->getForeignTableName() . "' (" . implode(', ', $foreignKey->getForeignColumns()) . ')' . - ' is currently unnamed.' + ' is currently unnamed.', ); } @@ -196,7 +192,7 @@ public static function namedForeignKeyRequired(Table $localTable, ForeignKeyCons public static function alterTableChangeNotSupported($changeName) { return new self( - sprintf("Alter table change not supported, given '%s'", $changeName) + sprintf("Alter table change not supported, given '%s'", $changeName), ); } } diff --git a/src/Schema/Sequence.php b/src/Schema/Sequence.php index 0790d12d8cd..527c63c357c 100644 --- a/src/Schema/Sequence.php +++ b/src/Schema/Sequence.php @@ -36,25 +36,19 @@ public function __construct($name, $allocationSize = 1, $initialValue = 1, $cach $this->cache = $cache; } - /** - * @return int - */ + /** @return int */ public function getAllocationSize() { return $this->allocationSize; } - /** - * @return int - */ + /** @return int */ public function getInitialValue() { return $this->initialValue; } - /** - * @return int|null - */ + /** @return int|null */ public function getCache() { return $this->cache; @@ -149,7 +143,7 @@ public function visit(Visitor $visitor) Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5435', - 'Sequence::visit() is deprecated.' + 'Sequence::visit() is deprecated.', ); $visitor->acceptSequence($this); diff --git a/src/Schema/SqliteSchemaManager.php b/src/Schema/SqliteSchemaManager.php index be42c68343c..7358a365c94 100644 --- a/src/Schema/SqliteSchemaManager.php +++ b/src/Schema/SqliteSchemaManager.php @@ -107,7 +107,7 @@ public function dropDatabase($database) Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4963', - 'SqliteSchemaManager::dropDatabase() is deprecated. Delete the database file using the filesystem.' + 'SqliteSchemaManager::dropDatabase() is deprecated. Delete the database file using the filesystem.', ); if (! file_exists($database)) { @@ -128,7 +128,7 @@ public function createDatabase($database) 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4963', 'SqliteSchemaManager::createDatabase() is deprecated.' - . ' The engine will create the database file automatically.' + . ' The engine will create the database file automatically.', ); $params = $this->_conn->getParams(); @@ -174,7 +174,7 @@ public function dropAndCreateForeignKey(ForeignKeyConstraint $foreignKey, $table 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4897', 'SqliteSchemaManager::dropAndCreateForeignKey() is deprecated.' - . ' Use SqliteSchemaManager::dropForeignKey() and SqliteSchemaManager::createForeignKey() instead.' + . ' Use SqliteSchemaManager::dropForeignKey() and SqliteSchemaManager::createForeignKey() instead.', ); $tableDiff = $this->getTableDiffForAlterForeignKey($table); @@ -243,7 +243,7 @@ static function (array $a, array $b): int { } return $a['pk'] - $b['pk']; - } + }, ); foreach ($indexArray as $indexColumnRow) { @@ -326,7 +326,7 @@ protected function _getPortableTableColumnList($table, $database, $tableColumns) if ($type instanceof StringType || $type instanceof TextType) { $column->setPlatformOption( 'collation', - $this->parseColumnCollationFromSQL($columnName, $createSql) ?? 'BINARY' + $this->parseColumnCollationFromSQL($columnName, $createSql) ?? 'BINARY', ); } @@ -494,7 +494,7 @@ protected function _getPortableTableForeignKeyDefinition($tableForeignKey): Fore 'onUpdate' => $tableForeignKey['onUpdate'], 'deferrable' => $tableForeignKey['deferrable'], 'deferred' => $tableForeignKey['deferred'], - ] + ], ); } @@ -561,9 +561,7 @@ private function parseColumnCommentFromSQL(string $column, string $sql): ?string return $comment === '' ? null : $comment; } - /** - * @throws Exception - */ + /** @throws Exception */ private function getCreateTableSQL(string $table): string { $sql = $this->_conn->fetchOne( @@ -580,7 +578,7 @@ private function getCreateTableSQL(string $table): string AND name = ? SQL , - [$table] + [$table], ); if ($sql !== false) { @@ -633,7 +631,7 @@ private function getForeignKeyDetails($table) (?:\s+INITIALLY\s+(DEFERRED|IMMEDIATE))? )?#isx', $createSql, - $match + $match, ) === 0 ) { return []; @@ -670,7 +668,7 @@ public function getSchemaSearchPaths() Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4821', - 'SqliteSchemaManager::getSchemaSearchPaths() is deprecated.' + 'SqliteSchemaManager::getSchemaSearchPaths() is deprecated.', ); // SQLite does not support schemas or databases @@ -698,7 +696,7 @@ protected function selectTableNames(string $databaseName): Result protected function selectTableColumns(string $databaseName, ?string $tableName = null): Result { - $sql = <<_options = array_merge($this->_options, $options); } - /** - * @return void - */ + /** @return void */ public function setSchemaConfig(SchemaConfig $schemaConfig) { $this->_schemaConfig = $schemaConfig; } - /** - * @return int - */ + /** @return int */ protected function _getMaxIdentifierLength() { if ($this->_schemaConfig instanceof SchemaConfig) { @@ -152,7 +148,7 @@ public function addIndex(array $columnNames, ?string $indexName = null, array $f $indexName ??= $this->_generateIdentifierName( array_merge([$this->getName()], $columnNames), 'idx', - $this->_getMaxIdentifierLength() + $this->_getMaxIdentifierLength(), ); return $this->_addIndex($this->_createIndex($columnNames, $indexName, false, false, $flags, $options)); @@ -174,7 +170,7 @@ public function addUniqueConstraint( $indexName ??= $this->_generateIdentifierName( array_merge([$this->getName()], $columnNames), 'uniq', - $this->_getMaxIdentifierLength() + $this->_getMaxIdentifierLength(), ); return $this->_addUniqueConstraint($this->_createUniqueConstraint($columnNames, $indexName, $flags, $options)); @@ -231,7 +227,7 @@ public function addUniqueIndex(array $columnNames, $indexName = null, array $opt $indexName ??= $this->_generateIdentifierName( array_merge([$this->getName()], $columnNames), 'uniq', - $this->_getMaxIdentifierLength() + $this->_getMaxIdentifierLength(), ); return $this->_addIndex($this->_createIndex($columnNames, $indexName, true, false, [], $options)); @@ -409,7 +405,7 @@ public function addForeignKeyConstraint( $name ??= $this->_generateIdentifierName( array_merge([$this->getName()], $localColumnNames), 'fk', - $this->_getMaxIdentifierLength() + $this->_getMaxIdentifierLength(), ); if ($foreignTable instanceof Table) { @@ -431,7 +427,7 @@ public function addForeignKeyConstraint( $foreignTable, $foreignColumnNames, $name, - $options + $options, ); return $this->_addForeignKeyConstraint($constraint); @@ -508,9 +504,7 @@ protected function _addIndex(Index $indexCandidate) return $this; } - /** - * @return self - */ + /** @return self */ protected function _addUniqueConstraint(UniqueConstraint $constraint): Table { $mergedNames = array_merge([$this->getName()], $constraint->getColumns()); @@ -540,9 +534,7 @@ protected function _addUniqueConstraint(UniqueConstraint $constraint): Table return $this; } - /** - * @return self - */ + /** @return self */ protected function _addForeignKeyConstraint(ForeignKeyConstraint $constraint) { $constraint->setLocalTable($this); @@ -553,7 +545,7 @@ protected function _addForeignKeyConstraint(ForeignKeyConstraint $constraint) $name = $this->_generateIdentifierName( array_merge([$this->getName()], $constraint->getLocalColumns()), 'fk', - $this->_getMaxIdentifierLength() + $this->_getMaxIdentifierLength(), ); } @@ -571,7 +563,7 @@ protected function _addForeignKeyConstraint(ForeignKeyConstraint $constraint) $indexName = $this->_generateIdentifierName( array_merge([$this->getName()], $constraint->getColumns()), 'idx', - $this->_getMaxIdentifierLength() + $this->_getMaxIdentifierLength(), ); $indexCandidate = $this->_createIndex($constraint->getColumns(), $indexName, false, false); @@ -695,7 +687,7 @@ public function getColumns() $foreignKeyColumns = $this->getForeignKeyColumns(); $remainderColumns = $this->filterColumns( array_merge(array_keys($primaryKeyColumns), array_keys($foreignKeyColumns)), - true + true, ); return array_merge($primaryKeyColumns, $foreignKeyColumns, $remainderColumns); @@ -840,9 +832,7 @@ public function getIndex($name) return $this->_indexes[$name]; } - /** - * @return Index[] - */ + /** @return Index[] */ public function getIndexes() { return $this->_indexes; @@ -888,9 +878,7 @@ public function getOption($name) return $this->_options[$name]; } - /** - * @return mixed[] - */ + /** @return mixed[] */ public function getOptions() { return $this->_options; @@ -908,7 +896,7 @@ public function visit(Visitor $visitor) Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5435', - 'Table::visit() is deprecated.' + 'Table::visit() is deprecated.', ); $visitor->acceptTable($this); diff --git a/src/Schema/TableDiff.php b/src/Schema/TableDiff.php index 82c912f71b1..074efd35d2e 100644 --- a/src/Schema/TableDiff.php +++ b/src/Schema/TableDiff.php @@ -134,13 +134,11 @@ public function __construct( public function getName(AbstractPlatform $platform) { return new Identifier( - $this->fromTable instanceof Table ? $this->fromTable->getQuotedName($platform) : $this->name + $this->fromTable instanceof Table ? $this->fromTable->getQuotedName($platform) : $this->name, ); } - /** - * @return Identifier|false - */ + /** @return Identifier|false */ public function getNewName() { if ($this->newName === false) { diff --git a/src/Schema/UniqueConstraint.php b/src/Schema/UniqueConstraint.php index ca9a3810fcb..85502e714b4 100644 --- a/src/Schema/UniqueConstraint.php +++ b/src/Schema/UniqueConstraint.php @@ -78,9 +78,7 @@ public function getQuotedColumns(AbstractPlatform $platform) return $columns; } - /** - * @return string[] - */ + /** @return string[] */ public function getUnquotedColumns(): array { return array_map([$this, 'trimQuotes'], $this->getColumns()); @@ -134,17 +132,13 @@ public function hasOption(string $name): bool return isset($this->options[strtolower($name)]); } - /** - * @return mixed - */ + /** @return mixed */ public function getOption(string $name) { return $this->options[strtolower($name)]; } - /** - * @return mixed[] - */ + /** @return mixed[] */ public function getOptions(): array { return $this->options; diff --git a/src/Schema/View.php b/src/Schema/View.php index ac8d6cb5cb4..b19f2ad1fdb 100644 --- a/src/Schema/View.php +++ b/src/Schema/View.php @@ -20,9 +20,7 @@ public function __construct($name, $sql) $this->sql = $sql; } - /** - * @return string - */ + /** @return string */ public function getSql() { return $this->sql; diff --git a/src/Schema/Visitor/CreateSchemaSqlCollector.php b/src/Schema/Visitor/CreateSchemaSqlCollector.php index 1646e169c88..e7908c3ee05 100644 --- a/src/Schema/Visitor/CreateSchemaSqlCollector.php +++ b/src/Schema/Visitor/CreateSchemaSqlCollector.php @@ -10,9 +10,7 @@ use function array_merge; -/** - * @deprecated Use {@link CreateSchemaObjectsSQLBuilder} instead. - */ +/** @deprecated Use {@link CreateSchemaObjectsSQLBuilder} instead. */ class CreateSchemaSqlCollector extends AbstractVisitor { /** @var string[] */ @@ -34,7 +32,7 @@ public function __construct(AbstractPlatform $platform) Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5416', - 'CreateSchemaSqlCollector is deprecated. Use CreateSchemaObjectsSQLBuilder instead.' + 'CreateSchemaSqlCollector is deprecated. Use CreateSchemaObjectsSQLBuilder instead.', ); $this->platform = $platform; @@ -80,9 +78,7 @@ public function acceptSequence(Sequence $sequence) $this->createSequenceQueries[] = $this->platform->getCreateSequenceSQL($sequence); } - /** - * @return void - */ + /** @return void */ public function resetQueries() { $this->createNamespaceQueries = []; @@ -102,7 +98,7 @@ public function getQueries() $this->createNamespaceQueries, $this->createSequenceQueries, $this->createTableQueries, - $this->createFkConstraintQueries + $this->createFkConstraintQueries, ); } } diff --git a/src/Schema/Visitor/DropSchemaSqlCollector.php b/src/Schema/Visitor/DropSchemaSqlCollector.php index bb0111347be..0c5730258c0 100644 --- a/src/Schema/Visitor/DropSchemaSqlCollector.php +++ b/src/Schema/Visitor/DropSchemaSqlCollector.php @@ -30,7 +30,7 @@ public function __construct(AbstractPlatform $platform) Deprecation::trigger( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5416', - 'DropSchemaSqlCollector is deprecated. Use DropSchemaObjectsSQLBuilder instead.' + 'DropSchemaSqlCollector is deprecated. Use DropSchemaObjectsSQLBuilder instead.', ); $this->platform = $platform; @@ -65,17 +65,13 @@ public function acceptSequence(Sequence $sequence) $this->sequences->attach($sequence); } - /** - * @return void - */ + /** @return void */ public function clearQueries() { $this->initializeQueries(); } - /** - * @return string[] - */ + /** @return string[] */ public function getQueries() { $sql = []; @@ -85,7 +81,7 @@ public function getQueries() $localTable = $this->constraints[$fkConstraint]; $sql[] = $this->platform->getDropForeignKeySQL( $fkConstraint->getQuotedName($this->platform), - $localTable->getQuotedName($this->platform) + $localTable->getQuotedName($this->platform), ); } diff --git a/src/Schema/Visitor/Graphviz.php b/src/Schema/Visitor/Graphviz.php index cee0f622016..e3c61411e45 100644 --- a/src/Schema/Visitor/Graphviz.php +++ b/src/Schema/Visitor/Graphviz.php @@ -32,7 +32,7 @@ public function acceptForeignKey(Table $localTable, ForeignKeyConstraint $fkCons 'dir' => 'back', 'arrowtail' => 'dot', 'arrowhead' => 'normal', - ] + ], ); } @@ -59,7 +59,7 @@ public function acceptTable(Table $table) [ 'label' => $this->createTableLabel($table), 'shape' => 'plaintext', - ] + ], ); } diff --git a/src/Schema/Visitor/RemoveNamespacedAssets.php b/src/Schema/Visitor/RemoveNamespacedAssets.php index 1cc2bf28a92..c67bf99e8dd 100644 --- a/src/Schema/Visitor/RemoveNamespacedAssets.php +++ b/src/Schema/Visitor/RemoveNamespacedAssets.php @@ -31,7 +31,7 @@ public function __construct() 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5432', 'RemoveNamespacedAssets is deprecated. Do not use namespaces' - . " if the target database platform doesn't support them." + . " if the target database platform doesn't support them.", ); } diff --git a/src/Schema/Visitor/Visitor.php b/src/Schema/Visitor/Visitor.php index 6e530647b23..8b34864c10d 100644 --- a/src/Schema/Visitor/Visitor.php +++ b/src/Schema/Visitor/Visitor.php @@ -24,14 +24,10 @@ interface Visitor */ public function acceptSchema(Schema $schema); - /** - * @return void - */ + /** @return void */ public function acceptTable(Table $table); - /** - * @return void - */ + /** @return void */ public function acceptColumn(Table $table, Column $column); /** @@ -41,13 +37,9 @@ public function acceptColumn(Table $table, Column $column); */ public function acceptForeignKey(Table $localTable, ForeignKeyConstraint $fkConstraint); - /** - * @return void - */ + /** @return void */ public function acceptIndex(Table $table, Index $index); - /** - * @return void - */ + /** @return void */ public function acceptSequence(Sequence $sequence); } diff --git a/src/Statement.php b/src/Statement.php index 86cea667eb8..d229fd98b0b 100644 --- a/src/Statement.php +++ b/src/Statement.php @@ -141,7 +141,7 @@ public function bindParam($param, &$variable, $type = ParameterType::STRING, $le 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5563', '%s is deprecated. Use bindValue() instead.', - __METHOD__ + __METHOD__, ); $this->params[$param] = $variable; @@ -172,7 +172,7 @@ public function execute($params = null): Result Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4580', - 'Statement::execute() is deprecated, use Statement::executeQuery() or Statement::executeStatement() instead' + 'Statement::execute() is deprecated, use Statement::executeQuery() or Statement::executeStatement() instead', ); if ($params !== null) { @@ -187,7 +187,7 @@ public function execute($params = null): Result try { return new Result( $this->stmt->execute($params), - $this->conn + $this->conn, ); } catch (Driver\Exception $ex) { throw $this->conn->convertExceptionDuringQuery($ex, $this->sql, $this->params, $this->types); @@ -212,7 +212,7 @@ public function executeQuery(array $params = []): Result 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5556', 'Passing $params to Statement::executeQuery() is deprecated. Bind parameters using' - . ' Statement::bindParam() or Statement::bindValue() instead.' + . ' Statement::bindParam() or Statement::bindValue() instead.', ); } @@ -237,7 +237,7 @@ public function executeStatement(array $params = []): int 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5556', 'Passing $params to Statement::executeStatement() is deprecated. Bind parameters using' - . ' Statement::bindParam() or Statement::bindValue() instead.' + . ' Statement::bindParam() or Statement::bindValue() instead.', ); } diff --git a/src/Tools/Console/Command/ReservedWordsCommand.php b/src/Tools/Console/Command/ReservedWordsCommand.php index d14d1c80003..eaab574b62d 100644 --- a/src/Tools/Console/Command/ReservedWordsCommand.php +++ b/src/Tools/Console/Command/ReservedWordsCommand.php @@ -31,9 +31,7 @@ use function is_array; use function is_string; -/** - * @deprecated Use database documentation instead. - */ +/** @deprecated Use database documentation instead. */ class ReservedWordsCommand extends Command { /** @var array */ @@ -46,7 +44,7 @@ public function __construct(ConnectionProvider $connectionProvider) Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5431', - 'ReservedWordsCommand is deprecated. Use database documentation instead.' + 'ReservedWordsCommand is deprecated. Use database documentation instead.', ); parent::__construct(); @@ -88,7 +86,7 @@ public function setKeywordListClass($name, $class) 'doctrine/dbal', 'https://github.com/doctrine/dbal/issues/4510', 'ReservedWordsCommand::setKeywordListClass() is deprecated,' - . ' use ReservedWordsCommand::setKeywordList() instead.' + . ' use ReservedWordsCommand::setKeywordList() instead.', ); $this->keywordLists[$name] = new $class(); @@ -106,10 +104,10 @@ protected function configure() 'list', 'l', InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, - 'Keyword-List name.' + 'Keyword-List name.', ), ]) - ->setHelp(<<setHelp(<<<'EOT' Checks if the current database contains tables and columns with names that are identifiers in this dialect or in other SQL dialects. @@ -134,8 +132,7 @@ protected function configure() * pgsql100 * sqlite * sqlserver -EOT - ); +EOT); } /** @@ -149,7 +146,7 @@ protected function execute(InputInterface $input, OutputInterface $output) { $output->writeln( 'The dbal:reserved-words command is deprecated.' - . ' Use the documentation on the used database platform(s) instead.' + . ' Use the documentation on the used database platform(s) instead.', ); $output->writeln(''); @@ -172,7 +169,7 @@ protected function execute(InputInterface $input, OutputInterface $output) if (! isset($this->keywordLists[$keywordList])) { throw new InvalidArgumentException( "There exists no keyword list with name '" . $keywordList . "'. " . - 'Known lists: ' . implode(', ', array_keys($this->keywordLists)) + 'Known lists: ' . implode(', ', array_keys($this->keywordLists)), ); } @@ -181,7 +178,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $output->write( 'Checking keyword violations for ' . implode(', ', $keywordLists) . '...', - true + true, ); $schema = $conn->getSchemaManager()->createSchema(); @@ -193,7 +190,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $output->write( 'There are ' . count($violations) . ' reserved keyword violations' . ' in your database schema:', - true + true, ); foreach ($violations as $violation) { diff --git a/src/Tools/Console/Command/RunSqlCommand.php b/src/Tools/Console/Command/RunSqlCommand.php index f2db29cc9fe..5bd72ea6a94 100644 --- a/src/Tools/Console/Command/RunSqlCommand.php +++ b/src/Tools/Console/Command/RunSqlCommand.php @@ -46,13 +46,12 @@ protected function configure() 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); } /** @@ -103,9 +102,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); @@ -118,9 +115,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 9919e481f65..b203692d945 100644 --- a/src/Tools/Console/ConnectionProvider.php +++ b/src/Tools/Console/ConnectionProvider.php @@ -8,8 +8,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/ConsoleRunner.php b/src/Tools/Console/ConsoleRunner.php index d16b0fd839b..e8fa3c60bd7 100644 --- a/src/Tools/Console/ConsoleRunner.php +++ b/src/Tools/Console/ConsoleRunner.php @@ -40,9 +40,7 @@ public static function run(ConnectionProvider $connectionProvider, $commands = [ $cli->run(); } - /** - * @return void - */ + /** @return void */ public static function addCommands(Application $cli, ConnectionProvider $connectionProvider) { $cli->addCommands([ diff --git a/src/TransactionIsolationLevel.php b/src/TransactionIsolationLevel.php index e8dc5d91814..9020343abec 100644 --- a/src/TransactionIsolationLevel.php +++ b/src/TransactionIsolationLevel.php @@ -26,9 +26,7 @@ final class TransactionIsolationLevel */ public const SERIALIZABLE = 4; - /** - * @codeCoverageIgnore - */ + /** @codeCoverageIgnore */ private function __construct() { } diff --git a/src/Types/ArrayType.php b/src/Types/ArrayType.php index 8397cacdfac..fb202406f8d 100644 --- a/src/Types/ArrayType.php +++ b/src/Types/ArrayType.php @@ -84,7 +84,7 @@ public function requiresSQLCommentHint(AbstractPlatform $platform) 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5509', '%s is deprecated.', - __METHOD__ + __METHOD__, ); return true; diff --git a/src/Types/BooleanType.php b/src/Types/BooleanType.php index d3192c1cd50..92f53055871 100644 --- a/src/Types/BooleanType.php +++ b/src/Types/BooleanType.php @@ -63,7 +63,7 @@ public function requiresSQLCommentHint(AbstractPlatform $platform) 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5509', '%s is deprecated.', - __METHOD__ + __METHOD__, ); // We require a commented boolean type in order to distinguish between diff --git a/src/Types/ConversionException.php b/src/Types/ConversionException.php index 278734b9b1c..154b06d3ed0 100644 --- a/src/Types/ConversionException.php +++ b/src/Types/ConversionException.php @@ -57,7 +57,7 @@ public static function conversionFailedFormat($value, $toType, $expectedFormat, 'Could not convert database value "' . $value . '" to Doctrine Type ' . $toType . '. Expected format: ' . $expectedFormat, 0, - $previous + $previous, ); } @@ -81,7 +81,7 @@ public static function conversionFailedInvalidType( '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), ), 0, $previous); } @@ -89,7 +89,7 @@ public static function conversionFailedInvalidType( 'Could not convert PHP value of type %s to type %s. Expected one of the following types: %s', is_object($value) ? get_class($value) : gettype($value), $toType, - implode(', ', $possibleTypes) + implode(', ', $possibleTypes), ), 0, $previous); } @@ -108,7 +108,7 @@ public static function conversionFailedSerialization($value, $format, $error /*, "Could not convert PHP type '%s' to '%s', as an '%s' error was triggered by the serialization", $actualType, $format, - $error + $error, ), 0, func_num_args() >= 4 ? func_get_arg(3) : null); } @@ -117,7 +117,7 @@ public static function conversionFailedUnserialization(string $format, string $e return new self(sprintf( "Could not convert database value to '%s' as an error was triggered by the unserialization: '%s'", $format, - $error + $error, )); } } diff --git a/src/Types/DateImmutableType.php b/src/Types/DateImmutableType.php index c294215835d..98fa6dc61a4 100644 --- a/src/Types/DateImmutableType.php +++ b/src/Types/DateImmutableType.php @@ -35,7 +35,7 @@ public function convertToDatabaseValue($value, AbstractPlatform $platform) throw ConversionException::conversionFailedInvalidType( $value, $this->getName(), - ['null', DateTimeImmutable::class] + ['null', DateTimeImmutable::class], ); } @@ -54,7 +54,7 @@ public function convertToPHPValue($value, AbstractPlatform $platform) throw ConversionException::conversionFailedFormat( $value, $this->getName(), - $platform->getDateFormatString() + $platform->getDateFormatString(), ); } @@ -72,7 +72,7 @@ public function requiresSQLCommentHint(AbstractPlatform $platform) 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5509', '%s is deprecated.', - __METHOD__ + __METHOD__, ); return true; diff --git a/src/Types/DateIntervalType.php b/src/Types/DateIntervalType.php index e2c907e4b03..72156f17d6f 100644 --- a/src/Types/DateIntervalType.php +++ b/src/Types/DateIntervalType.php @@ -90,7 +90,7 @@ public function requiresSQLCommentHint(AbstractPlatform $platform) 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5509', '%s is deprecated.', - __METHOD__ + __METHOD__, ); return true; diff --git a/src/Types/DateTimeImmutableType.php b/src/Types/DateTimeImmutableType.php index cfe5322cb5b..6f789620241 100644 --- a/src/Types/DateTimeImmutableType.php +++ b/src/Types/DateTimeImmutableType.php @@ -37,7 +37,7 @@ public function convertToDatabaseValue($value, AbstractPlatform $platform) throw ConversionException::conversionFailedInvalidType( $value, $this->getName(), - ['null', DateTimeImmutable::class] + ['null', DateTimeImmutable::class], ); } @@ -60,7 +60,7 @@ public function convertToPHPValue($value, AbstractPlatform $platform) throw ConversionException::conversionFailedFormat( $value, $this->getName(), - $platform->getDateTimeFormatString() + $platform->getDateTimeFormatString(), ); } @@ -78,7 +78,7 @@ public function requiresSQLCommentHint(AbstractPlatform $platform) 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5509', '%s is deprecated.', - __METHOD__ + __METHOD__, ); return true; diff --git a/src/Types/DateTimeType.php b/src/Types/DateTimeType.php index 454295d710f..738c6bfb52c 100644 --- a/src/Types/DateTimeType.php +++ b/src/Types/DateTimeType.php @@ -64,7 +64,7 @@ public function convertToPHPValue($value, AbstractPlatform $platform) throw ConversionException::conversionFailedFormat( $value, $this->getName(), - $platform->getDateTimeFormatString() + $platform->getDateTimeFormatString(), ); } diff --git a/src/Types/DateTimeTzImmutableType.php b/src/Types/DateTimeTzImmutableType.php index 0f103746e32..222a9c3b086 100644 --- a/src/Types/DateTimeTzImmutableType.php +++ b/src/Types/DateTimeTzImmutableType.php @@ -35,7 +35,7 @@ public function convertToDatabaseValue($value, AbstractPlatform $platform) throw ConversionException::conversionFailedInvalidType( $value, $this->getName(), - ['null', DateTimeImmutable::class] + ['null', DateTimeImmutable::class], ); } @@ -54,7 +54,7 @@ public function convertToPHPValue($value, AbstractPlatform $platform) throw ConversionException::conversionFailedFormat( $value, $this->getName(), - $platform->getDateTimeTzFormatString() + $platform->getDateTimeTzFormatString(), ); } @@ -72,7 +72,7 @@ public function requiresSQLCommentHint(AbstractPlatform $platform) 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5509', '%s is deprecated.', - __METHOD__ + __METHOD__, ); return true; diff --git a/src/Types/DateTimeTzType.php b/src/Types/DateTimeTzType.php index 29672397f05..ee08f9d1e6d 100644 --- a/src/Types/DateTimeTzType.php +++ b/src/Types/DateTimeTzType.php @@ -56,7 +56,7 @@ public function convertToDatabaseValue($value, AbstractPlatform $platform) throw ConversionException::conversionFailedInvalidType( $value, $this->getName(), - ['null', 'DateTime'] + ['null', 'DateTime'], ); } @@ -74,7 +74,7 @@ public function convertToPHPValue($value, AbstractPlatform $platform) throw ConversionException::conversionFailedFormat( $value, $this->getName(), - $platform->getDateTimeTzFormatString() + $platform->getDateTimeTzFormatString(), ); } diff --git a/src/Types/DateType.php b/src/Types/DateType.php index 6f86f5436f8..533667dd573 100644 --- a/src/Types/DateType.php +++ b/src/Types/DateType.php @@ -57,7 +57,7 @@ public function convertToPHPValue($value, AbstractPlatform $platform) throw ConversionException::conversionFailedFormat( $value, $this->getName(), - $platform->getDateFormatString() + $platform->getDateFormatString(), ); } diff --git a/src/Types/GuidType.php b/src/Types/GuidType.php index bae09e777f7..6ce903e2b43 100644 --- a/src/Types/GuidType.php +++ b/src/Types/GuidType.php @@ -37,7 +37,7 @@ public function requiresSQLCommentHint(AbstractPlatform $platform) 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5509', '%s is deprecated.', - __METHOD__ + __METHOD__, ); return ! $platform->hasNativeGuidType(); diff --git a/src/Types/JsonType.php b/src/Types/JsonType.php index 3669777244c..20ee79deb7b 100644 --- a/src/Types/JsonType.php +++ b/src/Types/JsonType.php @@ -82,7 +82,7 @@ public function requiresSQLCommentHint(AbstractPlatform $platform) 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5509', '%s is deprecated.', - __METHOD__ + __METHOD__, ); return ! $platform->hasNativeJsonType(); diff --git a/src/Types/ObjectType.php b/src/Types/ObjectType.php index 56883aba567..f8bcc94378c 100644 --- a/src/Types/ObjectType.php +++ b/src/Types/ObjectType.php @@ -76,7 +76,7 @@ public function requiresSQLCommentHint(AbstractPlatform $platform) 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5509', '%s is deprecated.', - __METHOD__ + __METHOD__, ); return true; diff --git a/src/Types/SimpleArrayType.php b/src/Types/SimpleArrayType.php index e90e858eda4..3ec695cb721 100644 --- a/src/Types/SimpleArrayType.php +++ b/src/Types/SimpleArrayType.php @@ -72,7 +72,7 @@ public function requiresSQLCommentHint(AbstractPlatform $platform) 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5509', '%s is deprecated.', - __METHOD__ + __METHOD__, ); return true; diff --git a/src/Types/TimeImmutableType.php b/src/Types/TimeImmutableType.php index 796017111c0..eef8ba91faf 100644 --- a/src/Types/TimeImmutableType.php +++ b/src/Types/TimeImmutableType.php @@ -35,7 +35,7 @@ public function convertToDatabaseValue($value, AbstractPlatform $platform) throw ConversionException::conversionFailedInvalidType( $value, $this->getName(), - ['null', DateTimeImmutable::class] + ['null', DateTimeImmutable::class], ); } @@ -54,7 +54,7 @@ public function convertToPHPValue($value, AbstractPlatform $platform) throw ConversionException::conversionFailedFormat( $value, $this->getName(), - $platform->getTimeFormatString() + $platform->getTimeFormatString(), ); } @@ -72,7 +72,7 @@ public function requiresSQLCommentHint(AbstractPlatform $platform) 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5509', '%s is deprecated.', - __METHOD__ + __METHOD__, ); return true; diff --git a/src/Types/TimeType.php b/src/Types/TimeType.php index 4f2c8c6310d..9c8f03e98a9 100644 --- a/src/Types/TimeType.php +++ b/src/Types/TimeType.php @@ -57,7 +57,7 @@ public function convertToPHPValue($value, AbstractPlatform $platform) throw ConversionException::conversionFailedFormat( $value, $this->getName(), - $platform->getTimeFormatString() + $platform->getTimeFormatString(), ); } diff --git a/src/Types/Type.php b/src/Types/Type.php index f189574540f..536cf36f2b8 100644 --- a/src/Types/Type.php +++ b/src/Types/Type.php @@ -50,9 +50,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() { } @@ -206,7 +204,7 @@ public static function getTypesMap() static function (Type $type): string { return get_class($type); }, - self::getTypeRegistry()->getMap() + self::getTypeRegistry()->getMap(), ); } @@ -279,7 +277,7 @@ public function requiresSQLCommentHint(AbstractPlatform $platform) 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5509', '%s is deprecated.', - __METHOD__ + __METHOD__, ); return false; diff --git a/src/Types/TypeRegistry.php b/src/Types/TypeRegistry.php index 42954819278..b5e800ad1b4 100644 --- a/src/Types/TypeRegistry.php +++ b/src/Types/TypeRegistry.php @@ -18,9 +18,7 @@ final class TypeRegistry /** @var array Map of type names and their corresponding flyweight objects. */ private array $instances; - /** - * @param array $instances - */ + /** @param array $instances */ public function __construct(array $instances = []) { $this->instances = $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 fe1ee3f73fa..24bddc44360 100644 --- a/src/Types/VarDateTimeImmutableType.php +++ b/src/Types/VarDateTimeImmutableType.php @@ -37,7 +37,7 @@ public function convertToDatabaseValue($value, AbstractPlatform $platform) throw ConversionException::conversionFailedInvalidType( $value, $this->getName(), - ['null', DateTimeImmutable::class] + ['null', DateTimeImmutable::class], ); } @@ -70,7 +70,7 @@ public function requiresSQLCommentHint(AbstractPlatform $platform) 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5509', '%s is deprecated.', - __METHOD__ + __METHOD__, ); return true; diff --git a/tests/Cache/QueryCacheProfileTest.php b/tests/Cache/QueryCacheProfileTest.php index d8bc7c006f0..cbabd1deae7 100644 --- a/tests/Cache/QueryCacheProfileTest.php +++ b/tests/Cache/QueryCacheProfileTest.php @@ -42,7 +42,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'); @@ -56,13 +56,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'); @@ -76,7 +76,7 @@ public function testShouldGenerateDifferentKeysForSameQueryAndParamsAndDifferent $this->query, $this->params, $this->types, - $this->connectionParams + $this->connectionParams, ); $this->connectionParams['host'] = 'a_different_host'; @@ -85,7 +85,7 @@ public function testShouldGenerateDifferentKeysForSameQueryAndParamsAndDifferent $this->query, $this->params, $this->types, - $this->connectionParams + $this->connectionParams, ); self::assertNotEquals($firstCacheKey, $secondCacheKey, 'Cache keys should be different'); @@ -99,7 +99,7 @@ public function testConnectionParamsShouldBeHashed(): void $this->query, $this->params, $this->types, - $this->connectionParams + $this->connectionParams, ); $params = []; @@ -120,14 +120,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'); @@ -142,7 +142,7 @@ public function testShouldGenerateDifferentPasswordInTheParams(): void [ 'user' => 'database_user', 'password' => 'first-password', - ] + ], ); [, $secondRealCacheKey] = $this->queryCacheProfile->generateCacheKeys( @@ -152,13 +152,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 a3ca56f30ae..dfb43e86b62 100644 --- a/tests/Connection/CachedQueryTest.php +++ b/tests/Connection/CachedQueryTest.php @@ -47,9 +47,7 @@ public function testCachedQueryLegacyWrapped(): void self::assertCount(1, $cache->getItem(__FUNCTION__)->get()); } - /** - * @param CacheItemPoolInterface|Cache $cache - */ + /** @param CacheItemPoolInterface|Cache $cache */ private function assertCachedQueryIsExecutedOnceAndYieldsTheSameResult(object $cache, string $cacheKey): void { $data = [['foo' => 'bar']]; @@ -71,20 +69,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 cd0ca7190cf..784e8d96653 100644 --- a/tests/Connection/ExpandArrayParametersTest.php +++ b/tests/Connection/ExpandArrayParametersTest.php @@ -13,9 +13,7 @@ class ExpandArrayParametersTest extends TestCase { - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function dataExpandListParameters(): iterable { return [ @@ -338,9 +336,7 @@ public function testExpandListParameters( self::assertEquals($expectedTypes, $types, 'Types dont match'); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function missingNamedParameterProvider(): iterable { return [ @@ -392,9 +388,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/Connection/LoggingTest.php b/tests/Connection/LoggingTest.php index 7667d135c76..ca06fbf6935 100644 --- a/tests/Connection/LoggingTest.php +++ b/tests/Connection/LoggingTest.php @@ -24,7 +24,7 @@ public function testLogExecuteStatement(): void { $this->createConnection( $this->createStub(DriverConnection::class), - 'UPDATE table SET foo = ?' + 'UPDATE table SET foo = ?', ) ->executeStatement('UPDATE table SET foo = ?'); } diff --git a/tests/ConnectionTest.php b/tests/ConnectionTest.php index ba5fc74c07d..4ed8f359a43 100644 --- a/tests/ConnectionTest.php +++ b/tests/ConnectionTest.php @@ -29,9 +29,7 @@ use Psr\Cache\CacheItemPoolInterface; use stdClass; -/** - * @requires extension pdo_mysql - */ +/** @requires extension pdo_mysql */ class ConnectionTest extends TestCase { use VerifyDeprecations; @@ -52,9 +50,7 @@ protected function setUp(): void $this->connection = DriverManager::getConnection($this->params); } - /** - * @return Connection&MockObject - */ + /** @return Connection&MockObject */ private function getExecuteStatementMockConnection() { $driverMock = $this->createMock(Driver::class); @@ -62,7 +58,7 @@ private function getExecuteStatementMockConnection() $driverMock->expects(self::any()) ->method('connect') ->willReturn( - $this->createMock(DriverConnection::class) + $this->createMock(DriverConnection::class), ); $platform = $this->getMockForAbstractClass(AbstractPlatform::class); @@ -147,7 +143,7 @@ public function testTransactionBeginDispatchEvent(): void $driverMock->expects(self::any()) ->method('connect') ->willReturn( - $this->createMock(DriverConnection::class) + $this->createMock(DriverConnection::class), ); $conn = new Connection([], $driverMock, new Configuration(), $eventManager); $listenerMock = $this->createMock(TransactionBeginDispatchEventListener::class); @@ -158,8 +154,8 @@ public function testTransactionBeginDispatchEvent(): void self::callback( static function (TransactionBeginEventArgs $eventArgs) use ($conn): bool { return $eventArgs->getConnection() === $conn; - } - ) + }, + ), ); $eventManager->addEventListener([Events::onTransactionBegin], $listenerMock); @@ -173,7 +169,7 @@ public function testTransactionCommitDispatchEvent(): void $driverMock->expects(self::any()) ->method('connect') ->willReturn( - $this->createMock(DriverConnection::class) + $this->createMock(DriverConnection::class), ); $conn = new Connection([], $driverMock, new Configuration(), $eventManager); $listenerMock = $this->createMock(TransactionCommitDispatchEventListener::class); @@ -184,8 +180,8 @@ public function testTransactionCommitDispatchEvent(): void self::callback( static function (TransactionCommitEventArgs $eventArgs) use ($conn): bool { return $eventArgs->getConnection() === $conn; - } - ) + }, + ), ); $eventManager->addEventListener([Events::onTransactionCommit], $listenerMock); @@ -200,7 +196,7 @@ public function testTransactionCommitEventNotCalledAfterRollBack(): void $driverMock->expects(self::any()) ->method('connect') ->willReturn( - $this->createMock(DriverConnection::class) + $this->createMock(DriverConnection::class), ); $conn = new Connection([], $driverMock, new Configuration(), $eventManager); $rollBackListenerMock = $this->createMock(TransactionRollBackDispatchEventListener::class); @@ -211,8 +207,8 @@ public function testTransactionCommitEventNotCalledAfterRollBack(): void self::callback( static function (TransactionRollBackEventArgs $eventArgs) use ($conn): bool { return $eventArgs->getConnection() === $conn; - } - ) + }, + ), ); $eventManager->addEventListener([Events::onTransactionRollBack], $rollBackListenerMock); @@ -236,7 +232,7 @@ public function testTransactionRollBackDispatchEvent(): void $driverMock->expects(self::any()) ->method('connect') ->willReturn( - $this->createMock(DriverConnection::class) + $this->createMock(DriverConnection::class), ); $conn = new Connection([], $driverMock, new Configuration(), $eventManager); $listenerMock = $this->createMock(TransactionRollBackDispatchEventListener::class); @@ -247,8 +243,8 @@ public function testTransactionRollBackDispatchEvent(): void self::callback( static function (TransactionRollBackEventArgs $eventArgs) use ($conn): bool { return $eventArgs->getConnection() === $conn; - } - ) + }, + ), ); $eventManager->addEventListener([Events::onTransactionRollBack], $listenerMock); @@ -283,7 +279,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([ @@ -294,9 +290,7 @@ public function testDriverExceptionIsWrapped(callable $callback): void $callback($connection, 'MUUHAAAAHAAAA'); } - /** - * @return iterable> - */ + /** @return iterable> */ public static function getQueryMethods(): iterable { yield 'executeQuery' => [ @@ -345,7 +339,7 @@ public function testConnectStartsTransactionInNoAutoCommitMode(): void $driverMock->expects(self::any()) ->method('connect') ->willReturn( - $this->createMock(DriverConnection::class) + $this->createMock(DriverConnection::class), ); $conn = new Connection([], $driverMock); @@ -364,7 +358,7 @@ public function testCommitStartsTransactionInNoAutoCommitMode(): void $driverMock->expects(self::any()) ->method('connect') ->willReturn( - $this->createMock(DriverConnection::class) + $this->createMock(DriverConnection::class), ); $conn = new Connection([], $driverMock); @@ -375,9 +369,7 @@ public function testCommitStartsTransactionInNoAutoCommitMode(): void self::assertTrue($conn->isTransactionActive()); } - /** - * @dataProvider resultProvider - */ + /** @dataProvider resultProvider */ public function testCommitReturn(bool $expectedResult): void { $driverConnection = $this->createMock(DriverConnection::class); @@ -397,9 +389,7 @@ public function testCommitReturn(bool $expectedResult): void self::assertSame($expectedResult, $conn->commit()); } - /** - * @return bool[][] - */ + /** @return bool[][] */ public function resultProvider(): array { return [[true], [false]]; @@ -411,7 +401,7 @@ public function testRollBackStartsTransactionInNoAutoCommitMode(): void $driverMock->expects(self::any()) ->method('connect') ->willReturn( - $this->createMock(DriverConnection::class) + $this->createMock(DriverConnection::class), ); $conn = new Connection([], $driverMock); @@ -428,7 +418,7 @@ public function testSwitchingAutoCommitModeCommitsAllCurrentTransactions(): void $driverMock->expects(self::any()) ->method('connect') ->willReturn( - $this->createMock(DriverConnection::class) + $this->createMock(DriverConnection::class), ); $conn = new Connection([], $driverMock); @@ -476,7 +466,7 @@ public function testUpdateWithDifferentColumnsInDataAndIdentifiers(): void 'boolean', 'integer', 'string', - ] + ], ); $conn->update( @@ -494,7 +484,7 @@ public function testUpdateWithDifferentColumnsInDataAndIdentifiers(): void 'is_edited' => 'boolean', 'id' => 'integer', 'name' => 'string', - ] + ], ); } @@ -517,7 +507,7 @@ public function testUpdateWithSameColumnInDataAndIdentifiers(): void 'boolean', 'integer', 'boolean', - ] + ], ); $conn->update( @@ -534,7 +524,7 @@ public function testUpdateWithSameColumnInDataAndIdentifiers(): void 'text' => 'string', 'is_edited' => 'boolean', 'id' => 'integer', - ] + ], ); } @@ -555,7 +545,7 @@ public function testUpdateWithIsNull(): void 'string', 'boolean', 'string', - ] + ], ); $conn->update( @@ -573,7 +563,7 @@ public function testUpdateWithIsNull(): void 'is_edited' => 'boolean', 'id' => 'integer', 'name' => 'string', - ] + ], ); } @@ -586,7 +576,7 @@ public function testDeleteWithIsNull(): void ->with( 'DELETE FROM TestTable WHERE id IS NULL AND name = ?', ['foo'], - ['string'] + ['string'], ); $conn->delete( @@ -598,7 +588,7 @@ public function testDeleteWithIsNull(): void [ 'id' => 'integer', 'name' => 'string', - ] + ], ); } @@ -635,9 +625,7 @@ public function testFetch(string $method, callable $invoke, $expected): void self::assertSame($expected, $invoke($conn, $query, $params, $types)); } - /** - * @return iterable> - */ + /** @return iterable> */ public static function fetchModeProvider(): iterable { yield 'numeric' => [ @@ -713,7 +701,7 @@ public function testCallConnectOnce(): void $driver->expects(self::once()) ->method('connect') ->willReturn( - $this->createMock(Driver\Connection::class) + $this->createMock(Driver\Connection::class), ); $platform = $this->createMock(AbstractPlatform::class); @@ -822,9 +810,7 @@ public function testShouldNotPassPlatformInParamsToTheQueryCacheProfileInExecute (new Connection($connectionParams, $driver))->executeCacheQuery($query, [], [], $queryCacheProfileMock); } - /** - * @psalm-suppress InvalidArgument - */ + /** @psalm-suppress InvalidArgument */ public function testThrowsExceptionWhenInValidPlatformSpecified(): void { $connectionParams = $this->params; @@ -848,7 +834,7 @@ public function testRethrowsOriginalExceptionOnDeterminingPlatformWhenConnecting $driverMock->method('connect') ->will(self::onConsecutiveCalls( self::throwException($originalException), - self::throwException($fallbackException) + self::throwException($fallbackException), )); $this->expectExceptionMessage($originalException->getMessage()); diff --git a/tests/Driver/AbstractDB2DriverTest.php b/tests/Driver/AbstractDB2DriverTest.php index 6aac5adf57a..4c840265a5e 100644 --- a/tests/Driver/AbstractDB2DriverTest.php +++ b/tests/Driver/AbstractDB2DriverTest.php @@ -12,9 +12,7 @@ use Doctrine\DBAL\Schema\AbstractSchemaManager; use Doctrine\DBAL\Schema\DB2SchemaManager; -/** - * @extends AbstractDriverTest - */ +/** @extends AbstractDriverTest */ class AbstractDB2DriverTest extends AbstractDriverTest { protected function createDriver(): Driver @@ -31,7 +29,7 @@ protected function createSchemaManager(Connection $connection): AbstractSchemaMa { return new DB2SchemaManager( $connection, - $this->createPlatform() + $this->createPlatform(), ); } diff --git a/tests/Driver/AbstractDriverTest.php b/tests/Driver/AbstractDriverTest.php index 16b4f0813aa..e14403b8db5 100644 --- a/tests/Driver/AbstractDriverTest.php +++ b/tests/Driver/AbstractDriverTest.php @@ -16,9 +16,7 @@ use function get_class; use function sprintf; -/** - * @template P of AbstractPlatform - */ +/** @template P of AbstractPlatform */ abstract class AbstractDriverTest extends TestCase { /** @@ -44,8 +42,8 @@ public function testCreatesDatabasePlatformForVersion(): void sprintf( 'No test data found for test %s. You have to return test data from %s.', static::class . '::' . __FUNCTION__, - static::class . '::getDatabasePlatformsForVersions' - ) + static::class . '::getDatabasePlatformsForVersions', + ), ); foreach ($data as $item) { @@ -58,8 +56,8 @@ public function testCreatesDatabasePlatformForVersion(): void 'Expected platform for version "%s" should be "%s", "%s" given', $item[0], $item[1], - $generatedVersion - ) + $generatedVersion, + ), ); } } @@ -84,7 +82,7 @@ public function testReturnsSchemaManager(): void $connection = $this->getConnectionMock(); $schemaManager = $this->driver->getSchemaManager( $connection, - $this->createPlatform() + $this->createPlatform(), ); self::assertEquals($this->createSchemaManager($connection), $schemaManager); @@ -127,17 +125,13 @@ 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> */ protected function getDatabasePlatformsForVersions(): array { return []; diff --git a/tests/Driver/AbstractMySQLDriverTest.php b/tests/Driver/AbstractMySQLDriverTest.php index de68e910d4e..68454c09871 100644 --- a/tests/Driver/AbstractMySQLDriverTest.php +++ b/tests/Driver/AbstractMySQLDriverTest.php @@ -15,9 +15,7 @@ use Doctrine\DBAL\Schema\AbstractSchemaManager; use Doctrine\DBAL\Schema\MySQLSchemaManager; -/** - * @extends AbstractDriverTest - */ +/** @extends AbstractDriverTest */ class AbstractMySQLDriverTest extends AbstractDriverTest { protected function createDriver(): Driver @@ -34,7 +32,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 a43ad731fda..45fdd49183d 100644 --- a/tests/Driver/AbstractOracleDriver/EasyConnectStringTest.php +++ b/tests/Driver/AbstractOracleDriver/EasyConnectStringTest.php @@ -19,9 +19,7 @@ public function testFromConnectionParameters(array $params, string $expected): v self::assertSame($expected, (string) $string); } - /** - * @return mixed[] - */ + /** @return mixed[] */ public static function connectionParametersProvider(): iterable { return [ diff --git a/tests/Driver/AbstractOracleDriverTest.php b/tests/Driver/AbstractOracleDriverTest.php index 967a3a9471c..7fabbfb86b0 100644 --- a/tests/Driver/AbstractOracleDriverTest.php +++ b/tests/Driver/AbstractOracleDriverTest.php @@ -12,9 +12,7 @@ use Doctrine\DBAL\Schema\AbstractSchemaManager; use Doctrine\DBAL\Schema\OracleSchemaManager; -/** - * @extends AbstractDriverTest - */ +/** @extends AbstractDriverTest */ class AbstractOracleDriverTest extends AbstractDriverTest { protected function createDriver(): Driver @@ -31,7 +29,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 cbf0f747061..7d8cd40fb92 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 { protected function createDriver(): Driver @@ -33,7 +31,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 a5a41b436ec..afe21ba11f6 100644 --- a/tests/Driver/AbstractSQLServerDriverTest.php +++ b/tests/Driver/AbstractSQLServerDriverTest.php @@ -12,9 +12,7 @@ use Doctrine\DBAL\Schema\AbstractSchemaManager; use Doctrine\DBAL\Schema\SQLServerSchemaManager; -/** - * @extends AbstractDriverTest - */ +/** @extends AbstractDriverTest */ abstract class AbstractSQLServerDriverTest extends AbstractDriverTest { protected function createPlatform(): AbstractPlatform @@ -26,7 +24,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 fe7ee279406..dbbc4665569 100644 --- a/tests/Driver/AbstractSQLiteDriverTest.php +++ b/tests/Driver/AbstractSQLiteDriverTest.php @@ -12,9 +12,7 @@ use Doctrine\DBAL\Schema\AbstractSchemaManager; use Doctrine\DBAL\Schema\SqliteSchemaManager; -/** - * @extends AbstractDriverTest - */ +/** @extends AbstractDriverTest */ class AbstractSQLiteDriverTest extends AbstractDriverTest { protected function createDriver(): Driver @@ -31,7 +29,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 aad029a435d..0216b65825b 100644 --- a/tests/Driver/IBMDB2/DataSourceNameTest.php +++ b/tests/Driver/IBMDB2/DataSourceNameTest.php @@ -19,9 +19,7 @@ public function testFromConnectionParameters(array $params, string $expected): v $this->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 80e1e34a777..32712dde5db 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'), ); } @@ -99,8 +99,6 @@ private function createMiddleware(Connection $connection): AbstractConnectionMid interface NativeDriverConnection extends ServerInfoAwareConnection { - /** - * @return object|resource - */ + /** @return object|resource */ public function getNativeConnection(); } diff --git a/tests/Driver/Mysqli/ConnectionTest.php b/tests/Driver/Mysqli/ConnectionTest.php index 9c682f006fd..e05b163da88 100644 --- a/tests/Driver/Mysqli/ConnectionTest.php +++ b/tests/Driver/Mysqli/ConnectionTest.php @@ -6,9 +6,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 d3779a6419a..b26bdab6aa5 100644 --- a/tests/Driver/OCI8/ConvertPositionalToNamedPlaceholdersTest.php +++ b/tests/Driver/OCI8/ConvertPositionalToNamedPlaceholdersTest.php @@ -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 98379cd598b..13b025c5650 100644 --- a/tests/Driver/PDO/ExceptionTest.php +++ b/tests/Driver/PDO/ExceptionTest.php @@ -6,9 +6,7 @@ use PDOException; use PHPUnit\Framework\TestCase; -/** - * @requires extension pdo - */ +/** @requires extension pdo */ class ExceptionTest extends TestCase { public const ERROR_CODE = 666; diff --git a/tests/Driver/PDO/PgSQL/DriverTest.php b/tests/Driver/PDO/PgSQL/DriverTest.php index 2dfb3fa1609..0932b3cdb95 100644 --- a/tests/Driver/PDO/PgSQL/DriverTest.php +++ b/tests/Driver/PDO/PgSQL/DriverTest.php @@ -30,31 +30,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), ); } @@ -63,16 +63,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 cc7f4719e29..83e6ab66411 100644 --- a/tests/DriverManagerTest.php +++ b/tests/DriverManagerTest.php @@ -28,9 +28,7 @@ public function testCheckParams(): void DriverManager::getConnection([]); } - /** - * @psalm-suppress InvalidArgument - */ + /** @psalm-suppress InvalidArgument */ public function testInvalidDriver(): void { $this->expectException(Exception::class); @@ -38,9 +36,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); @@ -53,9 +49,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); @@ -86,9 +80,7 @@ public function testInvalidWrapperClass(): void DriverManager::getConnection($options); } - /** - * @psalm-suppress InvalidArgument - */ + /** @psalm-suppress InvalidArgument */ public function testInvalidDriverClass(): void { $this->expectException(Exception::class); @@ -141,11 +133,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]), ); } @@ -175,9 +167,7 @@ public function testDatabaseUrl($url, $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 1ba297d84f8..519a9a8e0a6 100644 --- a/tests/Events/OracleSessionInitTest.php +++ b/tests/Events/OracleSessionInitTest.php @@ -25,9 +25,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) @@ -43,9 +41,7 @@ public function testPostConnectQuotesSessionParameterValues(string $name, string $listener->postConnect($eventArgs); } - /** - * @return array> - */ + /** @return array> */ public static function getPostConnectWithSessionParameterValuesData(): iterable { return [ diff --git a/tests/ExceptionTest.php b/tests/ExceptionTest.php index cb124600574..1c69155f03f 100644 --- a/tests/ExceptionTest.php +++ b/tests/ExceptionTest.php @@ -19,9 +19,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(), ); } @@ -32,7 +32,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(), ); } @@ -43,7 +43,7 @@ public function testInvalidPlatformTypeScalar(): void self::assertSame( "Option 'platform' must be an object and subtype of 'Doctrine\DBAL\Platforms\AbstractPlatform'. " . "Got 'string'", - $exception->getMessage() + $exception->getMessage(), ); } } diff --git a/tests/Functional/BlobTest.php b/tests/Functional/BlobTest.php index 51744c413ef..ec346406561 100644 --- a/tests/Functional/BlobTest.php +++ b/tests/Functional/BlobTest.php @@ -156,7 +156,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', ?)", ); $stmt->bindParam(1, $stream, ParameterType::LARGE_OBJECT); @@ -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 5c2bcaf82b7..5579939b7a1 100644 --- a/tests/Functional/ConnectionTest.php +++ b/tests/Functional/ConnectionTest.php @@ -113,7 +113,7 @@ public function testTransactionNestingLevelIsResetOnReconnect(): void $connection = DriverManager::getConnection( $params, $this->connection->getConfiguration(), - $this->connection->getEventManager() + $this->connection->getEventManager(), ); } else { $connection = $this->connection; @@ -329,7 +329,7 @@ public function testQuote(): void { self::assertEquals( $this->connection->quote('foo', Types::STRING), - $this->connection->quote('foo', ParameterType::STRING) + $this->connection->quote('foo', ParameterType::STRING), ); } @@ -347,7 +347,7 @@ public function testConnectWithoutExplicitDatabaseName(): void $connection = DriverManager::getConnection( $params, $this->connection->getConfiguration(), - $this->connection->getEventManager() + $this->connection->getEventManager(), ); self::assertTrue($connection->connect()); @@ -370,7 +370,7 @@ public function testDeterminesDatabasePlatformWhenConnectingToNonExistentDatabas $connection = DriverManager::getConnection( $params, $this->connection->getConfiguration(), - $this->connection->getEventManager() + $this->connection->getEventManager(), ); self::assertInstanceOf(AbstractPlatform::class, $connection->getDatabasePlatform()); diff --git a/tests/Functional/DataAccessTest.php b/tests/Functional/DataAccessTest.php index e6002081362..34eacdd7d99 100644 --- a/tests/Functional/DataAccessTest.php +++ b/tests/Functional/DataAccessTest.php @@ -139,7 +139,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); @@ -174,7 +174,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); @@ -204,7 +204,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); @@ -237,7 +237,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); @@ -250,7 +250,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); @@ -275,7 +275,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()); } @@ -302,7 +302,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(); @@ -312,7 +312,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(); @@ -338,9 +338,7 @@ public function testTrimExpression(string $value, int $position, $char, string $ self::assertEquals($expectedResult, $row['trimmed']); } - /** - * @return array> - */ + /** @return array> */ public static function getTrimExpressionData(): iterable { return [ diff --git a/tests/Functional/Driver/AbstractDriverTest.php b/tests/Functional/Driver/AbstractDriverTest.php index 2cf6866ce1c..88e6111dd03 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 ae97171491a..cab75b31729 100644 --- a/tests/Functional/Driver/IBMDB2/DriverTest.php +++ b/tests/Functional/Driver/IBMDB2/DriverTest.php @@ -7,9 +7,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/IBMDB2/StatementTest.php b/tests/Functional/Driver/IBMDB2/StatementTest.php index 6b00d72b7cb..95b0ccdcf57 100644 --- a/tests/Functional/Driver/IBMDB2/StatementTest.php +++ b/tests/Functional/Driver/IBMDB2/StatementTest.php @@ -12,9 +12,7 @@ use const E_NOTICE; use const E_WARNING; -/** - * @require extension ibm_db2 - */ +/** @require extension ibm_db2 */ class StatementTest extends FunctionalTestCase { protected function setUp(): void diff --git a/tests/Functional/Driver/Mysqli/ConnectionTest.php b/tests/Functional/Driver/Mysqli/ConnectionTest.php index 9c434d94fda..406c37bc8f7 100644 --- a/tests/Functional/Driver/Mysqli/ConnectionTest.php +++ b/tests/Functional/Driver/Mysqli/ConnectionTest.php @@ -12,9 +12,7 @@ use const MYSQLI_OPT_CONNECT_TIMEOUT; -/** - * @require extension mysqli - */ +/** @require extension mysqli */ class ConnectionTest extends FunctionalTestCase { protected function setUp(): void @@ -47,14 +45,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(); @@ -70,8 +66,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 58990520f6d..174a12d8628 100644 --- a/tests/Functional/Driver/Mysqli/DriverTest.php +++ b/tests/Functional/Driver/Mysqli/DriverTest.php @@ -7,9 +7,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/ConnectionTest.php b/tests/Functional/Driver/OCI8/ConnectionTest.php index 4276f8d704b..e6aaf561620 100644 --- a/tests/Functional/Driver/OCI8/ConnectionTest.php +++ b/tests/Functional/Driver/OCI8/ConnectionTest.php @@ -6,9 +6,7 @@ use Doctrine\DBAL\Tests\FunctionalTestCase; use Doctrine\DBAL\Tests\TestUtil; -/** - * @requires extension oci8 - */ +/** @requires extension oci8 */ class ConnectionTest extends FunctionalTestCase { protected function setUp(): void diff --git a/tests/Functional/Driver/OCI8/DriverTest.php b/tests/Functional/Driver/OCI8/DriverTest.php index 82cda7950ee..e8ff5e23edb 100644 --- a/tests/Functional/Driver/OCI8/DriverTest.php +++ b/tests/Functional/Driver/OCI8/DriverTest.php @@ -7,9 +7,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 5811b0f902d..5547d84153b 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 { /** @@ -42,11 +40,11 @@ protected function tearDown(): void { $this->connection->executeQuery(sprintf( 'DROP FUNCTION test_oracle_fetch_failure', - $this->connectionParams['user'] + $this->connectionParams['user'], )); $this->connection->executeQuery(sprintf( 'DROP TYPE return_numbers', - $this->connectionParams['user'] + $this->connectionParams['user'], )); } @@ -84,7 +82,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->execute(); @@ -120,8 +118,8 @@ public function testTruncatedFetch( sprintf( 'Expected to have %s total rows fetched but only found %s rows fetched', $expectedTotalRowCount, - $result->rowCount() - ) + $result->rowCount(), + ), ); } @@ -137,7 +135,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)', ); } @@ -166,7 +164,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 44eed36a92d..5719f82eb37 100644 --- a/tests/Functional/Driver/OCI8/StatementTest.php +++ b/tests/Functional/Driver/OCI8/StatementTest.php @@ -5,9 +5,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 @@ -29,7 +27,7 @@ public function testQueryConversion(string $query, array $params, array $expecte { self::assertEquals( $expected, - $this->connection->executeQuery($query, $params)->fetchAssociative() + $this->connection->executeQuery($query, $params)->fetchAssociative(), ); } @@ -47,13 +45,11 @@ public function testStatementBindParameters(string $query, array $params, array $expected, $this->connection->prepare($query) ->execute($params) - ->fetchAssociative() + ->fetchAssociative(), ); } - /** - * @return array> - */ + /** @return array> */ public static function queryConversionProvider(): iterable { return [ diff --git a/tests/Functional/Driver/PDO/MySQL/DriverTest.php b/tests/Functional/Driver/PDO/MySQL/DriverTest.php index e50328485e1..7cb2ed52d1c 100644 --- a/tests/Functional/Driver/PDO/MySQL/DriverTest.php +++ b/tests/Functional/Driver/PDO/MySQL/DriverTest.php @@ -7,9 +7,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 d3ba5f25e35..00e2c148a63 100644 --- a/tests/Functional/Driver/PDO/OCI/DriverTest.php +++ b/tests/Functional/Driver/PDO/OCI/DriverTest.php @@ -7,9 +7,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 8f56ff4e1a6..5e0f94e7ccb 100644 --- a/tests/Functional/Driver/PDO/PgSQL/ConnectionTest.php +++ b/tests/Functional/Driver/PDO/PgSQL/ConnectionTest.php @@ -6,9 +6,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 @@ -20,9 +18,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(); @@ -31,18 +27,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 531c0e097c7..df612c0d06e 100644 --- a/tests/Functional/Driver/PDO/PgSQL/DriverTest.php +++ b/tests/Functional/Driver/PDO/PgSQL/DriverTest.php @@ -12,9 +12,7 @@ use function microtime; use function sprintf; -/** - * @requires extension pdo_pgsql - */ +/** @requires extension pdo_pgsql */ class DriverTest extends AbstractDriverTest { protected function setUp(): void @@ -28,9 +26,7 @@ protected function setUp(): void self::markTestSkipped('This test requires the pdo_pgsql driver.'); } - /** - * @dataProvider getDatabaseParameter - */ + /** @dataProvider getDatabaseParameter */ public function testDatabaseParameters( ?string $databaseName, ?string $defaultDatabaseName, @@ -52,18 +48,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 3736f99808b..46bf7d5a315 100644 --- a/tests/Functional/Driver/PDO/SQLSrv/DriverTest.php +++ b/tests/Functional/Driver/PDO/SQLSrv/DriverTest.php @@ -11,9 +11,7 @@ use function array_merge; -/** - * @requires extension pdo_sqlsrv - */ +/** @requires extension pdo_sqlsrv */ class DriverTest extends AbstractDriverTest { protected function setUp(): void @@ -37,9 +35,7 @@ protected static function getDatabaseNameForConnectionWithoutDatabaseNameParamet return 'master'; } - /** - * @param int[]|string[] $driverOptions - */ + /** @param int[]|string[] $driverOptions */ private function getConnection(array $driverOptions): Connection { $params = TestUtil::getConnectionParams(); @@ -51,8 +47,8 @@ private function getConnection(array $driverOptions): Connection return (new Driver())->connect( array_merge( $params, - ['driverOptions' => $driverOptions] - ) + ['driverOptions' => $driverOptions], + ), ); } @@ -72,7 +68,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 0868bf9bf54..38f1395ba4c 100644 --- a/tests/Functional/Driver/PDO/SQLite/DriverTest.php +++ b/tests/Functional/Driver/PDO/SQLite/DriverTest.php @@ -7,9 +7,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 c6c98491008..54bf07fb437 100644 --- a/tests/Functional/Driver/SQLSrv/DriverTest.php +++ b/tests/Functional/Driver/SQLSrv/DriverTest.php @@ -7,9 +7,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/Driver/SQLSrv/StatementTest.php b/tests/Functional/Driver/SQLSrv/StatementTest.php index a99066c7d3a..c457b694f5a 100644 --- a/tests/Functional/Driver/SQLSrv/StatementTest.php +++ b/tests/Functional/Driver/SQLSrv/StatementTest.php @@ -6,9 +6,7 @@ use Doctrine\DBAL\Tests\FunctionalTestCase; use Doctrine\DBAL\Tests\TestUtil; -/** - * @requires extension sqlsrv - */ +/** @requires extension sqlsrv */ class StatementTest extends FunctionalTestCase { protected function setUp(): void diff --git a/tests/Functional/ExceptionTest.php b/tests/Functional/ExceptionTest.php index 4cc911f1a32..82cc55fb70c 100644 --- a/tests/Functional/ExceptionTest.php +++ b/tests/Functional/ExceptionTest.php @@ -26,9 +26,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 @@ -287,7 +285,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 { @@ -313,7 +311,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', ); } @@ -341,9 +339,7 @@ private function testConnectionException(array $params): void $conn->connect(); } - /** - * @return array> - */ + /** @return array> */ public static function getConnectionParams(): iterable { return [ diff --git a/tests/Functional/FetchBooleanTest.php b/tests/Functional/FetchBooleanTest.php index dd5e7d3cf83..1cdfd374e24 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 13626a3ad4a..0b7890964fc 100644 --- a/tests/Functional/LegacyAPITest.php +++ b/tests/Functional/LegacyAPITest.php @@ -142,7 +142,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 d283a2ad63f..79bab68c4e6 100644 --- a/tests/Functional/LikeWildcardsEscapingTest.php +++ b/tests/Functional/LikeWildcardsEscapingTest.php @@ -20,9 +20,9 @@ public function testFetchLikeExpressionResult(): void "(CASE WHEN '%s' LIKE '%s' ESCAPE '%s' THEN 1 ELSE 0 END)", $string, $databasePlatform->escapeStringForLike($string, $escapeChar), - $escapeChar - ) - ) + $escapeChar, + ), + ), )->execute(); self::assertTrue((bool) $result->fetchOne()); diff --git a/tests/Functional/ModifyLimitQueryTest.php b/tests/Functional/ModifyLimitQueryTest.php index 6ccf663e079..a353473de4a 100644 --- a/tests/Functional/ModifyLimitQueryTest.php +++ b/tests/Functional/ModifyLimitQueryTest.php @@ -136,7 +136,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, diff --git a/tests/Functional/NamedParametersTest.php b/tests/Functional/NamedParametersTest.php index 8653bca5075..e43498fd90a 100644 --- a/tests/Functional/NamedParametersTest.php +++ b/tests/Functional/NamedParametersTest.php @@ -14,9 +14,7 @@ class NamedParametersTest extends FunctionalTestCase { - /** - * @return iterable> - */ + /** @return iterable> */ public static function ticketProvider(): iterable { return [ 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 be40fde3dcf..972d2f716aa 100644 --- a/tests/Functional/Platform/DateExpressionTest.php +++ b/tests/Functional/Platform/DateExpressionTest.php @@ -10,9 +10,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'); @@ -32,15 +30,13 @@ public function testDifference(string $date1, string $date2, int $expected): voi self::assertEquals($expected, $diff); } - /** - * @return string[][]|int[][] - */ + /** @return string[][]|int[][] */ 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 b5de6062eed..47cd4c2f02b 100644 --- a/tests/Functional/Platform/QuotingTest.php +++ b/tests/Functional/Platform/QuotingTest.php @@ -9,22 +9,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 [ @@ -33,22 +29,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); @@ -57,9 +49,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 8b7f23723b3..9fdff201d8a 100644 --- a/tests/Functional/Platform/RenameColumnTest.php +++ b/tests/Functional/Platform/RenameColumnTest.php @@ -11,9 +11,7 @@ class RenameColumnTest extends FunctionalTestCase { - /** - * @dataProvider columnNameProvider - */ + /** @dataProvider columnNameProvider */ public function testColumnPositionRetainedAfterRenaming(string $columnName, string $newColumnName): void { $table = new Table('test_rename'); @@ -36,9 +34,7 @@ public function testColumnPositionRetainedAfterRenaming(string $columnName, stri self::assertSame([strtolower($newColumnName), 'c2'], array_keys($table->getColumns())); } - /** - * @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 2916e67e8d6..1ff4c4b7af1 100644 --- a/tests/Functional/PortabilityTest.php +++ b/tests/Functional/PortabilityTest.php @@ -61,18 +61,14 @@ public function testCaseConversion(int $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); @@ -81,14 +77,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.'); @@ -112,9 +106,7 @@ public function testFetchColumn(string $column, array $expected): void self::assertEquals($expected, $result->fetchFirstColumn()); } - /** - * @return iterable> - */ + /** @return iterable> */ public static function fetchColumnProvider(): iterable { return [ @@ -154,8 +146,8 @@ private function connectWithPortability(int $mode, int $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 99c9a248e05..27026fc6911 100644 --- a/tests/Functional/PrimaryReadReplicaConnectionTest.php +++ b/tests/Functional/PrimaryReadReplicaConnectionTest.php @@ -13,9 +13,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 7b252997c75..c2c82684f48 100644 --- a/tests/Functional/ResultTest.php +++ b/tests/Functional/ResultTest.php @@ -9,9 +9,7 @@ class ResultTest extends FunctionalTestCase { - /** - * @dataProvider methodProvider - */ + /** @dataProvider methodProvider */ public function testExceptionHandling(callable $method): void { if (! TestUtil::isDriverOneOf('mysqli', 'ibm_db2')) { @@ -20,7 +18,7 @@ public function testExceptionHandling(callable $method): void $result = $this->connection->executeQuery( $this->connection->getDatabasePlatform() - ->getDummySelectSQL() + ->getDummySelectSQL(), ); $result->free(); @@ -28,9 +26,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/Schema/ComparatorTest.php b/tests/Functional/Schema/ComparatorTest.php index 47edd96da45..d6ece64e8ac 100644 --- a/tests/Functional/Schema/ComparatorTest.php +++ b/tests/Functional/Schema/ComparatorTest.php @@ -52,9 +52,7 @@ public function testDefaultValueComparison(callable $comparatorFactory, string $ self::assertFalse($comparatorFactory($this->schemaManager)->diffTable($table, $onlineTable)); } - /** - * @return iterable - */ + /** @return iterable */ public static function defaultValueProvider(): iterable { foreach (ComparatorTestUtils::comparatorProvider() as $comparatorType => $comparatorArguments) { @@ -69,7 +67,7 @@ public static function defaultValueProvider(): iterable '%s with default %s value %s', $comparatorType, $testArguments[0], - var_export($testArguments[1], true) + var_export($testArguments[1], true), ) => array_merge($comparatorArguments, $testArguments); } } diff --git a/tests/Functional/Schema/ComparatorTestUtils.php b/tests/Functional/Schema/ComparatorTestUtils.php index 9d05573383d..2deec5c06c6 100644 --- a/tests/Functional/Schema/ComparatorTestUtils.php +++ b/tests/Functional/Schema/ComparatorTestUtils.php @@ -24,7 +24,7 @@ public static function diffFromActualToDesiredTable( ) { return $comparator->diffTable( $schemaManager->listTableDetails($desiredTable->getName()), - $desiredTable + $desiredTable, ); } @@ -40,7 +40,7 @@ public static function diffFromDesiredToActualTable( ) { return $comparator->diffTable( $desiredTable, - $schemaManager->listTableDetails($desiredTable->getName()) + $schemaManager->listTableDetails($desiredTable->getName()), ); } @@ -58,9 +58,7 @@ public static function assertDiffNotEmpty(Connection $connection, Comparator $co TestCase::assertFalse(self::diffFromDesiredToActualTable($schemaManager, $comparator, $table)); } - /** - * @return iterable> - */ + /** @return iterable> */ public static function comparatorProvider(): iterable { yield 'Generic comparator' => [ diff --git a/tests/Functional/Schema/DefaultValueTest.php b/tests/Functional/Schema/DefaultValueTest.php index cd6eb73bb6a..d566dd3fb78 100644 --- a/tests/Functional/Schema/DefaultValueTest.php +++ b/tests/Functional/Schema/DefaultValueTest.php @@ -41,7 +41,7 @@ public function testEscapedDefaultValueCanBeIntrospected(string $name, ?string $ ->getSchemaManager() ->listTableDetails('default_value') ->getColumn($name) - ->getDefault() + ->getDefault(), ); } @@ -53,7 +53,7 @@ public function testEscapedDefaultValueCanBeIntrospected(string $name, ?string $ 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 0850bbde3da..8665e50ec47 100644 --- a/tests/Functional/Schema/MySQL/ComparatorTest.php +++ b/tests/Functional/Schema/MySQL/ComparatorTest.php @@ -33,9 +33,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); @@ -44,19 +42,17 @@ public function testLobLengthIncrementWithinLimit(string $type, int $length): vo self::assertFalse(ComparatorTestUtils::diffFromActualToDesiredTable( $this->schemaManager, $this->comparator, - $table + $table, )); self::assertFalse(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); @@ -64,9 +60,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]; @@ -78,9 +72,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'); @@ -91,9 +83,7 @@ private function createLobTable(string $type, int $length): Table return $table; } - /** - * @throws Exception - */ + /** @throws Exception */ private function increaseLobLength(Table $table): void { $column = $table->getColumn('lob'); @@ -108,13 +98,13 @@ public function testExplicitDefaultCollation(): void self::assertFalse(ComparatorTestUtils::diffFromActualToDesiredTable( $this->schemaManager, $this->comparator, - $table + $table, )); self::assertFalse(ComparatorTestUtils::diffFromDesiredToActualTable( $this->schemaManager, $this->comparator, - $table + $table, )); } @@ -147,13 +137,13 @@ public function testImplicitColumnCharset(): void self::assertFalse(ComparatorTestUtils::diffFromActualToDesiredTable( $this->schemaManager, $this->comparator, - $table + $table, )); self::assertFalse(ComparatorTestUtils::diffFromDesiredToActualTable( $this->schemaManager, $this->comparator, - $table + $table, )); } diff --git a/tests/Functional/Schema/MySQLSchemaManagerTest.php b/tests/Functional/Schema/MySQLSchemaManagerTest.php index 1108fba59d5..3c3a03f7d13 100644 --- a/tests/Functional/Schema/MySQLSchemaManagerTest.php +++ b/tests/Functional/Schema/MySQLSchemaManagerTest.php @@ -179,7 +179,7 @@ public function testDoesNotPropagateDefaultValuesForUnsupportedColumnTypes(): vo { if ($this->connection->getDatabasePlatform() instanceof MariaDb1027Platform) { self::markTestSkipped( - 'MariaDb102Platform supports default values for BLOB and TEXT columns and will propagate values' + 'MariaDb102Platform supports default values for BLOB and TEXT columns and will propagate values', ); } @@ -261,7 +261,7 @@ public function testColumnCharsetChange(): void self::assertContains( 'ALTER TABLE test_column_charset_change CHANGE col_string' . ' col_string VARCHAR(100) CHARACTER SET ascii NOT NULL', - $diff + $diff, ); } @@ -309,36 +309,36 @@ public function testListLobTypeColumns(): void self::assertSame( $platform->getClobTypeDeclarationSQL($offlineColumns['col_tinytext']->toArray()), - $platform->getClobTypeDeclarationSQL($onlineColumns['col_tinytext']->toArray()) + $platform->getClobTypeDeclarationSQL($onlineColumns['col_tinytext']->toArray()), ); self::assertSame( $platform->getClobTypeDeclarationSQL($offlineColumns['col_text']->toArray()), - $platform->getClobTypeDeclarationSQL($onlineColumns['col_text']->toArray()) + $platform->getClobTypeDeclarationSQL($onlineColumns['col_text']->toArray()), ); self::assertSame( $platform->getClobTypeDeclarationSQL($offlineColumns['col_mediumtext']->toArray()), - $platform->getClobTypeDeclarationSQL($onlineColumns['col_mediumtext']->toArray()) + $platform->getClobTypeDeclarationSQL($onlineColumns['col_mediumtext']->toArray()), ); self::assertSame( $platform->getClobTypeDeclarationSQL($offlineColumns['col_longtext']->toArray()), - $platform->getClobTypeDeclarationSQL($onlineColumns['col_longtext']->toArray()) + $platform->getClobTypeDeclarationSQL($onlineColumns['col_longtext']->toArray()), ); self::assertSame( $platform->getBlobTypeDeclarationSQL($offlineColumns['col_tinyblob']->toArray()), - $platform->getBlobTypeDeclarationSQL($onlineColumns['col_tinyblob']->toArray()) + $platform->getBlobTypeDeclarationSQL($onlineColumns['col_tinyblob']->toArray()), ); self::assertSame( $platform->getBlobTypeDeclarationSQL($offlineColumns['col_blob']->toArray()), - $platform->getBlobTypeDeclarationSQL($onlineColumns['col_blob']->toArray()) + $platform->getBlobTypeDeclarationSQL($onlineColumns['col_blob']->toArray()), ); self::assertSame( $platform->getBlobTypeDeclarationSQL($offlineColumns['col_mediumblob']->toArray()), - $platform->getBlobTypeDeclarationSQL($onlineColumns['col_mediumblob']->toArray()) + $platform->getBlobTypeDeclarationSQL($onlineColumns['col_mediumblob']->toArray()), ); self::assertSame( $platform->getBlobTypeDeclarationSQL($offlineColumns['col_longblob']->toArray()), - $platform->getBlobTypeDeclarationSQL($onlineColumns['col_longblob']->toArray()) + $platform->getBlobTypeDeclarationSQL($onlineColumns['col_longblob']->toArray()), ); } @@ -353,7 +353,7 @@ public function testDiffListGuidTableColumn(): void self::assertFalse( $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.', ); } @@ -441,11 +441,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/OracleSchemaManagerTest.php b/tests/Functional/Schema/OracleSchemaManagerTest.php index ffd45769174..70167f03235 100644 --- a/tests/Functional/Schema/OracleSchemaManagerTest.php +++ b/tests/Functional/Schema/OracleSchemaManagerTest.php @@ -89,7 +89,7 @@ public function testListTableDetailsWithDifferentIdentifierQuotingRequirements() $offlinePrimaryTable->addColumn( '"Id"', 'integer', - ['autoincrement' => true, 'comment' => 'Explicit casing.'] + ['autoincrement' => true, 'comment' => 'Explicit casing.'], ); $offlinePrimaryTable->addColumn('select', 'integer', ['comment' => 'Reserved keyword.']); $offlinePrimaryTable->addColumn('foo', 'integer', ['comment' => 'Implicit uppercasing.']); @@ -111,7 +111,7 @@ public function testListTableDetailsWithDifferentIdentifierQuotingRequirements() ['"Fk"'], ['"Id"'], [], - '"Primary_Table_Fk"' + '"Primary_Table_Fk"', ); $offlineForeignTable->setPrimaryKey(['id']); @@ -186,15 +186,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), ); } @@ -231,7 +231,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'); @@ -261,7 +261,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 8d5e16b883e..e89699ddb11 100644 --- a/tests/Functional/Schema/PostgreSQL/SchemaTest.php +++ b/tests/Functional/Schema/PostgreSQL/SchemaTest.php @@ -33,7 +33,7 @@ public function testCreateTableWithSequenceInColumnDefinition(): void $result = $this->connection->fetchAssociative( 'SELECT column_default FROM information_schema.columns WHERE table_name = ?', - ['my_table'] + ['my_table'], ); $this->assertNotFalse($result); diff --git a/tests/Functional/Schema/PostgreSQLSchemaManagerTest.php b/tests/Functional/Schema/PostgreSQLSchemaManagerTest.php index 0f3c37f5363..f7016e83315 100644 --- a/tests/Functional/Schema/PostgreSQLSchemaManagerTest.php +++ b/tests/Functional/Schema/PostgreSQLSchemaManagerTest.php @@ -149,7 +149,7 @@ public function testAlterTableAutoIncrementDrop(callable $comparatorFactory): vo self::assertEquals( ['ALTER TABLE autoinc_table_drop ALTER id DROP DEFAULT'], - $platform->getAlterTableSQL($diff) + $platform->getAlterTableSQL($diff), ); $this->schemaManager->alterTable($diff); @@ -214,7 +214,7 @@ public function testReturnQuotedAssets(): void 'CREATE TABLE dbal91_something (id INT NOT NULL, "table" INT DEFAULT NULL, PRIMARY KEY(id))', 'CREATE INDEX IDX_A9401304ECA7352B ON dbal91_something ("table")', ], - $this->connection->getDatabasePlatform()->getCreateTableSQL($table) + $this->connection->getDatabasePlatform()->getCreateTableSQL($table), ); } @@ -230,7 +230,7 @@ public function testListForeignKeys(): void 'test_create_fk2', ['id'], 'foreign_key_test' . $i . '_fk', - ['onDelete' => $fkOptions[$i]] + ['onDelete' => $fkOptions[$i]], ); } @@ -460,9 +460,7 @@ public function testListNegativeColumnDefaultValue(): void self::assertEquals('(-1)', $columns['col_string']->getDefault()); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function serialTypes(): iterable { return [ @@ -471,9 +469,7 @@ public static function serialTypes(): iterable ]; } - /** - * @dataProvider serialTypes - */ + /** @dataProvider serialTypes */ public function testAutoIncrementCreatesSerialDataTypesWithoutADefaultValue(string $type): void { $tableName = 'test_serial_type_' . $type; @@ -488,9 +484,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; @@ -531,7 +525,7 @@ public function testAlterTableAutoIncrementIntToBigInt( self::assertInstanceOf(TableDiff::class, $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); @@ -539,9 +533,7 @@ public function testAlterTableAutoIncrementIntToBigInt( self::assertTrue($tableFinal->getColumn('id')->getAutoincrement()); } - /** - * @return iterable - */ + /** @return iterable */ public static function autoIncrementTypeMigrations(): iterable { foreach (ComparatorTestUtils::comparatorProvider() as $comparatorArguments) { diff --git a/tests/Functional/Schema/SQLServerSchemaManagerTest.php b/tests/Functional/Schema/SQLServerSchemaManagerTest.php index 0958ee9286a..374577160f4 100644 --- a/tests/Functional/Schema/SQLServerSchemaManagerTest.php +++ b/tests/Functional/Schema/SQLServerSchemaManagerTest.php @@ -82,13 +82,13 @@ 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', new Column('df_string_2', Type::getType('string')), ['default'], - new Column('df_string_2', Type::getType('string'), ['default' => 'Doctrine rocks!!!']) + new Column('df_string_2', Type::getType('string'), ['default' => 'Doctrine rocks!!!']), ), 'df_string_3' => new ColumnDiff( 'df_string_3', @@ -100,13 +100,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]), ), ], [ @@ -115,13 +115,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); @@ -145,14 +145,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); @@ -175,7 +175,7 @@ public function testColumnComments(): 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', 'object'); @@ -197,7 +197,7 @@ public function testColumnComments(): void self::assertEquals('Doctrine 0wnz you!', $columns['comment']->getComment()); self::assertEquals( 'Doctrine 0wnz comments for explicitly quoted columns!', - $columns['comment_quoted']->getComment() + $columns['comment_quoted']->getComment(), ); self::assertEquals('Doctrine 0wnz comments for reserved keyword columns!', $columns['[create]']->getComment()); self::assertNull($columns['commented_type']->getComment()); @@ -251,7 +251,7 @@ public function testColumnComments(): 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]), ); // Remove comment from null-commented column. @@ -259,7 +259,7 @@ public function testColumnComments(): void 'comment_null', new Column('comment_null', Type::getType('string')), ['type'], - new Column('comment_null', Type::getType('integer'), ['comment' => null]) + new Column('comment_null', Type::getType('integer'), ['comment' => null]), ); // Add comment to false-commented column. @@ -267,7 +267,7 @@ public function testColumnComments(): void 'comment_false', new Column('comment_false', Type::getType('integer'), ['comment' => 'false']), ['comment'], - new Column('comment_false', Type::getType('integer'), ['comment' => false]) + new Column('comment_false', Type::getType('integer'), ['comment' => false]), ); // Change type to custom type from empty string commented column. @@ -275,7 +275,7 @@ public function testColumnComments(): void 'comment_empty_string', new Column('comment_empty_string', Type::getType('object')), ['type'], - new Column('comment_empty_string', Type::getType('integer'), ['comment' => '']) + new Column('comment_empty_string', Type::getType('integer'), ['comment' => '']), ); // Change comment to false-comment from zero-string commented column. @@ -283,7 +283,7 @@ public function testColumnComments(): void 'comment_string_0', new Column('comment_string_0', Type::getType('integer'), ['comment' => false]), ['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. @@ -291,7 +291,7 @@ public function testColumnComments(): 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. @@ -299,7 +299,7 @@ public function testColumnComments(): void '`comment_quoted`', new Column('`comment_quoted`', Type::getType('array'), ['comment' => 'Doctrine array.']), ['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. @@ -310,8 +310,8 @@ public function testColumnComments(): 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. @@ -319,7 +319,7 @@ public function testColumnComments(): void 'commented_type', new Column('commented_type', Type::getType('integer'), ['comment' => 'foo']), ['comment', 'type'], - new Column('commented_type', Type::getType('object')) + new Column('commented_type', Type::getType('object')), ); // Remove comment from commented custom type column. @@ -327,7 +327,7 @@ public function testColumnComments(): void 'commented_type_with_comment', new Column('commented_type_with_comment', Type::getType('array')), ['comment'], - new Column('commented_type_with_comment', Type::getType('array'), ['comment' => 'Doctrine array type.']) + new Column('commented_type_with_comment', Type::getType('array'), ['comment' => 'Doctrine array type.']), ); // Change column requirements without changing comment. @@ -336,13 +336,13 @@ public function testColumnComments(): void new Column( 'commented_req_change_column', Type::getType('integer'), - ['comment' => 'Some comment', 'notnull' => true] + ['comment' => 'Some comment', 'notnull' => true], ), ['notnull'], new Column( 'commented_req_change_column', Type::getType('integer'), - ['comment' => 'Some comment', 'notnull' => false] + ['comment' => 'Some comment', 'notnull' => false], ), ); diff --git a/tests/Functional/Schema/SchemaManagerFunctionalTestCase.php b/tests/Functional/Schema/SchemaManagerFunctionalTestCase.php index 346f091ab20..76a8a4e0c93 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); @@ -121,7 +119,7 @@ private function filterElementsByName(array $items, string $name): array $items, static function (AbstractAsset $item) use ($name): bool { return $item->getShortestName($item->getNamespaceName()) === $name; - } + }, ); } @@ -134,7 +132,7 @@ public function testListSequences(): void } $this->schemaManager->createSequence( - new Sequence('list_sequences_test_seq', 20, 10) + new Sequence('list_sequences_test_seq', 20, 10), ); $sequences = $this->schemaManager->listSequences(); @@ -171,9 +169,7 @@ public function testListDatabases(): void self::assertContains('test_create_database', $databases); } - /** - * @dataProvider listSchemaNamesMethodProvider - */ + /** @dataProvider listSchemaNamesMethodProvider */ public function testListSchemaNames(callable $method): void { $platform = $this->connection->getDatabasePlatform(); @@ -190,15 +186,13 @@ public function testListSchemaNames(callable $method): 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', $method($this->schemaManager)); } - /** - * @return iterable> - */ + /** @return iterable> */ public static function listSchemaNamesMethodProvider(): iterable { yield [ @@ -241,9 +235,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'); @@ -254,16 +246,14 @@ public function testListTablesWithFilter(string $prefix, int $expectedCount): vo $this->connection->getConfiguration()->setSchemaAssetsFilter( static function (string $name) use ($prefix): bool { return substr(strtolower($name), 0, strlen($prefix)) === $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]; @@ -444,7 +434,7 @@ public function testDiffListTableColumns(callable $comparatorFactory): 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).', ); } @@ -564,7 +554,7 @@ public function testListForeignKeys(): void 'test_create_fk2', ['id'], 'foreign_key_test_fk', - ['onDelete' => 'CASCADE'] + ['onDelete' => 'CASCADE'], ); $this->schemaManager->createForeignKey($foreignKey, 'test_create_fk1'); @@ -596,7 +586,7 @@ public function testCreateForeignKeyWithTableObject(): void ['foreign_key_test'], ['id'], [], - 'i' + 'i', ); $foreignKey = $table->getForeignKeys()['i']; $this->schemaManager->createForeignKey($foreignKey, $table); @@ -703,7 +693,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'); @@ -718,7 +708,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()); @@ -893,7 +883,7 @@ public function testRenameIndexUsedInForeignKeyConstraint(callable $comparatorFa ['fk'], ['id'], [], - 'fk_constraint' + 'fk_constraint', ); $this->dropTableIfExists($foreignTable->getName()); @@ -945,14 +935,14 @@ public function testGetColumnComment(): void 'id', new Column( 'id', - Type::getType('integer') + Type::getType('integer'), ), ['comment'], new Column( 'id', Type::getType('integer'), - ['comment' => 'This is a comment'] - ) + ['comment' => 'This is a comment'], + ), ); $this->schemaManager->alterTable($tableDiff); @@ -1033,14 +1023,14 @@ 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( 'col_string', new Column('col_string', Type::getType('string'), ['default' => 'foo', 'fixed' => true]), ['fixed'], - new Column('col_string', Type::getType('string'), ['default' => 'foo']) + new Column('col_string', Type::getType('string'), ['default' => 'foo']), ); $this->schemaManager->alterTable($tableDiff); @@ -1067,9 +1057,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'] ?? []; @@ -1081,9 +1069,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); @@ -1108,9 +1094,7 @@ protected function getTestCompositeTable(string $name): Table return $table; } - /** - * @param Table[] $tables - */ + /** @param Table[] $tables */ protected function assertHasTable(array $tables): void { $foundTable = false; @@ -1135,7 +1119,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'); @@ -1265,15 +1249,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), ); } @@ -1318,7 +1302,7 @@ public function testCommentNotDuplicated(): void $columnDefinition = substr( $this->connection->getDatabasePlatform()->getColumnDeclarationSQL('id', $options), - strlen('id') + 1 + strlen('id') + 1, ); $table = new Table('my_table'); @@ -1388,9 +1372,7 @@ public function testAlterColumnComment( self::assertSame($expectedComment2, $onlineTable->getColumn('no_comment2')->getComment()); } - /** - * @return iterable - */ + /** @return iterable */ public static function getAlterColumnComment(): iterable { foreach (ComparatorTestUtils::comparatorProvider() as $comparatorArguments) { @@ -1463,9 +1445,7 @@ public function testComparatorShouldNotAddCommentToJsonTypeSinceItIsTheDefaultNo self::assertFalse($tableDiff); } - /** - * @dataProvider commentsProvider - */ + /** @dataProvider commentsProvider */ public function testExtractDoctrineTypeFromComment(string $comment, string $expected, string $currentType): void { $result = $this->schemaManager->extractDoctrineTypeFromComment($comment, $currentType); @@ -1473,9 +1453,7 @@ public function testExtractDoctrineTypeFromComment(string $comment, string $expe self::assertSame($expected, $result); } - /** - * @return string[][] - */ + /** @return string[][] */ public function commentsProvider(): array { $currentType = 'current type'; @@ -1556,8 +1534,8 @@ public function testComparisonWithAutoDetectedSequenceDefinition(callable $compa $this->schemaManager->listSequences(), static function (Sequence $sequence) use ($sequenceName): bool { return strcasecmp($sequence->getName(), $sequenceName) === 0; - } - ) + }, + ), )[0] ?? null; self::assertNotNull($createdSequence); @@ -1578,7 +1556,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'); @@ -1586,7 +1564,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); @@ -1596,7 +1574,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.', ); } @@ -1656,7 +1634,7 @@ public function testCreatedCompositeForeignKeyOrderIsCorrectAfterCreation(): voi $localColumns, $foreignColumns, [], - $foreignKey + $foreignKey, ); $this->schemaManager->createTable($table); @@ -1715,9 +1693,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 df0de542ad3..dc3fa7d2a64 100644 --- a/tests/Functional/Schema/SqliteSchemaManagerTest.php +++ b/tests/Functional/Schema/SqliteSchemaManagerTest.php @@ -61,7 +61,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, @@ -69,8 +69,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( @@ -78,21 +77,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'], null, - ['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], ), ]; @@ -134,7 +133,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 504b2ee5aa4..8f3863f837b 100644 --- a/tests/Functional/StatementTest.php +++ b/tests/Functional/StatementTest.php @@ -103,7 +103,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)); @@ -272,7 +272,7 @@ public function testParameterBindingOrder(): void $query = $platform->getDummySelectSQL( $platform->getLengthExpression('?') . ', ' - . $platform->getLengthExpression('?') + . $platform->getLengthExpression('?'), ); $stmt = $this->connection->prepare($query); @@ -310,33 +310,25 @@ public function testFetchFromExecutedStatementWithFreedResult(callable $fetch, $ self::assertSame($expected, $value); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function emptyFetchProvider(): iterable { return [ 'fetch' => [ - /** - * @return mixed - */ + /** @return mixed */ static function (Result $result) { return $result->fetchAssociative(); }, false, ], - /** - * @return mixed|false - */ + /** @return mixed|false */ 'fetch-column' => [ static function (Result $result) { return $result->fetchOne(); }, false, ], - /** - * @return mixed[] - */ + /** @return mixed[] */ 'fetch-all' => [ static function (Result $result): array { return $result->fetchAllAssociative(); diff --git a/tests/Functional/TemporaryTableTest.php b/tests/Functional/TemporaryTableTest.php index ba45d88718d..ac2a8b657d0 100644 --- a/tests/Functional/TemporaryTableTest.php +++ b/tests/Functional/TemporaryTableTest.php @@ -74,7 +74,7 @@ public function testCreateTemporaryTableNotAutoCommitTransaction(): void try { $this->connection->executeStatement( - $platform->getDropTemporaryTableSQL($tempTable) + $platform->getDropTemporaryTableSQL($tempTable), ); } catch (Throwable $e) { } @@ -87,7 +87,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 6940dd76609..59e3f669217 100644 --- a/tests/Functional/Ticket/DBAL752Test.php +++ b/tests/Functional/Ticket/DBAL752Test.php @@ -18,7 +18,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, @@ -29,8 +29,7 @@ public function testUnsignedIntegerDetection(): void big BIGINT, big_unsigned BIGINT UNSIGNED ); -SQL - ); +SQL); $schemaManager = $this->connection->getSchemaManager(); diff --git a/tests/Functional/TypeConversionTest.php b/tests/Functional/TypeConversionTest.php index 8eb60c92162..e43e3873b4c 100644 --- a/tests/Functional/TypeConversionTest.php +++ b/tests/Functional/TypeConversionTest.php @@ -51,9 +51,7 @@ public function testIdempotentConversionToBoolean(string $type, $originalValue): self::assertEquals($originalValue, $dbValue); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function booleanProvider(): iterable { return [ @@ -75,9 +73,7 @@ public function testIdempotentConversionToInteger(string $type, $originalValue): self::assertEquals($originalValue, $dbValue); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function integerProvider(): iterable { return [ @@ -98,9 +94,7 @@ public function testIdempotentConversionToFloat(string $type, $originalValue): v self::assertEquals($originalValue, $dbValue); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function floatProvider(): iterable { return [ @@ -127,9 +121,7 @@ public function testIdempotentConversionToString(string $type, $originalValue): self::assertEquals($originalValue, $dbValue); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function toStringProvider(): iterable { return [ @@ -151,9 +143,7 @@ public function testIdempotentConversionToArray(string $type, $originalValue): v self::assertEquals($originalValue, $dbValue); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function toArrayProvider(): iterable { return [ @@ -175,9 +165,7 @@ public function testIdempotentConversionToObject(string $type, $originalValue): self::assertEquals($originalValue, $dbValue); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function toObjectProvider(): iterable { $obj = new stdClass(); @@ -189,9 +177,7 @@ public static function toObjectProvider(): iterable ]; } - /** - * @dataProvider toDateTimeProvider - */ + /** @dataProvider toDateTimeProvider */ public function testIdempotentConversionToDateTime(string $type, DateTime $originalValue): void { $dbValue = $this->processValue($type, $originalValue); @@ -205,13 +191,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 [ @@ -233,7 +217,7 @@ private function processValue(string $type, $originalValue) $typeInstance = Type::getType($type); $insertionValue = $typeInstance->convertToDatabaseValue( $originalValue, - $this->connection->getDatabasePlatform() + $this->connection->getDatabasePlatform(), ); $this->connection->insert('type_conversion', ['id' => ++self::$typeCounter, $columnName => $insertionValue]); @@ -242,7 +226,7 @@ private function processValue(string $type, $originalValue) 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 c9b5e457bb7..0ea51cfa913 100644 --- a/tests/Functional/Types/BinaryTest.php +++ b/tests/Functional/Types/BinaryTest.php @@ -67,15 +67,13 @@ private function insert(string $id, string $value): void self::assertSame(1, $result); } - /** - * @return mixed - */ + /** @return mixed */ private function select(string $id) { $value = $this->connection->fetchOne( 'SELECT val FROM binary_table WHERE id = ?', [$id], - [ParameterType::BINARY] + [ParameterType::BINARY], ); // Currently, `BinaryType` mistakenly converts string values fetched from the DB to a stream. 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 944dccdb62f..1f4c4765f02 100644 --- a/tests/Functional/WriteTest.php +++ b/tests/Functional/WriteTest.php @@ -52,7 +52,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!'); @@ -131,19 +131,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'], )); } @@ -177,7 +177,7 @@ public function testLastInsertIdSequence(): void })); $nextSequenceVal = $this->connection->fetchOne( - $this->connection->getDatabasePlatform()->getSequenceNextValSQL('write_table_id_seq') + $this->connection->getDatabasePlatform()->getSequenceNextValSQL('write_table_id_seq'), ); $lastInsertId = $this->lastInsertId('write_table_id_seq'); @@ -193,7 +193,7 @@ public function testLastInsertIdNoSequenceGiven(): void || $this->connection->getDatabasePlatform()->supportsIdentityColumns() ) { self::markTestSkipped( - "Test only works consistently on platforms that support sequences and don't support identity columns." + "Test only works consistently on platforms that support sequences and don't support identity columns.", ); } @@ -207,14 +207,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, ); } @@ -225,7 +225,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'); @@ -234,14 +234,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, ); } @@ -251,7 +251,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', [ @@ -273,7 +273,7 @@ public function testEmptyIdentityInsert(): void if (! ($platform->supportsIdentityColumns() || $platform->usesSequenceEmulatedIdentityColumns())) { self::markTestSkipped( - 'Test only works on platforms with identity columns or sequence emulated identity columns.' + 'Test only works on platforms with identity columns or sequence emulated identity columns.', ); } @@ -312,7 +312,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'); @@ -334,7 +334,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'); diff --git a/tests/FunctionalTestCase.php b/tests/FunctionalTestCase.php index a85a31d023d..cdb84453dd6 100644 --- a/tests/FunctionalTestCase.php +++ b/tests/FunctionalTestCase.php @@ -33,9 +33,7 @@ protected function markConnectionNotReusable(): void $this->isConnectionReusable = false; } - /** - * @before - */ + /** @before */ final protected function connect(): void { if (self::$sharedConnection === null) { @@ -45,9 +43,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/DebugStackTest.php b/tests/Logging/DebugStackTest.php index 3ecb0dd7973..58ee44668b7 100644 --- a/tests/Logging/DebugStackTest.php +++ b/tests/Logging/DebugStackTest.php @@ -31,7 +31,7 @@ public function testLoggedQuery(): void 'executionMS' => 0, ], ], - $this->logger->queries + $this->logger->queries, ); $this->logger->stopQuery(); diff --git a/tests/Logging/LoggerChainTest.php b/tests/Logging/LoggerChainTest.php index c3f03cf870c..c65260f83e4 100644 --- a/tests/Logging/LoggerChainTest.php +++ b/tests/Logging/LoggerChainTest.php @@ -27,9 +27,7 @@ public function testStopQuery(): void $listener->stopQuery(); } - /** - * @param mixed ...$args - */ + /** @param mixed ...$args */ private function createChain(string $method, ...$args): LoggerChain { return new LoggerChain([ @@ -38,9 +36,7 @@ private function createChain(string $method, ...$args): LoggerChain ]); } - /** - * @param mixed ...$args - */ + /** @param mixed ...$args */ private function createLogger(string $method, ...$args): SQLLogger { $logger = $this->createMock(SQLLogger::class); diff --git a/tests/Platforms/AbstractMySQLPlatformTestCase.php b/tests/Platforms/AbstractMySQLPlatformTestCase.php index 06e64b005e4..d317128c30a 100644 --- a/tests/Platforms/AbstractMySQLPlatformTestCase.php +++ b/tests/Platforms/AbstractMySQLPlatformTestCase.php @@ -15,9 +15,7 @@ use function array_shift; -/** - * @extends AbstractPlatformTestCase - */ +/** @extends AbstractPlatformTestCase */ abstract class AbstractMySQLPlatformTestCase extends AbstractPlatformTestCase { public function testModifyLimitQueryWitoutLimit(): void @@ -34,7 +32,7 @@ public function testGenerateMixedCaseTableCreate(): void $sql = $this->platform->getCreateTableSQL($table); self::assertEquals( 'CREATE TABLE Foo (Bar INT NOT NULL) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB', - array_shift($sql) + array_shift($sql), ); } @@ -44,9 +42,7 @@ public function getGenerateTableSql(): string . 'PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB'; } - /** - * @return string[] - */ + /** @return string[] */ public function getGenerateTableWithMultiColumnUniqueIndexSql(): array { return [ @@ -75,7 +71,7 @@ public function testGeneratesSqlSnippets(): void 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], + ), ); } @@ -131,16 +127,16 @@ public function testGeneratesTypeDeclarationForStrings(): void self::assertEquals( 'CHAR(10)', $this->platform->getStringTypeDeclarationSQL( - ['length' => 10, 'fixed' => true] - ) + ['length' => 10, 'fixed' => true], + ), ); self::assertEquals( 'VARCHAR(50)', - $this->platform->getStringTypeDeclarationSQL(['length' => 50]) + $this->platform->getStringTypeDeclarationSQL(['length' => 50]), ); self::assertEquals( 'VARCHAR(255)', - $this->platform->getStringTypeDeclarationSQL([]) + $this->platform->getStringTypeDeclarationSQL([]), ); } @@ -174,9 +170,7 @@ protected function getGenerateForeignKeySql(): string return 'ALTER TABLE test ADD FOREIGN KEY (fk_name_id) REFERENCES other_table (id)'; } - /** - * @dataProvider comparatorProvider - */ + /** @dataProvider comparatorProvider */ public function testUniquePrimaryKey(Comparator $comparator): void { $keyTable = new Table('foo'); @@ -267,9 +261,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, ' @@ -277,9 +269,7 @@ protected function getQuotedColumnInPrimaryKeySQL(): array ]; } - /** - * @return string[] - */ + /** @return string[] */ protected function getQuotedColumnInIndexSQL(): array { return [ @@ -289,9 +279,7 @@ protected function getQuotedColumnInIndexSQL(): array ]; } - /** - * @return string[] - */ + /** @return string[] */ protected function getQuotedNameInIndexSQL(): array { return [ @@ -300,9 +288,7 @@ protected function getQuotedNameInIndexSQL(): array ]; } - /** - * @return string[] - */ + /** @return string[] */ protected function getQuotedColumnInForeignKeySQL(): array { return [ @@ -335,7 +321,7 @@ public function testCreateTableWithFulltextIndex(): void . 'FULLTEXT INDEX fulltext_text (text)) ' . 'DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = MyISAM', ], - $sql + $sql, ); } @@ -355,7 +341,7 @@ public function testCreateTableWithSpatialIndex(): void 'CREATE TABLE spatial_table (point LONGTEXT NOT NULL, SPATIAL INDEX spatial_text (point)) ' . 'DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = MyISAM', ], - $sql + $sql, ); } @@ -383,9 +369,7 @@ public function testBlobTypeDeclarationSQL(): void self::assertEquals('LONGBLOB', $this->platform->getBlobTypeDeclarationSQL([])); } - /** - * @dataProvider comparatorProvider - */ + /** @dataProvider comparatorProvider */ public function testAlterTableAddPrimaryKey(Comparator $comparator): void { $table = new Table('alter_table_add_pk'); @@ -403,13 +387,11 @@ public function testAlterTableAddPrimaryKey(Comparator $comparator): 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), ); } - /** - * @dataProvider comparatorProvider - */ + /** @dataProvider comparatorProvider */ public function testAlterPrimaryKeyWithAutoincrementColumn(Comparator $comparator): void { $table = new Table('alter_primary_key'); @@ -431,13 +413,11 @@ public function testAlterPrimaryKeyWithAutoincrementColumn(Comparator $comparato 'DROP INDEX `primary` ON alter_primary_key', 'ALTER TABLE alter_primary_key ADD PRIMARY KEY (foo)', ], - $this->platform->getAlterTableSQL($diff) + $this->platform->getAlterTableSQL($diff), ); } - /** - * @dataProvider comparatorProvider - */ + /** @dataProvider comparatorProvider */ public function testDropPrimaryKeyWithAutoincrementColumn(Comparator $comparator): void { $table = new Table('drop_primary_key'); @@ -458,13 +438,11 @@ public function testDropPrimaryKeyWithAutoincrementColumn(Comparator $comparator '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), ); } - /** - * @dataProvider comparatorProvider - */ + /** @dataProvider comparatorProvider */ public function testDropNonAutoincrementColumnFromCompositePrimaryKeyWithAutoincrementColumn( Comparator $comparator ): void { @@ -488,13 +466,11 @@ public function testDropNonAutoincrementColumnFromCompositePrimaryKeyWithAutoinc 'DROP INDEX `primary` ON tbl', 'ALTER TABLE tbl ADD PRIMARY KEY (id)', ], - $this->platform->getAlterTableSQL($diff) + $this->platform->getAlterTableSQL($diff), ); } - /** - * @dataProvider comparatorProvider - */ + /** @dataProvider comparatorProvider */ public function testAddNonAutoincrementColumnToPrimaryKeyWithAutoincrementColumn(Comparator $comparator): void { $table = new Table('tbl'); @@ -517,13 +493,11 @@ public function testAddNonAutoincrementColumnToPrimaryKeyWithAutoincrementColumn 'DROP INDEX `primary` ON tbl', 'ALTER TABLE tbl ADD PRIMARY KEY (id, foo)', ], - $this->platform->getAlterTableSQL($diff) + $this->platform->getAlterTableSQL($diff), ); } - /** - * @dataProvider comparatorProvider - */ + /** @dataProvider comparatorProvider */ public function testAddAutoIncrementPrimaryKey(Comparator $comparator): void { $keyTable = new Table('foo'); @@ -555,9 +529,7 @@ public function testNamedPrimaryKey(): void ], $sql); } - /** - * @dataProvider comparatorProvider - */ + /** @dataProvider comparatorProvider */ public function testAlterPrimaryKeyWithNewColumn(Comparator $comparator): void { $table = new Table('yolo'); @@ -580,7 +552,7 @@ public function testAlterPrimaryKeyWithNewColumn(Comparator $comparator): 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), ); } @@ -652,8 +624,8 @@ public function testDoesNotPropagateForeignKeyCreationForNonSupportingEngines(): ], $this->platform->getCreateTableSQL( $table, - AbstractPlatform::CREATE_INDEXES | AbstractPlatform::CREATE_FOREIGNKEYS - ) + AbstractPlatform::CREATE_INDEXES | AbstractPlatform::CREATE_FOREIGNKEYS, + ), ); $table = clone $table; @@ -669,8 +641,8 @@ public function testDoesNotPropagateForeignKeyCreationForNonSupportingEngines(): ], $this->platform->getCreateTableSQL( $table, - AbstractPlatform::CREATE_INDEXES | AbstractPlatform::CREATE_FOREIGNKEYS - ) + AbstractPlatform::CREATE_INDEXES | AbstractPlatform::CREATE_FOREIGNKEYS, + ), ); } @@ -710,13 +682,11 @@ public function testDoesNotPropagateForeignKeyAlterationForNonSupportingEngines( 'ALTER TABLE foreign_table ADD CONSTRAINT fk_add FOREIGN KEY (fk_id) REFERENCES foo (id)', 'ALTER TABLE foreign_table ADD CONSTRAINT fk_change FOREIGN KEY (fk_id) REFERENCES bar (id)', ], - $this->platform->getAlterTableSQL($tableDiff) + $this->platform->getAlterTableSQL($tableDiff), ); } - /** - * @return string[] - */ + /** @return string[] */ protected function getAlterTableRenameIndexSQL(): array { return [ @@ -725,9 +695,7 @@ protected function getAlterTableRenameIndexSQL(): array ]; } - /** - * @return string[] - */ + /** @return string[] */ protected function getQuotedAlterTableRenameIndexSQL(): array { return [ @@ -738,9 +706,7 @@ protected function getQuotedAlterTableRenameIndexSQL(): array ]; } - /** - * @return string[] - */ + /** @return string[] */ protected function getAlterTableRenameIndexInSchemaSQL(): array { return [ @@ -749,9 +715,7 @@ protected function getAlterTableRenameIndexInSchemaSQL(): array ]; } - /** - * @return string[] - */ + /** @return string[] */ protected function getQuotedAlterTableRenameIndexInSchemaSQL(): array { return [ @@ -788,7 +752,7 @@ public function testIgnoresDifferenceInDefaultValuesForUnsupportedColumnTypes(): . 'def_blob_null LONGBLOB DEFAULT NULL' . ') DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB', ], - $this->platform->getCreateTableSQL($table) + $this->platform->getCreateTableSQL($table), ); $diffTable = clone $table; @@ -799,7 +763,7 @@ public function testIgnoresDifferenceInDefaultValuesForUnsupportedColumnTypes(): $comparator = new MySQL\Comparator( $this->platform, - $this->createMock(CollationMetadataProvider::class) + $this->createMock(CollationMetadataProvider::class), ); self::assertFalse($comparator->diffTable($table, $diffTable)); @@ -948,7 +912,7 @@ public function testQuotesTableNameInListTableIndexesSQL(): void { self::assertStringContainsStringIgnoringCase( "'Foo''Bar\\\\'", - $this->platform->getListTableIndexesSQL("Foo'Bar\\", 'foo_db') + $this->platform->getListTableIndexesSQL("Foo'Bar\\", 'foo_db'), ); } @@ -956,7 +920,7 @@ public function testQuotesDatabaseNameInListTableIndexesSQL(): void { self::assertStringContainsStringIgnoringCase( "'Foo''Bar\\\\'", - $this->platform->getListTableIndexesSQL('foo_table', "Foo'Bar\\") + $this->platform->getListTableIndexesSQL('foo_table', "Foo'Bar\\"), ); } @@ -964,7 +928,7 @@ public function testQuotesDatabaseNameInListViewsSQL(): void { self::assertStringContainsStringIgnoringCase( "'Foo''Bar\\\\'", - $this->platform->getListViewsSQL("Foo'Bar\\") + $this->platform->getListViewsSQL("Foo'Bar\\"), ); } @@ -972,7 +936,7 @@ public function testQuotesTableNameInListTableForeignKeysSQL(): void { self::assertStringContainsStringIgnoringCase( "'Foo''Bar\\\\'", - $this->platform->getListTableForeignKeysSQL("Foo'Bar\\") + $this->platform->getListTableForeignKeysSQL("Foo'Bar\\"), ); } @@ -980,7 +944,7 @@ public function testQuotesDatabaseNameInListTableForeignKeysSQL(): void { self::assertStringContainsStringIgnoringCase( "'Foo''Bar\\\\'", - $this->platform->getListTableForeignKeysSQL('foo_table', "Foo'Bar\\") + $this->platform->getListTableForeignKeysSQL('foo_table', "Foo'Bar\\"), ); } @@ -988,7 +952,7 @@ public function testQuotesTableNameInListTableColumnsSQL(): void { self::assertStringContainsStringIgnoringCase( "'Foo''Bar\\\\'", - $this->platform->getListTableColumnsSQL("Foo'Bar\\") + $this->platform->getListTableColumnsSQL("Foo'Bar\\"), ); } @@ -996,7 +960,7 @@ public function testQuotesDatabaseNameInListTableColumnsSQL(): void { self::assertStringContainsStringIgnoringCase( "'Foo''Bar\\\\'", - $this->platform->getListTableColumnsSQL('foo_table', "Foo'Bar\\") + $this->platform->getListTableColumnsSQL('foo_table', "Foo'Bar\\"), ); } @@ -1016,7 +980,7 @@ public function testColumnCharsetDeclarationSQL(): void { self::assertSame( 'CHARACTER SET ascii', - $this->platform->getColumnCharsetDeclarationSQL('ascii') + $this->platform->getColumnCharsetDeclarationSQL('ascii'), ); } @@ -1029,7 +993,7 @@ public function testColumnCollationDeclarationSQL(): void { self::assertSame( 'COLLATE `ascii_general_ci`', - $this->platform->getColumnCollationDeclarationSQL('ascii_general_ci') + $this->platform->getColumnCollationDeclarationSQL('ascii_general_ci'), ); } @@ -1045,13 +1009,11 @@ public function testGetCreateTableSQLWithColumnCollation(): void . 'column_collation VARCHAR(255) NOT NULL COLLATE `ascii_general_ci`) ' . 'DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB', ], - $this->platform->getCreateTableSQL($table) + $this->platform->getCreateTableSQL($table), ); } - /** - * @return iterable - */ + /** @return iterable */ public static function comparatorProvider(): iterable { yield 'Generic comparator' => [ @@ -1066,7 +1028,7 @@ public function getCollationCharset(string $collation): ?string { return null; } - } + }, ), ]; } diff --git a/tests/Platforms/AbstractPlatformTestCase.php b/tests/Platforms/AbstractPlatformTestCase.php index 0742d6a3e37..d1b5b6c08d9 100644 --- a/tests/Platforms/AbstractPlatformTestCase.php +++ b/tests/Platforms/AbstractPlatformTestCase.php @@ -28,9 +28,7 @@ use function sprintf; use function str_repeat; -/** - * @template T of AbstractPlatform - */ +/** @template T of AbstractPlatform */ abstract class AbstractPlatformTestCase extends TestCase { /** @var T */ @@ -38,9 +36,7 @@ abstract class AbstractPlatformTestCase extends TestCase private ?Type $backedUpType = null; - /** - * @return T - */ + /** @return T */ abstract public function createPlatform(): AbstractPlatform; protected function setUp(): void @@ -72,17 +68,13 @@ public function testQuoteSingleIdentifier(): void self::assertEquals(str_repeat($c, 4), $this->platform->quoteSingleIdentifier($c)); } - /** - * @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 [ @@ -127,17 +119,13 @@ public function testRegistersCommentedDoctrineMappingTypeImplicitly(): void self::assertTrue($this->platform->isCommentedDoctrineType($type)); } - /** - * @dataProvider getIsCommentedDoctrineType - */ + /** @dataProvider getIsCommentedDoctrineType */ public function testIsCommentedDoctrineType(Type $type, bool $commented): void { self::assertSame($commented, $this->platform->isCommentedDoctrineType($type)); } - /** - * @return mixed[] - */ + /** @return mixed[] */ public function getIsCommentedDoctrineType(): iterable { $this->setUp(); @@ -188,9 +176,7 @@ public function testGenerateTableWithMultiColumnUniqueIndex(): void self::assertEquals($this->getGenerateTableWithMultiColumnUniqueIndexSql(), $sql); } - /** - * @return string[] - */ + /** @return string[] */ abstract public function getGenerateTableWithMultiColumnUniqueIndexSql(): array; public function testGeneratesIndexCreationSql(): void @@ -199,7 +185,7 @@ public function testGeneratesIndexCreationSql(): void self::assertEquals( $this->getGenerateIndexSql(), - $this->platform->getCreateIndexSQL($indexDef, 'mytable') + $this->platform->getCreateIndexSQL($indexDef, 'mytable'), ); } @@ -310,13 +296,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 @@ -340,18 +324,18 @@ public function testGeneratesTableAlterationSql(): void new Column( 'baz', Type::getType('string'), - ['default' => 'def'] + ['default' => 'def'], ), - ['type', 'notnull', 'default'] + ['type', 'notnull', 'default'], ); $tableDiff->changedColumns['bloo'] = new ColumnDiff( 'bloo', new Column( 'bloo', Type::getType('boolean'), - ['default' => false] + ['default' => false], ), - ['type', 'notnull', 'default'] + ['type', 'notnull', 'default'], ); $sql = $this->platform->getAlterTableSQL($tableDiff); @@ -363,7 +347,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']), ); } @@ -452,9 +436,9 @@ public function testGetAlterTableSqlDispatchEvent(): void new Column( 'changed2', Type::getType('string'), - [] + [], ), - [] + [], ); $tableDiff->renamedColumns['renamed'] = new Column('renamed2', Type::getType('integer'), []); @@ -478,18 +462,18 @@ public function testAlterTableColumnComments(): void 'foo', new Column( 'foo', - Type::getType('string') + Type::getType('string'), ), - ['comment'] + ['comment'], ); $tableDiff->changedColumns['bar'] = new ColumnDiff( 'bar', new Column( 'baz', Type::getType('string'), - ['comment' => 'B comment'] + ['comment' => 'B comment'], ), - ['comment'] + ['comment'], ); self::assertEquals($this->getAlterTableColumnCommentsSQL(), $this->platform->getAlterTableSQL($tableDiff)); @@ -505,25 +489,19 @@ public function testCreateTableColumnTypeComments(): void self::assertEquals($this->getCreateTableColumnTypeCommentsSQL(), $this->platform->getCreateTableSQL($table)); } - /** - * @return string[] - */ + /** @return string[] */ public function getCreateTableColumnCommentsSQL(): array { self::markTestSkipped('Platform does not support Column comments.'); } - /** - * @return string[] - */ + /** @return string[] */ public function getAlterTableColumnCommentsSQL(): array { self::markTestSkipped('Platform does not support Column comments.'); } - /** - * @return string[] - */ + /** @return string[] */ public function getCreateTableColumnTypeCommentsSQL(): array { self::markTestSkipped('Platform does not support Column comments.'); @@ -547,7 +525,7 @@ public function testGetDefaultValueDeclarationSQLDateTime(): void $this->platform->getDefaultValueDeclarationSQL([ 'type' => Type::getType($type), 'default' => $this->platform->getCurrentTimestampSQL(), - ]) + ]), ); } } @@ -560,7 +538,7 @@ public function testGetDefaultValueDeclarationSQLForIntegerTypes(): void $this->platform->getDefaultValueDeclarationSQL([ 'type' => Type::getType($type), 'default' => 1, - ]) + ]), ); } } @@ -574,7 +552,7 @@ public function testGetDefaultValueDeclarationSQLForDateType(): void $this->platform->getDefaultValueDeclarationSQL([ 'type' => Type::getType($type), 'default' => $currentDateSql, - ]) + ]), ); } } @@ -597,24 +575,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 @@ -661,7 +631,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). @@ -681,7 +651,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). @@ -701,12 +671,12 @@ public function testQuotedColumnInForeignKeyPropagation(): void ['create', 'foo', '`bar`'], ['create', 'bar', '`foo-bar`'], [], - 'FK_WITH_INTENDED_QUOTATION' + 'FK_WITH_INTENDED_QUOTATION', ); $sql = $this->platform->getCreateTableSQL( $table, - AbstractPlatform::CREATE_INDEXES | AbstractPlatform::CREATE_FOREIGNKEYS + AbstractPlatform::CREATE_INDEXES | AbstractPlatform::CREATE_FOREIGNKEYS, ); self::assertEquals($this->getQuotedColumnInForeignKeySQL(), $sql); } @@ -717,7 +687,7 @@ public function testQuotesReservedKeywordInUniqueConstraintDeclarationSQL(): voi self::assertSame( $this->getQuotesReservedKeywordInUniqueConstraintDeclarationSQL(), - $this->platform->getUniqueConstraintDeclarationSQL('select', $constraint) + $this->platform->getUniqueConstraintDeclarationSQL('select', $constraint), ); } @@ -727,7 +697,7 @@ public function testQuotesReservedKeywordInTruncateTableSQL(): void { self::assertSame( $this->getQuotesReservedKeywordInTruncateTableSQL(), - $this->platform->getTruncateTableSQL('select') + $this->platform->getTruncateTableSQL('select'), ); } @@ -743,7 +713,7 @@ public function testQuotesReservedKeywordInIndexDeclarationSQL(): void self::assertSame( $this->getQuotesReservedKeywordInIndexDeclarationSQL(), - $this->platform->getIndexDeclarationSQL('select', $index) + $this->platform->getIndexDeclarationSQL('select', $index), ); } @@ -782,14 +752,14 @@ public function testAlterTableChangeQuotedColumn(): void 'select', new Column( 'select', - Type::getType('string') + Type::getType('string'), ), - ['type'] + ['type'], ); self::assertStringContainsString( $this->platform->quoteIdentifier('select'), - implode(';', $this->platform->getAlterTableSQL($tableDiff)) + implode(';', $this->platform->getAlterTableSQL($tableDiff)), ); } @@ -798,9 +768,7 @@ public function testUsesSequenceEmulatedIdentityColumns(): void self::assertFalse($this->platform->usesSequenceEmulatedIdentityColumns()); } - /** - * @group DBAL-563 - */ + /** @group DBAL-563 */ public function testReturnsIdentitySequenceName(): void { $this->expectException(Exception::class); @@ -855,7 +823,7 @@ public function testReturnsJsonTypeDeclarationSQL(): void self::assertSame( $this->platform->getClobTypeDeclarationSQL($column), - $this->platform->getJsonTypeDeclarationSQL($column) + $this->platform->getJsonTypeDeclarationSQL($column), ); } @@ -871,13 +839,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 [ @@ -899,13 +865,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 [ @@ -966,7 +930,7 @@ public function testQuotesAlterTableRenameColumn(): void self::assertEquals( $this->getQuotedAlterTableRenameColumnSQL(), - $this->platform->getAlterTableSQL($diff) + $this->platform->getAlterTableSQL($diff), ); } @@ -1004,7 +968,7 @@ public function testQuotesAlterTableChangeColumnLength(): void self::assertEquals( $this->getQuotedAlterTableChangeColumnLengthSQL(), - $this->platform->getAlterTableSQL($diff) + $this->platform->getAlterTableSQL($diff), ); } @@ -1027,13 +991,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 [ @@ -1055,13 +1017,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 [ @@ -1125,7 +1085,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'), ); } @@ -1140,7 +1100,7 @@ public function testGetCommentOnColumnSQLWithQuoteCharacter(): void self::assertEquals( $this->getQuotedCommentOnColumnSQLWithQuoteCharacter(), - $this->platform->getCommentOnColumnSQL('mytable', 'id', 'It' . $c . 's a quote !') + $this->platform->getCommentOnColumnSQL('mytable', 'id', 'It' . $c . 's a quote !'), ); } @@ -1159,13 +1119,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()) { @@ -1175,9 +1133,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 [ @@ -1185,7 +1141,7 @@ public static function getGeneratesInlineColumnCommentSQL(): iterable 'comment requiring escaping' => [ sprintf( 'Using inline comment delimiter %s works', - static::getInlineColumnCommentDelimiter() + static::getInlineColumnCommentDelimiter(), ), static::getInlineColumnCommentRequiringEscapingSQL(), ], @@ -1236,7 +1192,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); @@ -1249,15 +1205,15 @@ public function testQuoteStringLiteral(): void self::assertEquals( $this->getQuotedStringLiteralWithoutQuoteCharacter(), - $this->platform->quoteStringLiteral('No quote') + $this->platform->quoteStringLiteral('No quote'), ); self::assertEquals( $this->getQuotedStringLiteralWithQuoteCharacter(), - $this->platform->quoteStringLiteral('It' . $c . 's a quote') + $this->platform->quoteStringLiteral('It' . $c . 's a quote'), ); self::assertEquals( $this->getQuotedStringLiteralQuoteCharacter(), - $this->platform->quoteStringLiteral($c) + $this->platform->quoteStringLiteral($c), ); } @@ -1274,7 +1230,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'); @@ -1282,15 +1238,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 @@ -1313,7 +1267,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')); @@ -1323,13 +1277,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 @@ -1345,9 +1297,9 @@ public function testAlterStringToFixedString(): void new Column( 'name', Type::getType('string'), - ['fixed' => true, 'length' => 2] + ['fixed' => true, 'length' => 2], ), - ['fixed'] + ['fixed'], ); $sql = $this->platform->getAlterTableSQL($tableDiff); @@ -1357,9 +1309,7 @@ public function testAlterStringToFixedString(): void self::assertEquals($expectedSql, $sql); } - /** - * @return string[] - */ + /** @return string[] */ abstract protected function getAlterStringToFixedStringSQL(): array; public function testGeneratesAlterTableRenameIndexUsedByForeignKeySQL(): void @@ -1383,13 +1333,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; /** @@ -1402,9 +1350,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 [ @@ -1427,9 +1373,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 [ @@ -1446,7 +1390,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/', '\\'), ); } @@ -1456,7 +1400,7 @@ public function testZeroOffsetWithoutLimitIsIgnored(): void self::assertSame( $query, - $this->platform->modifyLimitQuery($query, null, 0) + $this->platform->modifyLimitQuery($query, null, 0), ); } @@ -1464,7 +1408,7 @@ public function testLimitOffsetCastToInt(): void { self::assertSame( $this->getLimitOffsetCastToIntExpectedQuery(), - $this->platform->modifyLimitQuery('SELECT * FROM user', '1 BANANA', '2 APPLES') + $this->platform->modifyLimitQuery('SELECT * FROM user', '1 BANANA', '2 APPLES'), ); } @@ -1484,9 +1428,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 93b26b838d8..436d87b0402 100644 --- a/tests/Platforms/DB2PlatformTest.php +++ b/tests/Platforms/DB2PlatformTest.php @@ -12,9 +12,7 @@ use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Types; -/** - * @extends AbstractPlatformTestCase - */ +/** @extends AbstractPlatformTestCase */ class DB2PlatformTest extends AbstractPlatformTestCase { public function createPlatform(): AbstractPlatform @@ -189,7 +187,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), ); } @@ -206,7 +204,7 @@ public function testGeneratesCreateTableSQLWithForeignKeyConstraints(): void ['fk_1', 'fk_2'], ['pk_1', 'pk_2'], [], - 'named_fk' + 'named_fk', ); self::assertEquals( @@ -221,8 +219,8 @@ public function testGeneratesCreateTableSQLWithForeignKeyConstraints(): void ], $this->platform->getCreateTableSQL( $table, - AbstractPlatform::CREATE_INDEXES | AbstractPlatform::CREATE_FOREIGNKEYS - ) + AbstractPlatform::CREATE_INDEXES | AbstractPlatform::CREATE_FOREIGNKEYS, + ), ); } @@ -239,7 +237,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), ); } @@ -262,7 +260,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([])); @@ -270,7 +268,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([])); @@ -278,7 +276,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)); @@ -288,7 +286,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)); @@ -317,7 +315,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')); @@ -329,8 +327,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', + ), ); } @@ -350,7 +348,7 @@ public function testGeneratesSQLSnippets(): void 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)); @@ -365,17 +363,17 @@ 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)', - $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)); @@ -386,27 +384,27 @@ public function testModifiesLimitQuery(): void { self::assertEquals( 'SELECT * FROM user', - $this->platform->modifyLimitQuery('SELECT * FROM user', null, 0) + $this->platform->modifyLimitQuery('SELECT * FROM user', null, 0), ); self::assertEquals( 'SELECT db22.* FROM (' . 'SELECT db21.*, ROW_NUMBER() OVER() AS DC_ROWNUM FROM (SELECT * FROM user) db21' . ') db22 WHERE db22.DC_ROWNUM <= 10', - $this->platform->modifyLimitQuery('SELECT * FROM user', 10) + $this->platform->modifyLimitQuery('SELECT * FROM user', 10), ); self::assertEquals( 'SELECT db22.* FROM (SELECT db21.*, ROW_NUMBER() OVER() AS DC_ROWNUM FROM (' . 'SELECT * FROM user) db21' . ') db22 WHERE db22.DC_ROWNUM >= 6 AND db22.DC_ROWNUM <= 15', - $this->platform->modifyLimitQuery('SELECT * FROM user', 10, 5) + $this->platform->modifyLimitQuery('SELECT * FROM user', 10, 5), ); self::assertEquals( 'SELECT db22.* FROM (' . 'SELECT db21.*, ROW_NUMBER() OVER() AS DC_ROWNUM FROM (SELECT * FROM user) db21' . ') db22 WHERE db22.DC_ROWNUM >= 6 AND db22.DC_ROWNUM <= 5', - $this->platform->modifyLimitQuery('SELECT * FROM user', 0, 5) + $this->platform->modifyLimitQuery('SELECT * FROM user', 0, 5), ); } @@ -451,7 +449,7 @@ public function testReturnsBinaryTypeDeclarationSQL(): void self::assertSame('VARCHAR(255) FOR BIT DATA', $this->platform->getBinaryTypeDeclarationSQL(['length' => 0])); self::assertSame( 'VARCHAR(32704) FOR BIT DATA', - $this->platform->getBinaryTypeDeclarationSQL(['length' => 32704]) + $this->platform->getBinaryTypeDeclarationSQL(['length' => 32704]), ); self::assertSame('CHAR(1) FOR BIT DATA', $this->platform->getBinaryTypeDeclarationSQL(['fixed' => true])); @@ -579,9 +577,7 @@ protected function getCommentOnColumnSQL(): array ]; } - /** - * @dataProvider getGeneratesAlterColumnSQL - */ + /** @dataProvider getGeneratesAlterColumnSQL */ public function testGeneratesAlterColumnSQL( string $changedProperty, Column $column, @@ -602,9 +598,7 @@ public function testGeneratesAlterColumnSQL( self::assertSame($expectedSQL, $this->platform->getAlterTableSQL($tableDiff)); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function getGeneratesAlterColumnSQL(): iterable { return [ @@ -714,7 +708,7 @@ public function testQuotesTableNameInListTableColumnsSQL(): void { self::assertStringContainsStringIgnoringCase( "'Foo''Bar\\'", - $this->platform->getListTableColumnsSQL("Foo'Bar\\") + $this->platform->getListTableColumnsSQL("Foo'Bar\\"), ); } @@ -722,7 +716,7 @@ public function testQuotesTableNameInListTableIndexesSQL(): void { self::assertStringContainsStringIgnoringCase( "'Foo''Bar\\'", - $this->platform->getListTableIndexesSQL("Foo'Bar\\") + $this->platform->getListTableIndexesSQL("Foo'Bar\\"), ); } @@ -730,7 +724,7 @@ public function testQuotesTableNameInListTableForeignKeysSQL(): void { self::assertStringContainsStringIgnoringCase( "'Foo''Bar\\'", - $this->platform->getListTableForeignKeysSQL("Foo'Bar\\") + $this->platform->getListTableForeignKeysSQL("Foo'Bar\\"), ); } 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 e677dd68e5c..1aac8883ec2 100644 --- a/tests/Platforms/MySQL/ComparatorTest.php +++ b/tests/Platforms/MySQL/ComparatorTest.php @@ -18,7 +18,7 @@ public function getCollationCharset(string $collation): ?string { return null; } - } + }, ); } } diff --git a/tests/Platforms/MySQL57PlatformTest.php b/tests/Platforms/MySQL57PlatformTest.php index a32adb82722..1ce9871c136 100644 --- a/tests/Platforms/MySQL57PlatformTest.php +++ b/tests/Platforms/MySQL57PlatformTest.php @@ -29,17 +29,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 [ @@ -48,17 +44,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 [ diff --git a/tests/Platforms/MySQLPlatformTest.php b/tests/Platforms/MySQLPlatformTest.php index 14217efbda2..2e799717e25 100644 --- a/tests/Platforms/MySQLPlatformTest.php +++ b/tests/Platforms/MySQLPlatformTest.php @@ -22,7 +22,7 @@ public function testHasCorrectDefaultTransactionIsolationLevel(): void { self::assertEquals( TransactionIsolationLevel::REPEATABLE_READ, - $this->platform->getDefaultTransactionIsolationLevel() + $this->platform->getDefaultTransactionIsolationLevel(), ); } @@ -39,7 +39,7 @@ public function testCollationOptionIsTakenIntoAccount(): void $table->addOption('collation', 'my_collation'); self::assertStringContainsString( 'my_collation', - $this->platform->getCreateTableSQL($table)[0] + $this->platform->getCreateTableSQL($table)[0], ); } @@ -51,7 +51,7 @@ public function testCollateOptionIsStillSupportedButDeprecated(): void $this->expectDeprecationWithIdentifier('https://github.com/doctrine/dbal/issues/5214'); 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 477539976cb..5d4759410c6 100644 --- a/tests/Platforms/OraclePlatformTest.php +++ b/tests/Platforms/OraclePlatformTest.php @@ -19,14 +19,10 @@ use function strtoupper; use function uniqid; -/** - * @extends AbstractPlatformTestCase - */ +/** @extends AbstractPlatformTestCase */ class OraclePlatformTest extends AbstractPlatformTestCase { - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function dataValidIdentifiers(): iterable { return [ @@ -42,9 +38,7 @@ public static function dataValidIdentifiers(): iterable ]; } - /** - * @dataProvider dataValidIdentifiers - */ + /** @dataProvider dataValidIdentifiers */ public function testValidIdentifiers(string $identifier): void { $platform = $this->createPlatform(); @@ -53,9 +47,7 @@ public function testValidIdentifiers(string $identifier): void $this->expectNotToPerformAssertions(); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function dataInvalidIdentifiers(): iterable { return [ @@ -67,9 +59,7 @@ public static function dataInvalidIdentifiers(): iterable ]; } - /** - * @dataProvider dataInvalidIdentifiers - */ + /** @dataProvider dataInvalidIdentifiers */ public function testInvalidIdentifiers(string $identifier): void { $this->expectException(Exception::class); @@ -125,7 +115,7 @@ public function testGeneratesSqlSnippets(): void self::assertEquals('"', $this->platform->getIdentifierQuoteCharacter()); self::assertEquals( 'column1 || column2 || column3', - $this->platform->getConcatExpression('column1', 'column2', 'column3') + $this->platform->getConcatExpression('column1', 'column2', 'column3'), ); } @@ -133,19 +123,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), ); } @@ -168,17 +158,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], + ), ); } @@ -187,16 +177,16 @@ public function testGeneratesTypeDeclarationsForStrings(): void self::assertEquals( 'CHAR(10)', $this->platform->getStringTypeDeclarationSQL( - ['length' => 10, 'fixed' => true] - ) + ['length' => 10, 'fixed' => true], + ), ); self::assertEquals( 'VARCHAR2(50)', - $this->platform->getStringTypeDeclarationSQL(['length' => 50]) + $this->platform->getStringTypeDeclarationSQL(['length' => 50]), ); self::assertEquals( 'VARCHAR2(255)', - $this->platform->getStringTypeDeclarationSQL([]) + $this->platform->getStringTypeDeclarationSQL([]), ); } @@ -247,9 +237,7 @@ public function testGeneratesAdvancedForeignKeyOptionsSQL(array $options, string self::assertSame($expectedSql, $this->platform->getAdvancedForeignKeyOptionsSQL($foreignKey)); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function getGeneratesAdvancedForeignKeyOptionsSQLData(): iterable { return [ @@ -296,7 +284,7 @@ public function testModifyLimitQueryWithNonEmptyOffset(): void 'SELECT * FROM (' . 'SELECT a.*, ROWNUM AS doctrine_rownum FROM (SELECT * FROM user) a WHERE ROWNUM <= 20' . ') WHERE doctrine_rownum >= 11', - $sql + $sql, ); } @@ -308,7 +296,7 @@ public function testModifyLimitQueryWithEmptyLimit(): void 'SELECT * FROM (' . 'SELECT a.*, ROWNUM AS doctrine_rownum FROM (SELECT * FROM user) a' . ') WHERE doctrine_rownum >= 11', - $sql + $sql, ); } @@ -352,11 +340,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)); } @@ -497,27 +485,27 @@ public function testAlterTableNotNULL(): void new Column( 'foo', Type::getType('string'), - ['default' => 'bla', 'notnull' => true] + ['default' => 'bla', 'notnull' => true], ), - ['type'] + ['type'], ); $tableDiff->changedColumns['bar'] = new ColumnDiff( 'bar', new Column( 'baz', Type::getType('string'), - ['default' => 'bla', 'notnull' => true] + ['default' => 'bla', 'notnull' => true], ), - ['type', 'notnull'] + ['type', 'notnull'], ); $tableDiff->changedColumns['metar'] = new ColumnDiff( 'metar', new Column( 'metar', Type::getType('string'), - ['length' => 2000, 'notnull' => false] + ['length' => 2000, 'notnull' => false], ), - ['notnull'] + ['notnull'], ); $expectedSql = [ @@ -556,7 +544,7 @@ public function testReturnsBinaryTypeDeclarationSQL(): void self::assertSame( 'RAW(2000)', - $this->platform->getBinaryTypeDeclarationSQL(['fixed' => true, 'length' => 2000]) + $this->platform->getBinaryTypeDeclarationSQL(['fixed' => true, 'length' => 2000]), ); } @@ -592,18 +580,14 @@ public function testReturnsIdentitySequenceName(): void self::assertSame('"mytable_SEQ"', $this->platform->getIdentitySequenceName('"mytable"', '"mycolumn"')); } - /** - * @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 [ @@ -705,9 +689,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 [ @@ -780,7 +762,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), ); } @@ -797,7 +779,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->getListTableColumnsSQL('"test"', $database)); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function getReturnsGetListTableColumnsSQL(): iterable { return [ @@ -927,7 +905,7 @@ public function testQuotesDatabaseNameInListSequencesSQL(): void { self::assertStringContainsStringIgnoringCase( "'Foo''Bar\\'", - $this->platform->getListSequencesSQL("Foo'Bar\\") + $this->platform->getListSequencesSQL("Foo'Bar\\"), ); } @@ -935,7 +913,7 @@ public function testQuotesTableNameInListTableIndexesSQL(): void { self::assertStringContainsStringIgnoringCase( "'Foo''Bar\\'", - $this->platform->getListTableIndexesSQL("Foo'Bar\\") + $this->platform->getListTableIndexesSQL("Foo'Bar\\"), ); } @@ -943,7 +921,7 @@ public function testQuotesTableNameInListTableForeignKeysSQL(): void { self::assertStringContainsStringIgnoringCase( "'Foo''Bar\\'", - $this->platform->getListTableForeignKeysSQL("Foo'Bar\\") + $this->platform->getListTableForeignKeysSQL("Foo'Bar\\"), ); } @@ -951,7 +929,7 @@ public function testQuotesTableNameInListTableConstraintsSQL(): void { self::assertStringContainsStringIgnoringCase( "'Foo''Bar\\'", - $this->platform->getListTableConstraintsSQL("Foo'Bar\\") + $this->platform->getListTableConstraintsSQL("Foo'Bar\\"), ); } @@ -959,7 +937,7 @@ public function testQuotesTableNameInListTableColumnsSQL(): void { self::assertStringContainsStringIgnoringCase( "'Foo''Bar\\'", - $this->platform->getListTableColumnsSQL("Foo'Bar\\") + $this->platform->getListTableColumnsSQL("Foo'Bar\\"), ); } @@ -967,13 +945,11 @@ public function testQuotesDatabaseNameInListTableColumnsSQL(): void { self::assertStringContainsStringIgnoringCase( "'Foo''Bar\\'", - $this->platform->getListTableColumnsSQL('foo_table', "Foo'Bar\\") + $this->platform->getListTableColumnsSQL('foo_table', "Foo'Bar\\"), ); } - /** - * @return array}> - */ + /** @return array}> */ public function asciiStringSqlDeclarationDataProvider(): array { return [ diff --git a/tests/Platforms/PostgreSQLPlatformTest.php b/tests/Platforms/PostgreSQLPlatformTest.php index 936fd57bec1..d0e76969d86 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 @@ -80,12 +78,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( @@ -93,12 +91,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( @@ -106,12 +104,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( @@ -119,12 +117,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( @@ -132,12 +130,12 @@ public function testGeneratesForeignKeySqlForNonStandardOptions(): void 'my_table', ['id'], 'my_fk', - ['feferred' => true] + ['feferred' => 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( @@ -145,12 +143,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,7 +159,7 @@ 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)); @@ -172,19 +170,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), ); } @@ -203,13 +201,11 @@ public function testGenerateTableWithAutoincrement(): void self::assertEquals( ['CREATE TABLE autoinc_table (id SERIAL NOT NULL)'], - $this->platform->getCreateTableSQL($table) + $this->platform->getCreateTableSQL($table), ); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function serialTypes(): iterable { return [ @@ -218,9 +214,7 @@ public static function serialTypes(): iterable ]; } - /** - * @dataProvider serialTypes - */ + /** @dataProvider serialTypes */ public function testGenerateTableWithAutoincrementDoesNotSetDefault(string $type, string $definition): void { $table = new Table('autoinc_table_notnull'); @@ -233,9 +227,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'); @@ -248,9 +240,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( @@ -258,7 +248,7 @@ public function testGetDefaultValueDeclarationSQLIgnoresTheDefaultKeyWhenTheFiel 'autoincrement' => true, 'type' => Type::getType($type), 'default' => 1, - ] + ], ); self::assertSame('', $sql); @@ -268,17 +258,17 @@ public function testGeneratesTypeDeclarationForIntegers(): void { self::assertEquals( 'INT', - $this->platform->getIntegerTypeDeclarationSQL([]) + $this->platform->getIntegerTypeDeclarationSQL([]), ); self::assertEquals( 'SERIAL', - $this->platform->getIntegerTypeDeclarationSQL(['autoincrement' => true]) + $this->platform->getIntegerTypeDeclarationSQL(['autoincrement' => true]), ); self::assertEquals( 'SERIAL', $this->platform->getIntegerTypeDeclarationSQL( - ['autoincrement' => true, 'primary' => true] - ) + ['autoincrement' => true, 'primary' => true], + ), ); } @@ -287,16 +277,16 @@ public function testGeneratesTypeDeclarationForStrings(): void self::assertEquals( 'CHAR(10)', $this->platform->getStringTypeDeclarationSQL( - ['length' => 10, 'fixed' => true] - ) + ['length' => 10, 'fixed' => true], + ), ); self::assertEquals( 'VARCHAR(50)', - $this->platform->getStringTypeDeclarationSQL(['length' => 50]) + $this->platform->getStringTypeDeclarationSQL(['length' => 50]), ); self::assertEquals( 'VARCHAR(255)', - $this->platform->getStringTypeDeclarationSQL([]) + $this->platform->getStringTypeDeclarationSQL([]), ); } @@ -310,15 +300,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'), ); } @@ -542,36 +532,36 @@ public function testAlterDecimalPrecisionScale(): void new Column( 'dloo1', Type::getType('decimal'), - ['precision' => 16, 'scale' => 6] + ['precision' => 16, 'scale' => 6], ), - ['precision'] + ['precision'], ); $tableDiff->changedColumns['dloo2'] = new ColumnDiff( 'dloo2', new Column( 'dloo2', Type::getType('decimal'), - ['precision' => 10, 'scale' => 4] + ['precision' => 10, 'scale' => 4], ), - ['scale'] + ['scale'], ); $tableDiff->changedColumns['dloo3'] = new ColumnDiff( 'dloo3', new Column( 'dloo3', Type::getType('decimal'), - ['precision' => 10, 'scale' => 6] + ['precision' => 10, 'scale' => 6], ), - [] + [], ); $tableDiff->changedColumns['dloo4'] = new ColumnDiff( 'dloo4', new Column( 'dloo4', Type::getType('decimal'), - ['precision' => 16, 'scale' => 8] + ['precision' => 16, 'scale' => 8], ), - ['precision', 'scale'] + ['precision', 'scale'], ); $sql = $this->platform->getAlterTableSQL($tableDiff); @@ -619,18 +609,14 @@ public function testReturnsIdentitySequenceName(): void self::assertSame('mytable_mycolumn_seq', $this->platform->getIdentitySequenceName('mytable', 'mycolumn')); } - /** - * @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 [ @@ -814,7 +800,7 @@ public function testGetNullCommentOnColumnSQL(): void { self::assertEquals( 'COMMENT ON COLUMN mytable.id IS NULL', - $this->platform->getCommentOnColumnSQL('mytable', 'id', null) + $this->platform->getCommentOnColumnSQL('mytable', 'id', null), ); } @@ -875,7 +861,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), ); } @@ -894,7 +880,7 @@ public function testAltersTableColumnCommentIfRequiredByType(): void 'ALTER TABLE "foo" ALTER "bar" TYPE TIMESTAMP(0) WITHOUT TIME ZONE', 'COMMENT ON COLUMN "foo"."bar" IS \'(DC2Type:datetime_immutable)\'', ], - $this->platform->getAlterTableSQL($tableDiff) + $this->platform->getAlterTableSQL($tableDiff), ); } @@ -939,7 +925,7 @@ public function testQuotesTableNameInListTableForeignKeysSQL(): void { self::assertStringContainsStringIgnoringCase( "'Foo''Bar\\'", - $this->platform->getListTableForeignKeysSQL("Foo'Bar\\") + $this->platform->getListTableForeignKeysSQL("Foo'Bar\\"), ); } @@ -947,7 +933,7 @@ public function testQuotesSchemaNameInListTableForeignKeysSQL(): void { self::assertStringContainsStringIgnoringCase( "'Foo''Bar\\'", - $this->platform->getListTableForeignKeysSQL("Foo'Bar\\.baz_table") + $this->platform->getListTableForeignKeysSQL("Foo'Bar\\.baz_table"), ); } @@ -955,7 +941,7 @@ public function testQuotesTableNameInListTableConstraintsSQL(): void { self::assertStringContainsStringIgnoringCase( "'Foo''Bar\\'", - $this->platform->getListTableConstraintsSQL("Foo'Bar\\") + $this->platform->getListTableConstraintsSQL("Foo'Bar\\"), ); } @@ -963,7 +949,7 @@ public function testQuotesTableNameInListTableIndexesSQL(): void { self::assertStringContainsStringIgnoringCase( "'Foo''Bar\\'", - $this->platform->getListTableIndexesSQL("Foo'Bar\\") + $this->platform->getListTableIndexesSQL("Foo'Bar\\"), ); } @@ -971,7 +957,7 @@ public function testQuotesSchemaNameInListTableIndexesSQL(): void { self::assertStringContainsStringIgnoringCase( "'Foo''Bar\\'", - $this->platform->getListTableIndexesSQL("Foo'Bar\\.baz_table") + $this->platform->getListTableIndexesSQL("Foo'Bar\\.baz_table"), ); } @@ -979,7 +965,7 @@ public function testQuotesTableNameInListTableColumnsSQL(): void { self::assertStringContainsStringIgnoringCase( "'Foo''Bar\\'", - $this->platform->getListTableColumnsSQL("Foo'Bar\\") + $this->platform->getListTableColumnsSQL("Foo'Bar\\"), ); } @@ -987,7 +973,7 @@ public function testQuotesSchemaNameInListTableColumnsSQL(): void { self::assertStringContainsStringIgnoringCase( "'Foo''Bar\\'", - $this->platform->getListTableColumnsSQL("Foo'Bar\\.baz_table") + $this->platform->getListTableColumnsSQL("Foo'Bar\\.baz_table"), ); } @@ -1007,7 +993,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.', ); } @@ -1022,7 +1008,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.', ); } @@ -1030,7 +1016,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'), ); } @@ -1050,17 +1036,17 @@ public function testReturnsSmallIntTypeDeclarationSQL(): void { self::assertSame( 'SMALLSERIAL', - $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([]), ); } diff --git a/tests/Platforms/ReservedKeywordsValidatorTest.php b/tests/Platforms/ReservedKeywordsValidatorTest.php index 96319309d4c..991a7f07ff6 100644 --- a/tests/Platforms/ReservedKeywordsValidatorTest.php +++ b/tests/Platforms/ReservedKeywordsValidatorTest.php @@ -23,7 +23,7 @@ public function testReservedTableName(): void self::assertEquals( ['Table TABLE keyword violations: MySQL'], - $this->validator->getViolations() + $this->validator->getViolations(), ); } @@ -36,7 +36,7 @@ public function testReservedColumnName(): void self::assertEquals( ['Table TABLE column table keyword violations: MySQL'], - $this->validator->getViolations() + $this->validator->getViolations(), ); } } diff --git a/tests/Platforms/SQLServerPlatformTestCase.php b/tests/Platforms/SQLServerPlatformTestCase.php index 2116321ebd2..fcc73dffdd7 100644 --- a/tests/Platforms/SQLServerPlatformTestCase.php +++ b/tests/Platforms/SQLServerPlatformTestCase.php @@ -17,9 +17,7 @@ use Doctrine\DBAL\Types\Type; use InvalidArgumentException; -/** - * @extends AbstractPlatformTestCase - */ +/** @extends AbstractPlatformTestCase */ class SQLServerPlatformTestCase extends AbstractPlatformTestCase { public function createPlatform(): AbstractPlatform @@ -83,7 +81,7 @@ public function testGeneratesSqlSnippets(): void self::assertEquals( '(column1 + column2 + column3)', - $this->platform->getConcatExpression('column1', 'column2', 'column3') + $this->platform->getConcatExpression('column1', 'column2', 'column3'), ); } @@ -91,19 +89,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), ); } @@ -121,17 +119,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], + ), ); } @@ -140,21 +138,21 @@ public function testGeneratesTypeDeclarationsForStrings(): void self::assertEquals( 'NCHAR(10)', $this->platform->getStringTypeDeclarationSQL( - ['length' => 10, 'fixed' => true] - ) + ['length' => 10, 'fixed' => true], + ), ); self::assertEquals( 'NVARCHAR(50)', - $this->platform->getStringTypeDeclarationSQL(['length' => 50]) + $this->platform->getStringTypeDeclarationSQL(['length' => 50]), ); self::assertEquals( 'NVARCHAR(255)', - $this->platform->getStringTypeDeclarationSQL([]) + $this->platform->getStringTypeDeclarationSQL([]), ); 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]), ); } @@ -238,12 +236,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, ); } @@ -251,14 +249,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, ); } @@ -268,26 +266,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, ); } @@ -296,40 +294,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, ); } @@ -339,7 +337,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, ); } @@ -388,7 +386,7 @@ public function testModifyLimitQueryWithExtraLongQuery(): void self::assertEquals( $expected, - $this->platform->modifyLimitQuery($query, 10) + $this->platform->modifyLimitQuery($query, 10), ); } @@ -424,7 +422,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( @@ -437,7 +435,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, ); } @@ -454,7 +452,7 @@ public function testModifyLimitQueryWithSubSelectInSelectListAndOrderByClause(): "WHERE u.status = 'disabled' " . 'ORDER BY u.username DESC', 10, - 5 + 5, ); self::assertEquals( @@ -468,7 +466,7 @@ public function testModifyLimitQueryWithSubSelectInSelectListAndOrderByClause(): "WHERE u.status = 'disabled' " . 'ORDER BY u.username DESC ' . 'OFFSET 5 ROWS FETCH NEXT 10 ROWS ONLY', - $sql + $sql, ); } @@ -482,7 +480,7 @@ public function testModifyLimitQueryWithAggregateFunctionInOrderByClause(): void 'GROUP BY code ' . 'ORDER BY MAX(heading_id) DESC', 1, - 0 + 0, ); self::assertEquals( @@ -493,7 +491,7 @@ public function testModifyLimitQueryWithAggregateFunctionInOrderByClause(): void 'GROUP BY code ' . 'ORDER BY MAX(heading_id) DESC ' . 'OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY', - $sql + $sql, ); } @@ -569,7 +567,7 @@ public function testModifyLimitSubquerySimple(): void self::assertEquals( $expected, - $this->platform->modifyLimitQuery($query, 20) + $this->platform->modifyLimitQuery($query, 20), ); } @@ -603,7 +601,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), ); } @@ -613,7 +611,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'), ); } @@ -713,7 +711,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 = [ @@ -731,7 +729,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', " @@ -791,7 +789,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', 'object'); @@ -836,7 +834,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), ); } @@ -854,7 +852,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', 'object'); @@ -912,7 +910,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]), ); // Remove comment from null-commented column. @@ -920,7 +918,7 @@ public function testGeneratesAlterTableSQLWithColumnComments(): void 'comment_null', new Column('comment_null', Type::getType('string')), ['type'], - new Column('comment_null', Type::getType('integer'), ['comment' => null]) + new Column('comment_null', Type::getType('integer'), ['comment' => null]), ); // Add comment to false-commented column. @@ -928,7 +926,7 @@ public function testGeneratesAlterTableSQLWithColumnComments(): void 'comment_false', new Column('comment_false', Type::getType('integer'), ['comment' => 'false']), ['comment'], - new Column('comment_false', Type::getType('integer'), ['comment' => false]) + new Column('comment_false', Type::getType('integer'), ['comment' => false]), ); // Change type to custom type from empty string commented column. @@ -936,7 +934,7 @@ public function testGeneratesAlterTableSQLWithColumnComments(): void 'comment_empty_string', new Column('comment_empty_string', Type::getType('object')), ['type'], - new Column('comment_empty_string', Type::getType('integer'), ['comment' => '']) + new Column('comment_empty_string', Type::getType('integer'), ['comment' => '']), ); // Change comment to false-comment from zero-string commented column. @@ -944,7 +942,7 @@ public function testGeneratesAlterTableSQLWithColumnComments(): void 'comment_string_0', new Column('comment_string_0', Type::getType('integer'), ['comment' => false]), ['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. @@ -952,7 +950,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. @@ -960,7 +958,7 @@ public function testGeneratesAlterTableSQLWithColumnComments(): void '`comment_quoted`', new Column('`comment_quoted`', Type::getType('array'), ['comment' => 'Doctrine array.']), ['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. @@ -971,8 +969,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. @@ -980,7 +978,7 @@ public function testGeneratesAlterTableSQLWithColumnComments(): void 'commented_type', new Column('commented_type', Type::getType('integer'), ['comment' => 'foo']), ['comment', 'type'], - new Column('commented_type', Type::getType('object')) + new Column('commented_type', Type::getType('object')), ); // Remove comment from commented custom type column. @@ -988,7 +986,7 @@ public function testGeneratesAlterTableSQLWithColumnComments(): void 'commented_type_with_comment', new Column('commented_type_with_comment', Type::getType('array')), ['comment'], - new Column('commented_type_with_comment', Type::getType('array'), ['comment' => 'Doctrine array type.']) + new Column('commented_type_with_comment', Type::getType('array'), ['comment' => 'Doctrine array type.']), ); // Change comment from comment with string literal char column. @@ -996,7 +994,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('array'), ['comment' => "O'Reilly"]) + new Column('comment_with_string_literal_char', Type::getType('array'), ['comment' => "O'Reilly"]), ); $tableDiff->removedColumns['comment_integer_0'] @@ -1070,7 +1068,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), ); } @@ -1213,14 +1211,14 @@ 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( 'col_string', new Column('col_string', Type::getType('string'), ['default' => 666, 'fixed' => true]), ['fixed'], - new Column('col_string', Type::getType('string'), ['default' => 666]) + new Column('col_string', Type::getType('string'), ['default' => 666]), ); $expected = $this->platform->getAlterTableSQL($tableDiff); @@ -1234,7 +1232,7 @@ public function testChangeColumnsTypeWithDefaultValue(): void 'ALTER TABLE column_def_change_type DROP CONSTRAINT DF_829302E0_2725A6D0', '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 '666' FOR col_string", - ] + ], ); } @@ -1306,9 +1304,7 @@ public function testGeneratesIdentifierNamesInDefaultConstraintDeclarationSQL( self::assertSame($expectedSql, $this->platform->getDefaultConstraintDeclarationSQL($table, $column)); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function getGeneratesIdentifierNamesInDefaultConstraintDeclarationSQL(): iterable { return [ @@ -1361,9 +1357,7 @@ public function testGeneratesIdentifierNamesInCreateTableSQL(Table $table, array self::assertSame($expectedSql, $this->platform->getCreateTableSQL($table)); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function getGeneratesIdentifierNamesInCreateTableSQL(): iterable { return [ @@ -1412,9 +1406,7 @@ public function testGeneratesIdentifierNamesInAlterTableSQL(TableDiff $tableDiff self::assertSame($expectedSql, $this->platform->getAlterTableSQL($tableDiff)); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function getGeneratesIdentifierNamesInAlterTableSQL(): iterable { return [ @@ -1428,10 +1420,10 @@ public static function getGeneratesIdentifierNamesInAlterTableSQL(): iterable 'mycolumn', new Column('mycolumn', Type::getType('string'), ['default' => 'bar']), ['default'], - new Column('mycolumn', Type::getType('string'), ['default' => 'foo']) + new Column('mycolumn', Type::getType('string'), ['default' => 'foo']), ), ], - [new Column('removecolumn', Type::getType('string'), ['default' => 'foo'])] + [new Column('removecolumn', Type::getType('string'), ['default' => 'foo'])], ), [ 'ALTER TABLE mytable ADD addcolumn NVARCHAR(255) NOT NULL ' . @@ -1452,10 +1444,10 @@ public static function getGeneratesIdentifierNamesInAlterTableSQL(): iterable '`mycolumn`', new Column('`mycolumn`', Type::getType('string'), ['default' => 'bar']), ['default'], - new Column('`mycolumn`', Type::getType('string'), ['default' => 'foo']) + new Column('`mycolumn`', Type::getType('string'), ['default' => 'foo']), ), ], - [new Column('`removecolumn`', Type::getType('string'), ['default' => 'foo'])] + [new Column('`removecolumn`', Type::getType('string'), ['default' => 'foo'])], ), [ 'ALTER TABLE [mytable] ADD [addcolumn] NVARCHAR(255) NOT NULL ' . @@ -1476,10 +1468,10 @@ public static function getGeneratesIdentifierNamesInAlterTableSQL(): iterable 'select', new Column('select', Type::getType('string'), ['default' => 'bar']), ['default'], - new Column('select', Type::getType('string'), ['default' => 'foo']) + new Column('select', Type::getType('string'), ['default' => 'foo']), ), ], - [new Column('drop', Type::getType('string'), ['default' => 'foo'])] + [new Column('drop', Type::getType('string'), ['default' => 'foo'])], ), [ 'ALTER TABLE [table] ADD [add] NVARCHAR(255) NOT NULL ' . @@ -1500,10 +1492,10 @@ public static function getGeneratesIdentifierNamesInAlterTableSQL(): iterable '`select`', new Column('`select`', Type::getType('string'), ['default' => 'bar']), ['default'], - new Column('`select`', Type::getType('string'), ['default' => 'foo']) + new Column('`select`', Type::getType('string'), ['default' => 'foo']), ), ], - [new Column('`drop`', Type::getType('string'), ['default' => 'foo'])] + [new Column('`drop`', Type::getType('string'), ['default' => 'foo'])], ), [ 'ALTER TABLE [table] ADD [add] NVARCHAR(255) NOT NULL ' . @@ -1625,7 +1617,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 = (' @@ -1638,7 +1630,7 @@ public function testModifyLimitQueryWithTopNSubQueryWithOrderBy(): void self::assertEquals( $expected, - $this->platform->modifyLimitQuery($query, 10) + $this->platform->modifyLimitQuery($query, 10), ); } @@ -1654,7 +1646,7 @@ public function testModifyLimitQueryWithFromSubquery(): void self::assertEquals( $expected, - $this->platform->modifyLimitQuery($query, 10) + $this->platform->modifyLimitQuery($query, 10), ); } @@ -1670,7 +1662,7 @@ public function testModifyLimitQueryWithFromSubqueryAndOrder(): void self::assertEquals( $expected, - $this->platform->modifyLimitQuery($query, 10) + $this->platform->modifyLimitQuery($query, 10), ); } @@ -1695,7 +1687,7 @@ public function testQuotesTableNameInListTableColumnsSQL(): void { self::assertStringContainsStringIgnoringCase( "'Foo''Bar\\'", - $this->platform->getListTableColumnsSQL("Foo'Bar\\") + $this->platform->getListTableColumnsSQL("Foo'Bar\\"), ); } @@ -1703,7 +1695,7 @@ public function testQuotesSchemaNameInListTableColumnsSQL(): void { self::assertStringContainsStringIgnoringCase( "'Foo''Bar\\'", - $this->platform->getListTableColumnsSQL("Foo'Bar\\.baz_table") + $this->platform->getListTableColumnsSQL("Foo'Bar\\.baz_table"), ); } @@ -1711,7 +1703,7 @@ public function testQuotesTableNameInListTableForeignKeysSQL(): void { self::assertStringContainsStringIgnoringCase( "'Foo''Bar\\'", - $this->platform->getListTableForeignKeysSQL("Foo'Bar\\") + $this->platform->getListTableForeignKeysSQL("Foo'Bar\\"), ); } @@ -1719,7 +1711,7 @@ public function testQuotesSchemaNameInListTableForeignKeysSQL(): void { self::assertStringContainsStringIgnoringCase( "'Foo''Bar\\'", - $this->platform->getListTableForeignKeysSQL("Foo'Bar\\.baz_table") + $this->platform->getListTableForeignKeysSQL("Foo'Bar\\.baz_table"), ); } @@ -1727,7 +1719,7 @@ public function testQuotesTableNameInListTableIndexesSQL(): void { self::assertStringContainsStringIgnoringCase( "'Foo''Bar\\'", - $this->platform->getListTableIndexesSQL("Foo'Bar\\") + $this->platform->getListTableIndexesSQL("Foo'Bar\\"), ); } @@ -1735,7 +1727,7 @@ public function testQuotesSchemaNameInListTableIndexesSQL(): void { self::assertStringContainsStringIgnoringCase( "'Foo''Bar\\'", - $this->platform->getListTableIndexesSQL("Foo'Bar\\.baz_table") + $this->platform->getListTableIndexesSQL("Foo'Bar\\.baz_table"), ); } @@ -1748,7 +1740,7 @@ public function testGetDefaultValueDeclarationSQLForDateType(): void $this->platform->getDefaultValueDeclarationSQL([ 'type' => Type::getType($type), 'default' => $currentDateSql, - ]) + ]), ); } } @@ -1762,7 +1754,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'), ); } @@ -1776,7 +1768,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), ); } @@ -1790,19 +1782,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'), ); } @@ -1813,7 +1805,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']; @@ -1834,9 +1826,7 @@ public function testAppendsLockHint(int $lockMode, string $lockHint): void self::assertSame($expectedResult, $this->platform->appendLockHint($fromClause, $lockMode)); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function getLockHints(): iterable { return [ diff --git a/tests/Platforms/SqlitePlatformTest.php b/tests/Platforms/SqlitePlatformTest.php index d29f8dc65fd..3f392996eee 100644 --- a/tests/Platforms/SqlitePlatformTest.php +++ b/tests/Platforms/SqlitePlatformTest.php @@ -11,9 +11,7 @@ use Doctrine\DBAL\TransactionIsolationLevel; use Doctrine\DBAL\Types\Type; -/** - * @extends AbstractPlatformTestCase - */ +/** @extends AbstractPlatformTestCase */ class SqlitePlatformTest extends AbstractPlatformTestCase { public function createPlatform(): AbstractPlatform @@ -48,19 +46,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), ); } @@ -73,7 +71,7 @@ public function testIgnoresUnsignedIntegerDeclarationForAutoIncrementalIntegers( { self::assertSame( 'INTEGER PRIMARY KEY AUTOINCREMENT', - $this->platform->getIntegerTypeDeclarationSQL(['autoincrement' => true, 'unsigned' => true]) + $this->platform->getIntegerTypeDeclarationSQL(['autoincrement' => true, 'unsigned' => true]), ); } @@ -81,25 +79,25 @@ public function testGeneratesTypeDeclarationForTinyIntegers(): void { self::assertEquals( 'TINYINT', - $this->platform->getTinyIntTypeDeclarationSQL([]) + $this->platform->getTinyIntTypeDeclarationSQL([]), ); self::assertEquals( 'INTEGER PRIMARY KEY AUTOINCREMENT', - $this->platform->getTinyIntTypeDeclarationSQL(['autoincrement' => true]) + $this->platform->getTinyIntTypeDeclarationSQL(['autoincrement' => true]), ); self::assertEquals( 'INTEGER PRIMARY KEY AUTOINCREMENT', $this->platform->getTinyIntTypeDeclarationSQL( - ['autoincrement' => true, 'primary' => true] - ) + ['autoincrement' => true, 'primary' => true], + ), ); self::assertEquals( 'TINYINT', - $this->platform->getTinyIntTypeDeclarationSQL(['unsigned' => false]) + $this->platform->getTinyIntTypeDeclarationSQL(['unsigned' => false]), ); self::assertEquals( 'TINYINT UNSIGNED', - $this->platform->getTinyIntTypeDeclarationSQL(['unsigned' => true]) + $this->platform->getTinyIntTypeDeclarationSQL(['unsigned' => true]), ); } @@ -107,29 +105,29 @@ 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->getTinyIntTypeDeclarationSQL(['autoincrement' => true, 'unsigned' => true]) + $this->platform->getTinyIntTypeDeclarationSQL(['autoincrement' => true, 'unsigned' => 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]), ); } @@ -137,29 +135,29 @@ public function testGeneratesTypeDeclarationForMediumIntegers(): void { self::assertEquals( 'MEDIUMINT', - $this->platform->getMediumIntTypeDeclarationSQL([]) + $this->platform->getMediumIntTypeDeclarationSQL([]), ); self::assertEquals( 'INTEGER PRIMARY KEY AUTOINCREMENT', - $this->platform->getMediumIntTypeDeclarationSQL(['autoincrement' => true]) + $this->platform->getMediumIntTypeDeclarationSQL(['autoincrement' => true]), ); self::assertEquals( 'INTEGER PRIMARY KEY AUTOINCREMENT', - $this->platform->getMediumIntTypeDeclarationSQL(['autoincrement' => true, 'unsigned' => true]) + $this->platform->getMediumIntTypeDeclarationSQL(['autoincrement' => true, 'unsigned' => true]), ); self::assertEquals( 'INTEGER PRIMARY KEY AUTOINCREMENT', $this->platform->getMediumIntTypeDeclarationSQL( - ['autoincrement' => true, 'primary' => true] - ) + ['autoincrement' => true, 'primary' => true], + ), ); self::assertEquals( 'MEDIUMINT', - $this->platform->getMediumIntTypeDeclarationSQL(['unsigned' => false]) + $this->platform->getMediumIntTypeDeclarationSQL(['unsigned' => false]), ); self::assertEquals( 'MEDIUMINT UNSIGNED', - $this->platform->getMediumIntTypeDeclarationSQL(['unsigned' => true]) + $this->platform->getMediumIntTypeDeclarationSQL(['unsigned' => true]), ); } @@ -167,29 +165,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]), ); } @@ -197,29 +195,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]), ); } @@ -228,16 +226,16 @@ public function testGeneratesTypeDeclarationForStrings(): void self::assertEquals( 'CHAR(10)', $this->platform->getStringTypeDeclarationSQL( - ['length' => 10, 'fixed' => true] - ) + ['length' => 10, 'fixed' => true], + ), ); self::assertEquals( 'VARCHAR(50)', - $this->platform->getStringTypeDeclarationSQL(['length' => 50]) + $this->platform->getStringTypeDeclarationSQL(['length' => 50]), ); self::assertEquals( 'VARCHAR(255)', - $this->platform->getStringTypeDeclarationSQL([]) + $this->platform->getStringTypeDeclarationSQL([]), ); } @@ -315,7 +313,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], ); } @@ -337,9 +335,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); @@ -360,9 +356,7 @@ public function testRenameNonExistingColumn(): void $this->platform->getAlterTableSQL($tableDiff); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function complexDiffProvider(): iterable { $date = new TableDiff('user'); @@ -602,7 +596,7 @@ public function testAlterTableRenameIndexInSchema(): void { self::markTestIncomplete( 'Test currently produces broken SQL due to SQLLitePlatform::getAlterTable() being broken ' . - 'when used with schemas.' + 'when used with schemas.', ); } @@ -610,7 +604,7 @@ public function testQuotesAlterTableRenameIndexInSchema(): void { self::markTestIncomplete( 'Test currently produces broken SQL due to SQLLitePlatform::getAlterTable() being broken ' . - 'when used with schemas.' + 'when used with schemas.', ); } @@ -739,7 +733,7 @@ public function testQuotesTableNameInListTableConstraintsSQL(): void { self::assertStringContainsStringIgnoringCase( "'Foo''Bar\\'", - $this->platform->getListTableConstraintsSQL("Foo'Bar\\") + $this->platform->getListTableConstraintsSQL("Foo'Bar\\"), ); } @@ -747,7 +741,7 @@ public function testQuotesTableNameInListTableColumnsSQL(): void { self::assertStringContainsStringIgnoringCase( "'Foo''Bar\\'", - $this->platform->getListTableColumnsSQL("Foo'Bar\\") + $this->platform->getListTableColumnsSQL("Foo'Bar\\"), ); } @@ -755,7 +749,7 @@ public function testQuotesTableNameInListTableIndexesSQL(): void { self::assertStringContainsStringIgnoringCase( "'Foo''Bar\\'", - $this->platform->getListTableIndexesSQL("Foo'Bar\\") + $this->platform->getListTableIndexesSQL("Foo'Bar\\"), ); } @@ -763,7 +757,7 @@ public function testQuotesTableNameInListTableForeignKeysSQL(): void { self::assertStringContainsStringIgnoringCase( "'Foo''Bar\\'", - $this->platform->getListTableForeignKeysSQL("Foo'Bar\\") + $this->platform->getListTableForeignKeysSQL("Foo'Bar\\"), ); } @@ -776,7 +770,7 @@ public function testDateAddStaticNumberOfDays(): void { self::assertSame( "DATE(rentalBeginsOn,'+12 DAY')", - $this->platform->getDateAddDaysExpression('rentalBeginsOn', 12) + $this->platform->getDateAddDaysExpression('rentalBeginsOn', 12), ); } @@ -784,7 +778,7 @@ public function testDateAddNumberOfDaysFromColumn(): void { self::assertSame( "DATE(rentalBeginsOn,'+' || duration || ' DAY')", - $this->platform->getDateAddDaysExpression('rentalBeginsOn', 'duration') + $this->platform->getDateAddDaysExpression('rentalBeginsOn', 'duration'), ); } @@ -797,7 +791,7 @@ public function testColumnCollationDeclarationSQL(): void { self::assertSame( 'COLLATE NOCASE', - $this->platform->getColumnCollationDeclarationSQL('NOCASE') + $this->platform->getColumnCollationDeclarationSQL('NOCASE'), ); } @@ -812,7 +806,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/ConnectionTest.php b/tests/Portability/ConnectionTest.php index 3077edd2b94..aaa53a2ad03 100644 --- a/tests/Portability/ConnectionTest.php +++ b/tests/Portability/ConnectionTest.php @@ -27,7 +27,7 @@ public function testGetServerVersionFailsWithLegacyConnection(): void { $connection = new Connection( $this->createMock(DriverConnection::class), - new Converter(false, false, 0) + new Converter(false, false, 0), ); $this->expectException(LogicException::class); @@ -52,7 +52,7 @@ public function testGetNativeConnectionFailsWithLegacyConnection(): void { $connection = new Connection( $this->createMock(DriverConnection::class), - new Converter(false, false, 0) + new Converter(false, false, 0), ); $this->expectException(LogicException::class); @@ -62,8 +62,6 @@ public function testGetNativeConnectionFailsWithLegacyConnection(): void interface NativeDriverConnection extends ServerInfoAwareConnection { - /** - * @return object|resource - */ + /** @return object|resource */ public function getNativeConnection(); } diff --git a/tests/Portability/ConverterTest.php b/tests/Portability/ConverterTest.php index e539c45074b..895212b384d 100644 --- a/tests/Portability/ConverterTest.php +++ b/tests/Portability/ConverterTest.php @@ -20,13 +20,11 @@ public function testConvertNumeric($row, bool $convertEmptyStringToNull, bool $r self::assertSame( $expected, $this->createConverter($convertEmptyStringToNull, $rightTrimString, null) - ->convertNumeric($row) + ->convertNumeric($row), ); } - /** - * @return iterable> - */ + /** @return iterable> */ public static function convertNumericProvider(): iterable { $row = ['X ', '']; @@ -78,13 +76,11 @@ public function testConvertAssociative( self::assertSame( $expected, $this->createConverter($convertEmptyStringToNull, $rightTrimString, $case) - ->convertAssociative($row) + ->convertAssociative($row), ); } - /** - * @return iterable> - */ + /** @return iterable> */ public static function convertAssociativeProvider(): iterable { $row = [ @@ -194,13 +190,11 @@ public function testConvertOne($value, bool $convertEmptyStringToNull, bool $rig 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 ']; @@ -230,13 +224,11 @@ public function testConvertAllNumeric( self::assertSame( $expected, $this->createConverter($convertEmptyStringToNull, $rightTrimString, null) - ->convertAllNumeric($data) + ->convertAllNumeric($data), ); } - /** - * @return iterable> - */ + /** @return iterable> */ public static function convertAllNumericProvider(): iterable { $data = [ @@ -299,13 +291,11 @@ public function testConvertAllAssociative( self::assertSame( $expected, $this->createConverter($convertEmptyStringToNull, $rightTrimString, $case) - ->convertAllAssociative($row) + ->convertAllAssociative($row), ); } - /** - * @return iterable> - */ + /** @return iterable> */ public static function convertAllAssociativeProvider(): iterable { $data = [ @@ -471,13 +461,11 @@ public function testConvertFirstColumn( 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 89dd123849c..5cfe12be9a0 100644 --- a/tests/Portability/ResultTest.php +++ b/tests/Portability/ResultTest.php @@ -28,9 +28,7 @@ public function testFetch(string $source, callable $fetch, $return): void self::assertSame($return, $fetch($result)); } - /** - * @return iterable> - */ + /** @return iterable> */ public static function fetchProvider(): iterable { yield 'numeric' => [ @@ -128,7 +126,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/Portability/StatementTest.php b/tests/Portability/StatementTest.php index ad11903d3bd..0282d403c61 100644 --- a/tests/Portability/StatementTest.php +++ b/tests/Portability/StatementTest.php @@ -67,9 +67,7 @@ public function testExecute(): void $this->stmt->execute($params); } - /** - * @return Connection&MockObject - */ + /** @return Connection&MockObject */ protected function createConnection() { return $this->getMockBuilder(Connection::class) diff --git a/tests/Query/Expression/CompositeExpressionTest.php b/tests/Query/Expression/CompositeExpressionTest.php index ecdcfc542f9..7ff382c0b00 100644 --- a/tests/Query/Expression/CompositeExpressionTest.php +++ b/tests/Query/Expression/CompositeExpressionTest.php @@ -73,9 +73,7 @@ public function testCompositeUsageAndGeneration(string $type, array $parts, stri self::assertEquals($expects, (string) $expr); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function provideDataForConvertToString(): iterable { return [ @@ -105,7 +103,7 @@ 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))', @@ -116,7 +114,7 @@ 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 090c1645089..4ecfeb9fa08 100644 --- a/tests/Query/Expression/ExpressionBuilderTest.php +++ b/tests/Query/Expression/ExpressionBuilderTest.php @@ -50,9 +50,7 @@ public function testAndX(array $parts, string $expected): void self::assertEquals($expected, (string) $composite); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function provideDataForAnd(): iterable { return [ @@ -77,7 +75,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))', @@ -87,7 +85,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))', @@ -123,9 +121,7 @@ public function testOrX(array $parts, string $expected): void self::assertEquals($expected, (string) $composite); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function provideDataForOr(): iterable { return [ @@ -150,7 +146,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))', @@ -160,7 +156,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))', @@ -168,9 +164,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); @@ -178,9 +172,7 @@ public function testComparison(string $leftExpr, string $operator, string $right self::assertEquals($expected, $part); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function provideDataForComparison(): iterable { return [ @@ -262,7 +254,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'", "'💩'"), ); } @@ -270,7 +262,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'"), ); } @@ -278,7 +270,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 f73c3e92b03..afce3009f55 100644 --- a/tests/Query/QueryBuilderTest.php +++ b/tests/Query/QueryBuilderTest.php @@ -181,7 +181,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, ); } @@ -278,7 +278,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, ); } @@ -294,7 +294,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, ); } @@ -310,7 +310,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, ); } @@ -327,7 +327,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, ); } @@ -491,7 +491,7 @@ public function testInsertValues(): void [ 'foo' => '?', 'bar' => '?', - ] + ], ); self::assertEquals(QueryBuilder::INSERT, $qb->getType()); @@ -506,13 +506,13 @@ public function testInsertReplaceValues(): void [ 'foo' => '?', 'bar' => '?', - ] + ], ) ->values( [ 'bar' => '?', 'foo' => '?', - ] + ], ); self::assertEquals(QueryBuilder::INSERT, $qb->getType()); @@ -536,7 +536,7 @@ public function testInsertValuesSetValue(): void $qb = new QueryBuilder($this->conn); $qb->insert('users') ->values( - ['foo' => '?'] + ['foo' => '?'], ) ->setValue('bar', '?'); @@ -575,9 +575,7 @@ public function testGetState(): void self::assertEquals($sql1, $qb->getSQL()); } - /** - * @dataProvider maxResultsProvider - */ + /** @dataProvider maxResultsProvider */ public function testSetMaxResults(?int $maxResults): void { $qb = new QueryBuilder($this->conn); @@ -587,9 +585,7 @@ public function testSetMaxResults(?int $maxResults): void self::assertEquals($maxResults, $qb->getMaxResults()); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function maxResultsProvider(): iterable { return [ @@ -634,7 +630,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); @@ -647,7 +643,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); @@ -660,7 +656,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); @@ -682,7 +678,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()); } @@ -704,7 +700,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(), ); } @@ -725,7 +721,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(), ); } @@ -747,7 +743,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, ); } @@ -773,7 +769,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, ); } @@ -835,7 +831,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(), ); } @@ -853,7 +849,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(), ); } @@ -929,7 +925,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(); @@ -1085,7 +1081,7 @@ public function testFetchAllAssociative( [ ['username' => 'jwage', 'password' => 'changeme'], ['username' => 'support', 'password' => 'p@ssword'], - ] + ], ); $results = $qb->select($select) @@ -1099,7 +1095,7 @@ public function testFetchAllAssociative( ['username' => 'jwage', 'password' => 'changeme'], ['username' => 'support', 'password' => 'p@ssword'], ], - $results + $results, ); } @@ -1131,7 +1127,7 @@ public function testFetchAllNumeric( [ ['jwage', 'changeme'], ['support', 'p@ssword'], - ] + ], ); $results = $qb->select($select) @@ -1145,7 +1141,7 @@ public function testFetchAllNumeric( ['jwage', 'changeme'], ['support', 'p@ssword'], ], - $results + $results, ); } @@ -1177,7 +1173,7 @@ public function testFetchAllKeyValue( [ 'jwage' => 'changeme', 'support' => 'p@ssw0rd', - ] + ], ); $results = $qb->select($select) @@ -1191,7 +1187,7 @@ public function testFetchAllKeyValue( 'jwage' => 'changeme', 'support' => 'p@ssw0rd', ], - $results + $results, ); } @@ -1225,7 +1221,7 @@ public function testFetchAllAssociativeIndexed( 'username' => 'jwage', 'password' => 'changeme', ], - ] + ], ); $results = $qb->select($select) @@ -1241,7 +1237,7 @@ public function testFetchAllAssociativeIndexed( 'password' => 'changeme', ], ], - $results + $results, ); } @@ -1273,7 +1269,7 @@ public function testFetchFirstColumn( [ 'jwage', 'support', - ] + ], ); $results = $qb->select($select) @@ -1287,7 +1283,7 @@ public function testFetchFirstColumn( 'jwage', 'support', ], - $results + $results, ); } @@ -1372,7 +1368,7 @@ public function testExecuteQuery( self::assertSame( $mockedResult, - $results + $results, ); } @@ -1408,7 +1404,7 @@ public function testExecuteQueryWithResultCaching( self::assertSame( $mockedResult, - $results + $results, ); } @@ -1442,7 +1438,7 @@ public function testExecuteStatement(): void self::assertSame( $mockedResult, - $results + $results, ); } } diff --git a/tests/SQL/ParserTest.php b/tests/SQL/ParserTest.php index 798547609fc..a186e6104cf 100644 --- a/tests/SQL/ParserTest.php +++ b/tests/SQL/ParserTest.php @@ -15,9 +15,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); @@ -26,9 +24,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) { @@ -38,9 +34,7 @@ public static function statementsWithParametersProvider(): iterable } } - /** - * @return iterable> - */ + /** @return iterable> */ private static function getStatementsWithParameters(): iterable { yield [ @@ -308,9 +302,7 @@ private static function getStatementsWithParameters(): iterable ]; } - /** - * @dataProvider statementsWithoutParametersProvider - */ + /** @dataProvider statementsWithoutParametersProvider */ public function testStatementsWithoutParameters(bool $mySQLStringEscaping, string $sql): void { $parser = new Parser($mySQLStringEscaping); @@ -319,9 +311,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) { @@ -331,9 +321,7 @@ public static function statementsWithoutParametersProvider(): iterable } } - /** - * @return iterable - */ + /** @return iterable */ private static function getStatementsWithoutParameters(): iterable { yield 'SELECT * FROM Foo'; @@ -348,9 +336,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); @@ -359,9 +345,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' => [ @@ -393,9 +377,7 @@ public static function ansiParametersProvider(): iterable ]; } - /** - * @dataProvider mySQLParametersProvider - */ + /** @dataProvider mySQLParametersProvider */ public function testMySQLEscaping(string $sql, string $expected): void { $parser = new Parser(true); @@ -404,9 +386,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' => [ @@ -457,9 +437,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 29274dd0874..aacbd52f69d 100644 --- a/tests/Schema/ColumnTest.php +++ b/tests/Schema/ColumnTest.php @@ -120,9 +120,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'); @@ -131,9 +129,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 9ab934a67fc..314dceec226 100644 --- a/tests/Schema/ComparatorTest.php +++ b/tests/Schema/ComparatorTest.php @@ -39,7 +39,7 @@ public function testCompareSame1(): void 'bugdb', [ 'integercolumn1' => new Column('integercolumn1', Type::getType('integer')), - ] + ], ), ]); $schema2 = new Schema([ @@ -47,7 +47,7 @@ public function testCompareSame1(): void 'bugdb', [ 'integercolumn1' => new Column('integercolumn1', Type::getType('integer')), - ] + ], ), ]); @@ -64,7 +64,7 @@ public function testCompareSame2(): void [ 'integercolumn1' => new Column('integercolumn1', Type::getType('integer')), 'integercolumn2' => new Column('integercolumn2', Type::getType('integer')), - ] + ], ), ]); $schema2 = new Schema([ @@ -73,7 +73,7 @@ public function testCompareSame2(): void [ 'integercolumn2' => new Column('integercolumn2', Type::getType('integer')), 'integercolumn1' => new Column('integercolumn1', Type::getType('integer')), - ] + ], ), ]); @@ -131,7 +131,7 @@ public function testCompareMissingField(): void [ 'integercolumn1' => $missingColumn, 'integercolumn2' => new Column('integercolumn2', Type::getType('integer')), - ] + ], ), ]); $schema2 = new Schema([ @@ -139,7 +139,7 @@ public function testCompareMissingField(): void 'bugdb', [ 'integercolumn2' => new Column('integercolumn2', Type::getType('integer')), - ] + ], ), ]); @@ -150,9 +150,9 @@ public function testCompareMissingField(): void 'bugdb', [], [], - ['integercolumn1' => $missingColumn] + ['integercolumn1' => $missingColumn], ), - ] + ], ); $expected->fromSchema = $schema1; $expected->changedTables['bugdb']->fromTable = $schema1->getTable('bugdb'); @@ -167,7 +167,7 @@ public function testCompareNewField(): void 'bugdb', [ 'integercolumn1' => new Column('integercolumn1', Type::getType('integer')), - ] + ], ), ]); $schema2 = new Schema([ @@ -176,7 +176,7 @@ public function testCompareNewField(): void [ 'integercolumn1' => new Column('integercolumn1', Type::getType('integer')), 'integercolumn2' => new Column('integercolumn2', Type::getType('integer')), - ] + ], ), ]); @@ -187,9 +187,9 @@ public function testCompareNewField(): void 'bugdb', [ 'integercolumn2' => new Column('integercolumn2', Type::getType('integer')), - ] + ], ), - ] + ], ); $expected->fromSchema = $schema1; $expected->changedTables['bugdb']->fromTable = $schema1->getTable('bugdb'); @@ -282,9 +282,9 @@ public function testCompareRemovedIndex(): void 'primary' => new Index( 'primary', ['integercolumn1'], - true + true, ), - ] + ], ), ]); $schema2 = new Schema([ @@ -293,7 +293,7 @@ public function testCompareRemovedIndex(): void [ 'integercolumn1' => new Column('integercolumn1', Type::getType('integer')), 'integercolumn2' => new Column('integercolumn2', Type::getType('integer')), - ] + ], ), ]); @@ -311,11 +311,11 @@ public function testCompareRemovedIndex(): void 'primary' => new Index( 'primary', ['integercolumn1'], - true + true, ), - ] + ], ), - ] + ], ); $expected->fromSchema = $schema1; $expected->changedTables['bugdb']->fromTable = $schema1->getTable('bugdb'); @@ -331,7 +331,7 @@ public function testCompareNewIndex(): void [ 'integercolumn1' => new Column('integercolumn1', Type::getType('integer')), 'integercolumn2' => new Column('integercolumn2', Type::getType('integer')), - ] + ], ), ]); $schema2 = new Schema([ @@ -345,9 +345,9 @@ public function testCompareNewIndex(): void 'primary' => new Index( 'primary', ['integercolumn1'], - true + true, ), - ] + ], ), ]); @@ -363,11 +363,11 @@ public function testCompareNewIndex(): void 'primary' => new Index( 'primary', ['integercolumn1'], - true + true, ), - ] + ], ), - ] + ], ); $expected->fromSchema = $schema1; $expected->changedTables['bugdb']->fromTable = $schema1->getTable('bugdb'); @@ -388,9 +388,9 @@ public function testCompareChangedIndex(): void 'primary' => new Index( 'primary', ['integercolumn1'], - true + true, ), - ] + ], ), ]); $schema2 = new Schema([ @@ -404,9 +404,9 @@ public function testCompareChangedIndex(): void 'primary' => new Index( 'primary', ['integercolumn1', 'integercolumn2'], - true + true, ), - ] + ], ), ]); @@ -426,11 +426,11 @@ public function testCompareChangedIndex(): void 'integercolumn1', 'integercolumn2', ], - true + true, ), - ] + ], ), - ] + ], ); $expected->fromSchema = $schema1; $expected->changedTables['bugdb']->fromTable = $schema1->getTable('bugdb'); @@ -449,7 +449,7 @@ public function testCompareChangedIndexFieldPositions(): void ], [ 'primary' => new Index('primary', ['integercolumn1', 'integercolumn2'], true), - ] + ], ), ]); $schema2 = new Schema([ @@ -461,7 +461,7 @@ public function testCompareChangedIndexFieldPositions(): void ], [ 'primary' => new Index('primary', ['integercolumn2', 'integercolumn1'], true), - ] + ], ), ]); @@ -476,9 +476,9 @@ public function testCompareChangedIndexFieldPositions(): void [], [ 'primary' => new Index('primary', ['integercolumn2', 'integercolumn1'], true), - ] + ], ), - ] + ], ); $expected->fromSchema = $schema1; $expected->changedTables['bugdb']->fromTable = $schema1->getTable('bugdb'); @@ -668,7 +668,7 @@ public function testCompareIndexBasedOnPropertiesNotName(): void self::assertEquals( $tableDiff, - $this->comparator->diffTable($tableA, $tableB) + $this->comparator->diffTable($tableA, $tableB), ); } @@ -843,9 +843,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')); @@ -1176,16 +1174,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]); @@ -1202,9 +1198,7 @@ public function testCompareColumnComments(?string $comment1, ?string $comment2, self::assertSame($expectedDiff, $actualDiff); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function getCompareColumnComments(): iterable { return [ @@ -1245,7 +1239,7 @@ public function testForeignKeyRemovalWithRenamedLocalColumn(): void 'table1', [ 'id' => new Column('id', Type::getType('integer')), - ] + ], ), 'table2' => new Table( 'table2', @@ -1257,7 +1251,7 @@ public function testForeignKeyRemovalWithRenamedLocalColumn(): void [], [ new ForeignKeyConstraint(['id_table1'], 'table1', ['id'], 'fk_table2_table1'), - ] + ], ), ]); $toSchema = new Schema([ @@ -1271,13 +1265,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); @@ -1303,9 +1297,9 @@ public function testWillNotProduceSchemaDiffOnTableWithAddedCustomSchemaDefiniti 'a_table', [ new Column('is_default', Type::getType('string')), - ] + ], ), - ] + ], ); $toSchema = new Schema( [ @@ -1313,15 +1307,15 @@ public function testWillNotProduceSchemaDiffOnTableWithAddedCustomSchemaDefiniti 'a_table', [ new Column('is_default', Type::getType('string'), ['columnDefinition' => 'ENUM(\'default\')']), - ] + ], ), - ] + ], ); 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 f3b9660a6c9..c8bd3909368 100644 --- a/tests/Schema/ForeignKeyConstraintTest.php +++ b/tests/Schema/ForeignKeyConstraintTest.php @@ -28,9 +28,7 @@ public function testIntersectsIndexColumns(array $indexColumns, bool $expectedRe self::assertSame($expectedResult, $foreignKey->intersectsIndexColumns($index)); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function getIntersectsIndexColumnsData(): iterable { return [ @@ -69,9 +67,7 @@ public function testGetUnqualifiedForeignTableName($foreignTableName, string $ex 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 56a33ec5512..0306959c401 100644 --- a/tests/Schema/IndexTest.php +++ b/tests/Schema/IndexTest.php @@ -7,9 +7,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); @@ -118,9 +116,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 e7e2c9df5c1..5ef9743eab8 100644 --- a/tests/Schema/MySQLInheritCharsetTest.php +++ b/tests/Schema/MySQLInheritCharsetTest.php @@ -19,9 +19,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 @@ -52,7 +50,7 @@ public function testTableOptions(): void 'CREATE TABLE foobar (aa INT NOT NULL)' . ' DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB', ], - $platform->getCreateTableSQL($table) + $platform->getCreateTableSQL($table), ); // explicit utf8 @@ -63,7 +61,7 @@ public function testTableOptions(): void 'CREATE TABLE foobar (aa INT NOT NULL)' . ' DEFAULT CHARACTER SET utf8 COLLATE `utf8_unicode_ci` ENGINE = InnoDB', ], - $platform->getCreateTableSQL($table) + $platform->getCreateTableSQL($table), ); // explicit utf8mb4 @@ -73,7 +71,7 @@ public function testTableOptions(): void ['CREATE TABLE foobar (aa INT NOT NULL)' . ' DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB', ], - $platform->getCreateTableSQL($table) + $platform->getCreateTableSQL($table), ); } diff --git a/tests/Schema/Platforms/MySQLSchemaTest.php b/tests/Schema/Platforms/MySQLSchemaTest.php index 6bf80835f4a..015475d593e 100644 --- a/tests/Schema/Platforms/MySQLSchemaTest.php +++ b/tests/Schema/Platforms/MySQLSchemaTest.php @@ -19,9 +19,7 @@ protected function setUp(): void $this->platform = new MySQLPlatform(); } - /** - * @dataProvider comparatorProvider - */ + /** @dataProvider comparatorProvider */ public function testSwitchPrimaryKeyOrder(Comparator $comparator): void { $tableOld = new Table('test'); @@ -42,7 +40,7 @@ public function testSwitchPrimaryKeyOrder(Comparator $comparator): void 'DROP INDEX `primary` ON test', 'ALTER TABLE test ADD PRIMARY KEY (bar_id, foo_id)', ], - $sql + $sql, ); } @@ -62,13 +60,11 @@ public function testGenerateForeignKeySQL(): void 'ALTER TABLE test ADD CONSTRAINT FK_D87F7E0C8E48560F FOREIGN KEY (foo_id)' . ' REFERENCES test_foreign (foo_id)', ], - $sqls + $sqls, ); } - /** - * @dataProvider comparatorProvider - */ + /** @dataProvider comparatorProvider */ public function testClobNoAlterTable(Comparator $comparator): void { $tableOld = new Table('test'); @@ -85,13 +81,11 @@ public function testClobNoAlterTable(Comparator $comparator): void self::assertEquals( ['ALTER TABLE test ADD PRIMARY KEY (id)'], - $sql + $sql, ); } - /** - * @return iterable - */ + /** @return iterable */ public static function comparatorProvider(): iterable { yield 'Generic comparator' => [ @@ -106,7 +100,7 @@ public function getCollationCharset(string $collation): ?string { return null; } - } + }, ), ]; } diff --git a/tests/Schema/SchemaTest.php b/tests/Schema/SchemaTest.php index 2fdf23cb9cc..68259ae69d9 100644 --- a/tests/Schema/SchemaTest.php +++ b/tests/Schema/SchemaTest.php @@ -361,14 +361,14 @@ public function testVisitsVisitor(): void ->method('acceptTable') ->withConsecutive( [$schema->getTable('baz')], - [$schema->getTable('bla.bloo')] + [$schema->getTable('bla.bloo')], ); $visitor->expects(self::exactly(2)) ->method('acceptSequence') ->withConsecutive( [$schema->getSequence('moo')], - [$schema->getSequence('war')] + [$schema->getSequence('war')], ); $schema->visit($visitor); @@ -400,14 +400,14 @@ public function testVisitsNamespaceVisitor(): void ->method('acceptTable') ->withConsecutive( [$schema->getTable('baz')], - [$schema->getTable('bla.bloo')] + [$schema->getTable('bla.bloo')], ); $visitor->expects($this->exactly(2)) ->method('acceptSequence') ->withConsecutive( [$schema->getSequence('moo')], - [$schema->getSequence('war')] + [$schema->getSequence('war')], ); $schema->visit($visitor); diff --git a/tests/Schema/SqliteSchemaManagerTest.php b/tests/Schema/SqliteSchemaManagerTest.php index 525c25731fe..ff92842cb0a 100644 --- a/tests/Schema/SqliteSchemaManagerTest.php +++ b/tests/Schema/SqliteSchemaManagerTest.php @@ -10,9 +10,7 @@ class SqliteSchemaManagerTest extends TestCase { - /** - * @dataProvider getDataColumnCollation - */ + /** @dataProvider getDataColumnCollation */ public function testParseColumnCollation(?string $collation, string $column, string $sql): void { $conn = $this->createMock(Connection::class); @@ -24,9 +22,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 [ @@ -126,9 +122,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, 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 c3c5955881d..4575690e28e 100644 --- a/tests/Schema/TableTest.php +++ b/tests/Schema/TableTest.php @@ -663,7 +663,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')); @@ -685,11 +685,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). @@ -749,9 +749,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'); @@ -806,9 +804,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/Schema/Visitor/CreateSchemaSqlCollectorTest.php b/tests/Schema/Visitor/CreateSchemaSqlCollectorTest.php index 1115d808f72..1b301c4c0be 100644 --- a/tests/Schema/Visitor/CreateSchemaSqlCollectorTest.php +++ b/tests/Schema/Visitor/CreateSchemaSqlCollectorTest.php @@ -28,7 +28,7 @@ protected function setUp(): void 'getCreateTableSQL', 'supportsForeignKeyConstraints', 'supportsSchemas', - ] + ], ) ->getMockForAbstractClass(); $this->visitor = new CreateSchemaSqlCollector($this->platformMock); @@ -130,9 +130,7 @@ public function testResetsQueries(): void self::assertEmpty($this->visitor->getQueries()); } - /** - * @return ForeignKeyConstraint&MockObject - */ + /** @return ForeignKeyConstraint&MockObject */ private function createForeignKeyConstraintMock() { return $this->getMockBuilder(ForeignKeyConstraint::class) @@ -140,9 +138,7 @@ private function createForeignKeyConstraintMock() ->getMock(); } - /** - * @return Sequence&MockObject - */ + /** @return Sequence&MockObject */ private function createSequenceMock() { return $this->getMockBuilder(Sequence::class) @@ -150,9 +146,7 @@ private function createSequenceMock() ->getMock(); } - /** - * @return Table&MockObject - */ + /** @return Table&MockObject */ private function createTableMock() { return $this->getMockBuilder(Table::class) diff --git a/tests/Schema/Visitor/DropSchemaSqlCollectorTest.php b/tests/Schema/Visitor/DropSchemaSqlCollectorTest.php index 4f6caeb9ed9..a0fb23d0fb3 100644 --- a/tests/Schema/Visitor/DropSchemaSqlCollectorTest.php +++ b/tests/Schema/Visitor/DropSchemaSqlCollectorTest.php @@ -9,9 +9,7 @@ use Doctrine\DBAL\Schema\Visitor\DropSchemaSqlCollector; use PHPUnit\Framework\TestCase; -/** - * @covers \Doctrine\DBAL\Schema\Visitor\DropSchemaSqlCollector - */ +/** @covers \Doctrine\DBAL\Schema\Visitor\DropSchemaSqlCollector */ class DropSchemaSqlCollectorTest extends TestCase { public function testGetQueriesUsesAcceptedForeignKeys(): void @@ -32,7 +30,7 @@ public function testGetQueriesUsesAcceptedForeignKeys(): void ->method('getDropForeignKeySQL') ->withConsecutive( [$keyConstraintOne->getQuotedName($platform), $tableOne->getQuotedName($platform)], - [$keyConstraintTwo->getQuotedName($platform), $tableTwo->getQuotedName($platform)] + [$keyConstraintTwo->getQuotedName($platform), $tableTwo->getQuotedName($platform)], ); $collector->acceptForeignKey($tableOne, $keyConstraintOne); @@ -63,13 +61,13 @@ private function getStubKeyConstraint(string $name): ForeignKeyConstraint public function testGivenForeignKeyWithZeroLengthAcceptForeignKeyThrowsException(): void { $collector = new DropSchemaSqlCollector( - $this->getMockForAbstractClass(AbstractPlatform::class) + $this->getMockForAbstractClass(AbstractPlatform::class), ); $this->expectException(SchemaException::class); $collector->acceptForeignKey( $this->createMock(Table::class), - $this->getStubKeyConstraint('') + $this->getStubKeyConstraint(''), ); } } diff --git a/tests/StatementTest.php b/tests/StatementTest.php index 476c68d4bc7..1c91859c2cd 100644 --- a/tests/StatementTest.php +++ b/tests/StatementTest.php @@ -128,7 +128,7 @@ public function testExecuteCallsLoggerStopQueryOnException(): void $this->driverStatement->expects(self::once()) ->method('execute') ->will(self::throwException( - $this->createMock(DriverException::class) + $this->createMock(DriverException::class), )); $statement = new Statement($this->conn, $this->driverStatement, ''); diff --git a/tests/TestUtil.php b/tests/TestUtil.php index 045ccc8db3c..d6b8702907d 100644 --- a/tests/TestUtil.php +++ b/tests/TestUtil.php @@ -75,9 +75,7 @@ public static function getConnection(): Connection return $connection; } - /** - * @return mixed[] - */ + /** @return mixed[] */ public static function getConnectionParams(): array { if (self::hasRequiredConnectionParams()) { @@ -135,9 +133,7 @@ private static function initializeDatabase(): void $privConn->close(); } - /** - * @return mixed[] - */ + /** @return mixed[] */ private static function getFallbackConnectionParams(): array { if (! extension_loaded('pdo_sqlite')) { @@ -151,9 +147,7 @@ private static function getFallbackConnectionParams(): array ]; } - /** - * @param list $subscribers - */ + /** @param list $subscribers */ private static function addDbEventSubscribers(Connection $connection, array $subscribers): void { $evm = $connection->getEventManager(); @@ -163,7 +157,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, )); } @@ -171,9 +165,7 @@ private static function addDbEventSubscribers(Connection $connection, array $sub } } - /** - * @return mixed[] - */ + /** @return mixed[] */ private static function getPrivilegedConnectionParameters(): array { if (isset($GLOBALS['tmpdb_driver'])) { @@ -186,9 +178,7 @@ private static function getPrivilegedConnectionParameters(): array return $parameters; } - /** - * @return mixed[] - */ + /** @return mixed[] */ private static function getTestConnectionParameters(): array { return self::mapConnectionParameters($GLOBALS, 'db_'); @@ -266,7 +256,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 470f2f21dc0..8b8a088ec6b 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/ArrayTest.php b/tests/Types/ArrayTest.php index caba1969da9..3fcd295a25c 100644 --- a/tests/Types/ArrayTest.php +++ b/tests/Types/ArrayTest.php @@ -39,7 +39,7 @@ public function testConversionFailure(): void $this->expectException(ConversionException::class); $this->expectExceptionMessage( "Could not convert database value to 'array' as an error was triggered by the unserialization:" - . " 'unserialize(): Error at offset 0 of 7 bytes'" + . " 'unserialize(): Error at offset 0 of 7 bytes'", ); $this->type->convertToPHPValue('abcdefg', $this->platform); @@ -49,7 +49,7 @@ public function testDeprecationDuringConversion(): void { @self::assertInstanceOf(UnserializeWithDeprecationObject::class, $this->type->convertToPHPValue( serialize(new UnserializeWithDeprecationObject()), - $this->platform + $this->platform, )); } diff --git a/tests/Types/BaseDateTypeTestCase.php b/tests/Types/BaseDateTypeTestCase.php index eaf21fc5add..00fb2a72f36 100644 --- a/tests/Types/BaseDateTypeTestCase.php +++ b/tests/Types/BaseDateTypeTestCase.php @@ -86,9 +86,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 45c1bce6a89..c9869467b92 100644 --- a/tests/Types/BinaryTest.php +++ b/tests/Types/BinaryTest.php @@ -80,9 +80,7 @@ public function testThrowsConversionExceptionOnInvalidDatabaseValue($value): voi $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 b5e2e59d8ed..1a897487d2d 100644 --- a/tests/Types/ConversionExceptionTest.php +++ b/tests/Types/ConversionExceptionTest.php @@ -33,7 +33,7 @@ public function testConversionFailedInvalidTypeWithScalar($scalarValue, string $ self::assertInstanceOf(ConversionException::class, $exception); self::assertStringContainsString( $expected, - $exception->getMessage() + $exception->getMessage(), ); } @@ -50,7 +50,7 @@ public function testConversionFailedInvalidTypeWithNonScalar($nonScalar): void self::assertMatchesRegularExpression( '/^Could not convert PHP value of type (.*) to type foo. ' . 'Expected one of the following types: bar, baz$/', - $exception->getMessage() + $exception->getMessage(), ); } @@ -74,9 +74,7 @@ public function testConversionFailedFormatPreservesPreviousException(): void self::assertSame($previous, $exception->getPrevious()); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function nonScalarsProvider(): iterable { return [ @@ -86,9 +84,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 dd4772bbeb4..f21c2802b12 100644 --- a/tests/Types/DateImmutableTypeTest.php +++ b/tests/Types/DateImmutableTypeTest.php @@ -55,7 +55,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 732fac35fd5..7defde895f0 100644 --- a/tests/Types/DateIntervalTest.php +++ b/tests/Types/DateIntervalTest.php @@ -104,9 +104,7 @@ public function testInvalidTypeConversionToDatabaseValue($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 7e84743671d..ad9a1942953 100644 --- a/tests/Types/DateTest.php +++ b/tests/Types/DateTest.php @@ -22,7 +22,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 78f15997a9e..22ece587e5e 100644 --- a/tests/Types/DateTimeImmutableTypeTest.php +++ b/tests/Types/DateTimeImmutableTypeTest.php @@ -55,7 +55,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 2b21e65e2ce..b05b92f0fee 100644 --- a/tests/Types/DateTimeTzImmutableTypeTest.php +++ b/tests/Types/DateTimeTzImmutableTypeTest.php @@ -55,7 +55,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/JsonTest.php b/tests/Types/JsonTest.php index 8b350115524..5d7f837f0d3 100644 --- a/tests/Types/JsonTest.php +++ b/tests/Types/JsonTest.php @@ -75,9 +75,7 @@ public function testConversionFailure(string $data): void $this->type->convertToPHPValue($data, $this->platform); } - /** - * @return mixed[][] - */ + /** @return mixed[][] */ public static function providerFailure(): iterable { return [['a'], ['{']]; @@ -89,9 +87,9 @@ public function testJsonResourceConvertsToPHPValue(): void $databaseValue = fopen( 'data://text/plain;base64,' . base64_encode(json_encode( $value, - JSON_THROW_ON_ERROR | JSON_PRESERVE_ZERO_FRACTION + JSON_THROW_ON_ERROR | JSON_PRESERVE_ZERO_FRACTION, )), - 'r' + 'r', ); $phpValue = $this->type->convertToPHPValue($databaseValue, $this->platform); @@ -132,7 +130,7 @@ public function testSerializationFailure(): void $this->expectException(ConversionException::class); $this->expectExceptionMessage( 'Could not convert PHP type \'stdClass\' to \'json\', as an \'Recursion detected\' error' - . ' was triggered by the serialization' + . ' was triggered by the serialization', ); $this->type->convertToDatabaseValue($object, $this->platform); } diff --git a/tests/Types/ObjectTest.php b/tests/Types/ObjectTest.php index ae8c2a29f2b..54818ca8b70 100644 --- a/tests/Types/ObjectTest.php +++ b/tests/Types/ObjectTest.php @@ -39,7 +39,7 @@ public function testConversionFailure(): void $this->expectException(ConversionException::class); $this->expectExceptionMessage( "Could not convert database value to 'object' as an error was triggered by the unserialization:" - . " 'unserialize(): Error at offset 0 of 7 bytes'" + . " 'unserialize(): Error at offset 0 of 7 bytes'", ); $this->type->convertToPHPValue('abcdefg', $this->platform); } diff --git a/tests/Types/TimeImmutableTypeTest.php b/tests/Types/TimeImmutableTypeTest.php index 3f46cf0d8cb..3e67ed02169 100644 --- a/tests/Types/TimeImmutableTypeTest.php +++ b/tests/Types/TimeImmutableTypeTest.php @@ -55,7 +55,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 e7b83406136..c82966f4d76 100644 --- a/tests/Types/TypeRegistryTest.php +++ b/tests/Types/TypeRegistryTest.php @@ -45,7 +45,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), ); } @@ -53,11 +53,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(Exception::class); 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 8419ffd5b82..b481d0158d7 100644 --- a/tests/Types/VarDateTimeImmutableTypeTest.php +++ b/tests/Types/VarDateTimeImmutableTypeTest.php @@ -45,7 +45,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), ); } From ec507e2ed3efe874e0c102b07567e72852097478 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Sun, 28 Aug 2022 15:27:14 +0200 Subject: [PATCH 2/2] Manually fix issues with lines that are too long. --- src/Platforms/AbstractMySQLPlatform.php | 6 ++++-- src/Statement.php | 3 ++- tests/Functional/Schema/SchemaManagerFunctionalTestCase.php | 3 ++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Platforms/AbstractMySQLPlatform.php b/src/Platforms/AbstractMySQLPlatform.php index 814f4c46094..ac3ad79de24 100644 --- a/src/Platforms/AbstractMySQLPlatform.php +++ b/src/Platforms/AbstractMySQLPlatform.php @@ -440,7 +440,8 @@ public function getCreateTablesSQL(array $tables): array 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5414', 'Relying on the DBAL not generating DDL for foreign keys on MySQL engines' - . ' other than InnoDB is deprecated. Define foreign key constraints only if they are necessary.', + . ' other than InnoDB is deprecated.' + . ' Define foreign key constraints only if they are necessary.', ); } } @@ -497,7 +498,8 @@ protected function _getCreateTableSQL($name, array $columns, array $options = [] 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/5414', 'Relying on the DBAL not generating DDL for foreign keys on MySQL engines' - . ' other than InnoDB is deprecated. Define foreign key constraints only if they are necessary.', + . ' other than InnoDB is deprecated.' + . ' Define foreign key constraints only if they are necessary.', ); } } diff --git a/src/Statement.php b/src/Statement.php index d229fd98b0b..8ca438d4dcd 100644 --- a/src/Statement.php +++ b/src/Statement.php @@ -172,7 +172,8 @@ public function execute($params = null): Result Deprecation::triggerIfCalledFromOutside( 'doctrine/dbal', 'https://github.com/doctrine/dbal/pull/4580', - 'Statement::execute() is deprecated, use Statement::executeQuery() or Statement::executeStatement() instead', + '%s() is deprecated, use Statement::executeQuery() or Statement::executeStatement() instead', + __METHOD__, ); if ($params !== null) { diff --git a/tests/Functional/Schema/SchemaManagerFunctionalTestCase.php b/tests/Functional/Schema/SchemaManagerFunctionalTestCase.php index 76a8a4e0c93..f0cd26bf851 100644 --- a/tests/Functional/Schema/SchemaManagerFunctionalTestCase.php +++ b/tests/Functional/Schema/SchemaManagerFunctionalTestCase.php @@ -434,7 +434,8 @@ public function testDiffListTableColumns(callable $comparatorFactory): 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).', ); }