From 9853ad0c0ed2d5a3f12704c01c405fc820d06438 Mon Sep 17 00:00:00 2001 From: Michael Moravec Date: Sat, 9 Feb 2019 00:36:00 +0100 Subject: [PATCH] Enable strict types --- bin/doctrine-dbal.php | 2 + lib/Doctrine/DBAL/Cache/ArrayStatement.php | 2 + lib/Doctrine/DBAL/Cache/CacheException.php | 2 + lib/Doctrine/DBAL/Cache/QueryCacheProfile.php | 2 + .../DBAL/Cache/ResultCacheStatement.php | 2 + lib/Doctrine/DBAL/ColumnCase.php | 2 + lib/Doctrine/DBAL/Configuration.php | 2 + lib/Doctrine/DBAL/Connection.php | 2 + lib/Doctrine/DBAL/ConnectionException.php | 2 + .../Connections/MasterSlaveConnection.php | 2 + lib/Doctrine/DBAL/DBALException.php | 2 + lib/Doctrine/DBAL/Driver.php | 2 + .../DBAL/Driver/AbstractDB2Driver.php | 2 + .../DBAL/Driver/AbstractDriverException.php | 2 + .../DBAL/Driver/AbstractMySQLDriver.php | 2 + .../DBAL/Driver/AbstractOracleDriver.php | 2 + .../DBAL/Driver/AbstractPostgreSQLDriver.php | 2 + .../DBAL/Driver/AbstractSQLAnywhereDriver.php | 2 + .../DBAL/Driver/AbstractSQLServerDriver.php | 2 + .../DBAL/Driver/AbstractSQLiteDriver.php | 2 + lib/Doctrine/DBAL/Driver/Connection.php | 2 + lib/Doctrine/DBAL/Driver/DriverException.php | 2 + .../DBAL/Driver/ExceptionConverterDriver.php | 2 + .../DBAL/Driver/IBMDB2/DB2Connection.php | 2 + lib/Doctrine/DBAL/Driver/IBMDB2/DB2Driver.php | 2 + .../DBAL/Driver/IBMDB2/DB2Exception.php | 2 + .../DBAL/Driver/IBMDB2/DB2Statement.php | 2 + lib/Doctrine/DBAL/Driver/Mysqli/Driver.php | 2 + .../DBAL/Driver/Mysqli/MysqliConnection.php | 8 ++-- .../DBAL/Driver/Mysqli/MysqliException.php | 2 + .../DBAL/Driver/Mysqli/MysqliStatement.php | 2 + lib/Doctrine/DBAL/Driver/OCI8/Driver.php | 2 + .../DBAL/Driver/OCI8/OCI8Connection.php | 6 ++- .../DBAL/Driver/OCI8/OCI8Exception.php | 2 + .../DBAL/Driver/OCI8/OCI8Statement.php | 6 ++- lib/Doctrine/DBAL/Driver/PDOConnection.php | 2 + lib/Doctrine/DBAL/Driver/PDOException.php | 2 + lib/Doctrine/DBAL/Driver/PDOMySql/Driver.php | 2 + lib/Doctrine/DBAL/Driver/PDOOracle/Driver.php | 2 + lib/Doctrine/DBAL/Driver/PDOPgSql/Driver.php | 2 + lib/Doctrine/DBAL/Driver/PDOSqlite/Driver.php | 2 + .../DBAL/Driver/PDOSqlsrv/Connection.php | 2 + lib/Doctrine/DBAL/Driver/PDOSqlsrv/Driver.php | 2 + .../DBAL/Driver/PDOSqlsrv/Statement.php | 2 + lib/Doctrine/DBAL/Driver/PDOStatement.php | 12 ++++- .../DBAL/Driver/PingableConnection.php | 2 + lib/Doctrine/DBAL/Driver/ResultStatement.php | 2 + .../DBAL/Driver/SQLAnywhere/Driver.php | 2 + .../SQLAnywhere/SQLAnywhereConnection.php | 2 + .../SQLAnywhere/SQLAnywhereException.php | 2 + .../SQLAnywhere/SQLAnywhereStatement.php | 2 + lib/Doctrine/DBAL/Driver/SQLSrv/Driver.php | 2 + .../DBAL/Driver/SQLSrv/LastInsertId.php | 2 + .../DBAL/Driver/SQLSrv/SQLSrvConnection.php | 2 + .../DBAL/Driver/SQLSrv/SQLSrvException.php | 2 + .../DBAL/Driver/SQLSrv/SQLSrvStatement.php | 2 + .../DBAL/Driver/ServerInfoAwareConnection.php | 2 + lib/Doctrine/DBAL/Driver/Statement.php | 2 + .../DBAL/Driver/StatementIterator.php | 2 + lib/Doctrine/DBAL/DriverManager.php | 2 + .../DBAL/Event/ConnectionEventArgs.php | 2 + .../DBAL/Event/Listeners/MysqlSessionInit.php | 2 + .../Event/Listeners/OracleSessionInit.php | 2 + .../DBAL/Event/Listeners/SQLSessionInit.php | 2 + .../SchemaAlterTableAddColumnEventArgs.php | 2 + .../SchemaAlterTableChangeColumnEventArgs.php | 2 + .../DBAL/Event/SchemaAlterTableEventArgs.php | 2 + .../SchemaAlterTableRemoveColumnEventArgs.php | 2 + .../SchemaAlterTableRenameColumnEventArgs.php | 2 + .../Event/SchemaColumnDefinitionEventArgs.php | 2 + .../SchemaCreateTableColumnEventArgs.php | 2 + .../DBAL/Event/SchemaCreateTableEventArgs.php | 2 + .../DBAL/Event/SchemaDropTableEventArgs.php | 2 + lib/Doctrine/DBAL/Event/SchemaEventArgs.php | 2 + .../Event/SchemaIndexDefinitionEventArgs.php | 2 + lib/Doctrine/DBAL/Events.php | 2 + .../DBAL/Exception/ConnectionException.php | 2 + .../ConstraintViolationException.php | 2 + .../DatabaseObjectExistsException.php | 2 + .../DatabaseObjectNotFoundException.php | 2 + .../DBAL/Exception/DeadlockException.php | 2 + .../DBAL/Exception/DriverException.php | 2 + ...ForeignKeyConstraintViolationException.php | 2 + .../Exception/InvalidArgumentException.php | 2 + .../Exception/InvalidFieldNameException.php | 2 + .../Exception/LockWaitTimeoutException.php | 2 + .../Exception/NonUniqueFieldNameException.php | 2 + .../NotNullConstraintViolationException.php | 2 + .../DBAL/Exception/ReadOnlyException.php | 2 + .../DBAL/Exception/RetryableException.php | 2 + .../DBAL/Exception/ServerException.php | 2 + .../DBAL/Exception/SyntaxErrorException.php | 2 + .../DBAL/Exception/TableExistsException.php | 2 + .../DBAL/Exception/TableNotFoundException.php | 2 + .../UniqueConstraintViolationException.php | 2 + lib/Doctrine/DBAL/FetchMode.php | 2 + lib/Doctrine/DBAL/Id/TableGenerator.php | 2 + .../DBAL/Id/TableGeneratorSchemaVisitor.php | 2 + lib/Doctrine/DBAL/LockMode.php | 2 + lib/Doctrine/DBAL/Logging/DebugStack.php | 2 + lib/Doctrine/DBAL/Logging/EchoSQLLogger.php | 2 + lib/Doctrine/DBAL/Logging/LoggerChain.php | 2 + lib/Doctrine/DBAL/Logging/NullLogger.php | 2 + lib/Doctrine/DBAL/Logging/SQLLogger.php | 2 + lib/Doctrine/DBAL/ParameterType.php | 2 + .../DBAL/Platforms/AbstractPlatform.php | 2 + lib/Doctrine/DBAL/Platforms/DB2Platform.php | 2 + .../DBAL/Platforms/Keywords/DB2Keywords.php | 2 + .../DBAL/Platforms/Keywords/KeywordList.php | 2 + .../Platforms/Keywords/MariaDb102Keywords.php | 2 + .../Platforms/Keywords/MySQL57Keywords.php | 2 + .../Platforms/Keywords/MySQL80Keywords.php | 2 + .../DBAL/Platforms/Keywords/MySQLKeywords.php | 2 + .../Platforms/Keywords/OracleKeywords.php | 2 + .../Keywords/PostgreSQL94Keywords.php | 2 + .../Platforms/Keywords/PostgreSQLKeywords.php | 2 + .../Keywords/ReservedKeywordsValidator.php | 2 + .../Keywords/SQLAnywhereKeywords.php | 2 + .../Keywords/SQLServer2012Keywords.php | 2 + .../Platforms/Keywords/SQLServerKeywords.php | 2 + .../Platforms/Keywords/SQLiteKeywords.php | 2 + .../DBAL/Platforms/MariaDb1027Platform.php | 2 + .../DBAL/Platforms/MySQL57Platform.php | 2 + .../DBAL/Platforms/MySQL80Platform.php | 2 + lib/Doctrine/DBAL/Platforms/MySqlPlatform.php | 2 + .../DBAL/Platforms/OraclePlatform.php | 2 + .../DBAL/Platforms/PostgreSQL94Platform.php | 2 + .../DBAL/Platforms/PostgreSqlPlatform.php | 4 +- .../DBAL/Platforms/SQLAnywherePlatform.php | 2 + .../DBAL/Platforms/SQLAzurePlatform.php | 2 + .../DBAL/Platforms/SQLServer2012Platform.php | 2 + .../DBAL/Platforms/SQLServerPlatform.php | 2 + .../DBAL/Platforms/SqlitePlatform.php | 2 + lib/Doctrine/DBAL/Portability/Connection.php | 2 + lib/Doctrine/DBAL/Portability/Statement.php | 2 + .../Query/Expression/CompositeExpression.php | 2 + .../Query/Expression/ExpressionBuilder.php | 2 + lib/Doctrine/DBAL/Query/QueryBuilder.php | 2 + lib/Doctrine/DBAL/Query/QueryException.php | 2 + lib/Doctrine/DBAL/SQLParserUtils.php | 2 + lib/Doctrine/DBAL/SQLParserUtilsException.php | 2 + lib/Doctrine/DBAL/Schema/AbstractAsset.php | 4 +- .../DBAL/Schema/AbstractSchemaManager.php | 2 + lib/Doctrine/DBAL/Schema/Column.php | 2 + lib/Doctrine/DBAL/Schema/ColumnDiff.php | 2 + lib/Doctrine/DBAL/Schema/Comparator.php | 2 + lib/Doctrine/DBAL/Schema/Constraint.php | 2 + lib/Doctrine/DBAL/Schema/DB2SchemaManager.php | 2 + .../DBAL/Schema/ForeignKeyConstraint.php | 4 +- lib/Doctrine/DBAL/Schema/Identifier.php | 2 + lib/Doctrine/DBAL/Schema/Index.php | 6 ++- .../DBAL/Schema/MySqlSchemaManager.php | 2 + .../DBAL/Schema/OracleSchemaManager.php | 8 +++- .../DBAL/Schema/PostgreSqlSchemaManager.php | 15 ++++--- .../DBAL/Schema/SQLAnywhereSchemaManager.php | 2 + .../DBAL/Schema/SQLServerSchemaManager.php | 2 + lib/Doctrine/DBAL/Schema/Schema.php | 2 + lib/Doctrine/DBAL/Schema/SchemaConfig.php | 2 + lib/Doctrine/DBAL/Schema/SchemaDiff.php | 2 + lib/Doctrine/DBAL/Schema/SchemaException.php | 2 + lib/Doctrine/DBAL/Schema/Sequence.php | 2 + .../DBAL/Schema/SqliteSchemaManager.php | 2 + .../AbstractSchemaSynchronizer.php | 2 + .../Synchronizer/SchemaSynchronizer.php | 2 + .../SingleDatabaseSynchronizer.php | 2 + lib/Doctrine/DBAL/Schema/Table.php | 2 + lib/Doctrine/DBAL/Schema/TableDiff.php | 2 + lib/Doctrine/DBAL/Schema/UniqueConstraint.php | 2 + lib/Doctrine/DBAL/Schema/View.php | 2 + .../DBAL/Schema/Visitor/AbstractVisitor.php | 2 + .../Visitor/CreateSchemaSqlCollector.php | 2 + .../Schema/Visitor/DropSchemaSqlCollector.php | 2 + lib/Doctrine/DBAL/Schema/Visitor/Graphviz.php | 2 + .../DBAL/Schema/Visitor/NamespaceVisitor.php | 2 + .../Schema/Visitor/RemoveNamespacedAssets.php | 2 + .../DBAL/Schema/Visitor/SchemaDiffVisitor.php | 2 + lib/Doctrine/DBAL/Schema/Visitor/Visitor.php | 2 + .../DBAL/Sharding/PoolingShardConnection.php | 2 + .../DBAL/Sharding/PoolingShardManager.php | 2 + .../SQLAzureFederationsSynchronizer.php | 2 + .../SQLAzure/SQLAzureShardManager.php | 2 + .../SQLAzure/Schema/MultiTenantVisitor.php | 2 + .../ShardChoser/MultiTenantShardChoser.php | 2 + .../DBAL/Sharding/ShardChoser/ShardChoser.php | 2 + lib/Doctrine/DBAL/Sharding/ShardManager.php | 2 + .../DBAL/Sharding/ShardingException.php | 2 + lib/Doctrine/DBAL/Statement.php | 2 + .../Console/Command/ReservedWordsCommand.php | 2 + .../Tools/Console/Command/RunSqlCommand.php | 2 + .../DBAL/Tools/Console/ConsoleRunner.php | 2 + .../Tools/Console/Helper/ConnectionHelper.php | 2 + lib/Doctrine/DBAL/Tools/Dumper.php | 8 ++-- lib/Doctrine/DBAL/Types/ArrayType.php | 2 + lib/Doctrine/DBAL/Types/BigIntType.php | 2 + lib/Doctrine/DBAL/Types/BinaryType.php | 2 + lib/Doctrine/DBAL/Types/BlobType.php | 2 + lib/Doctrine/DBAL/Types/BooleanType.php | 2 + .../DBAL/Types/ConversionException.php | 11 +++-- lib/Doctrine/DBAL/Types/DateImmutableType.php | 2 + lib/Doctrine/DBAL/Types/DateIntervalType.php | 2 + .../DBAL/Types/DateTimeImmutableType.php | 2 + lib/Doctrine/DBAL/Types/DateTimeType.php | 2 + .../DBAL/Types/DateTimeTzImmutableType.php | 2 + lib/Doctrine/DBAL/Types/DateTimeTzType.php | 2 + lib/Doctrine/DBAL/Types/DateType.php | 2 + lib/Doctrine/DBAL/Types/DecimalType.php | 2 + lib/Doctrine/DBAL/Types/FloatType.php | 2 + lib/Doctrine/DBAL/Types/GuidType.php | 2 + lib/Doctrine/DBAL/Types/IntegerType.php | 2 + lib/Doctrine/DBAL/Types/JsonArrayType.php | 2 + lib/Doctrine/DBAL/Types/JsonType.php | 2 + lib/Doctrine/DBAL/Types/ObjectType.php | 2 + .../DBAL/Types/PhpDateTimeMappingType.php | 2 + .../DBAL/Types/PhpIntegerMappingType.php | 2 + lib/Doctrine/DBAL/Types/SimpleArrayType.php | 2 + lib/Doctrine/DBAL/Types/SmallIntType.php | 2 + lib/Doctrine/DBAL/Types/StringType.php | 2 + lib/Doctrine/DBAL/Types/TextType.php | 2 + lib/Doctrine/DBAL/Types/TimeImmutableType.php | 2 + lib/Doctrine/DBAL/Types/TimeType.php | 2 + lib/Doctrine/DBAL/Types/Type.php | 2 + .../DBAL/Types/VarDateTimeImmutableType.php | 2 + lib/Doctrine/DBAL/Types/VarDateTimeType.php | 2 + .../DBAL/VersionAwarePlatformDriver.php | 2 + phpcs.xml.dist | 7 ++- .../DBAL/Cache/QueryCacheProfileTest.php | 2 + .../Doctrine/Tests/DBAL/ConfigurationTest.php | 2 + tests/Doctrine/Tests/DBAL/ConnectionTest.php | 2 + .../Doctrine/Tests/DBAL/DBALExceptionTest.php | 2 + .../DBAL/Driver/AbstractDB2DriverTest.php | 2 + .../Tests/DBAL/Driver/AbstractDriverTest.php | 4 +- .../DBAL/Driver/AbstractMySQLDriverTest.php | 2 + .../EasyConnectStringTest.php | 2 + .../DBAL/Driver/AbstractOracleDriverTest.php | 2 + .../Driver/AbstractPostgreSQLDriverTest.php | 2 + .../Driver/AbstractSQLAnywhereDriverTest.php | 2 + .../Driver/AbstractSQLServerDriverTest.php | 2 + .../DBAL/Driver/AbstractSQLiteDriverTest.php | 2 + .../DBAL/Driver/IBMDB2/DB2ConnectionTest.php | 2 + .../DBAL/Driver/IBMDB2/DB2DriverTest.php | 2 + .../Tests/DBAL/Driver/Mysqli/DriverTest.php | 2 + .../Driver/Mysqli/MysqliConnectionTest.php | 2 + .../Tests/DBAL/Driver/OCI8/DriverTest.php | 2 + .../DBAL/Driver/OCI8/OCI8ConnectionTest.php | 2 + .../DBAL/Driver/OCI8/OCI8StatementTest.php | 17 +++++-- .../Tests/DBAL/Driver/PDOExceptionTest.php | 2 + .../Tests/DBAL/Driver/PDOMySql/DriverTest.php | 2 + .../DBAL/Driver/PDOOracle/DriverTest.php | 2 + .../Tests/DBAL/Driver/PDOPgSql/DriverTest.php | 2 + .../DBAL/Driver/PDOSqlite/DriverTest.php | 2 + .../DBAL/Driver/PDOSqlsrv/DriverTest.php | 2 + .../DBAL/Driver/SQLAnywhere/DriverTest.php | 2 + .../SQLAnywhere/SQLAnywhereConnectionTest.php | 2 + .../Tests/DBAL/Driver/SQLSrv/DriverTest.php | 2 + .../Driver/SQLSrv/SQLSrvConnectionTest.php | 2 + .../DBAL/Driver/StatementIteratorTest.php | 2 + .../Doctrine/Tests/DBAL/DriverManagerTest.php | 2 + .../DBAL/Events/MysqlSessionInitTest.php | 2 + .../DBAL/Events/OracleSessionInitTest.php | 2 + .../Tests/DBAL/Events/SQLSessionInitTest.php | 2 + .../InvalidArgumentExceptionTest.php | 2 + .../Tests/DBAL/Functional/BlobTest.php | 2 + .../Tests/DBAL/Functional/ConnectionTest.php | 2 + .../Tests/DBAL/Functional/DataAccessTest.php | 10 +++-- .../Functional/Driver/AbstractDriverTest.php | 2 + .../Driver/IBMDB2/DB2DriverTest.php | 2 + .../Driver/Mysqli/ConnectionTest.php | 4 +- .../Functional/Driver/Mysqli/DriverTest.php | 2 + .../Functional/Driver/OCI8/DriverTest.php | 2 + .../Driver/OCI8/OCI8ConnectionTest.php | 2 + .../Functional/Driver/OCI8/StatementTest.php | 2 + .../Functional/Driver/PDOConnectionTest.php | 2 + .../Functional/Driver/PDOMySql/DriverTest.php | 2 + .../Driver/PDOOracle/DriverTest.php | 2 + .../Functional/Driver/PDOPgSql/DriverTest.php | 2 + .../Driver/PDOPgsqlConnectionTest.php | 2 + .../Driver/PDOSqlite/DriverTest.php | 2 + .../Driver/PDOSqlsrv/DriverTest.php | 2 + .../Driver/SQLAnywhere/ConnectionTest.php | 2 + .../Driver/SQLAnywhere/DriverTest.php | 2 + .../Driver/SQLAnywhere/StatementTest.php | 2 + .../Functional/Driver/SQLSrv/DriverTest.php | 2 + .../Driver/SQLSrv/StatementTest.php | 2 + .../Tests/DBAL/Functional/ExceptionTest.php | 2 + .../Functional/LikeWildcardsEscapingTest.php | 2 + .../Tests/DBAL/Functional/LoggingTest.php | 2 + .../Functional/MasterSlaveConnectionTest.php | 2 + .../DBAL/Functional/ModifyLimitQueryTest.php | 2 + .../DBAL/Functional/NamedParametersTest.php | 2 + .../DBAL/Functional/PDOStatementTest.php | 2 + .../Platform/DateExpressionTest.php | 2 + ...imaryKeyWithNewAutoIncrementColumnTest.php | 2 + .../DBAL/Functional/Platform/QuotingTest.php | 2 + .../Tests/DBAL/Functional/PortabilityTest.php | 2 + .../Tests/DBAL/Functional/ResultCacheTest.php | 2 + .../Schema/Db2SchemaManagerTest.php | 2 + .../Schema/MySqlSchemaManagerTest.php | 2 + .../Schema/OracleSchemaManagerTest.php | 2 + .../Schema/PostgreSqlSchemaManagerTest.php | 4 +- .../Schema/SQLAnywhereSchemaManagerTest.php | 2 + .../Schema/SQLServerSchemaManagerTest.php | 2 + .../SchemaManagerFunctionalTestCase.php | 2 + .../Schema/SqliteSchemaManagerTest.php | 4 +- .../Tests/DBAL/Functional/StatementTest.php | 4 +- .../DBAL/Functional/TableGeneratorTest.php | 2 + .../DBAL/Functional/TemporaryTableTest.php | 2 + .../DBAL/Functional/Ticket/DBAL168Test.php | 2 + .../DBAL/Functional/Ticket/DBAL202Test.php | 2 + .../DBAL/Functional/Ticket/DBAL461Test.php | 2 + .../DBAL/Functional/Ticket/DBAL510Test.php | 2 + .../DBAL/Functional/Ticket/DBAL630Test.php | 2 + .../DBAL/Functional/Ticket/DBAL752Test.php | 2 + .../DBAL/Functional/TypeConversionTest.php | 2 + .../Tests/DBAL/Functional/WriteTest.php | 2 + .../Tests/DBAL/Logging/DebugStackTest.php | 2 + .../TypeConversionPerformanceTest.php | 2 + .../AbstractMySQLPlatformTestCase.php | 2 + .../Platforms/AbstractPlatformTestCase.php | 14 +++--- .../AbstractPostgreSqlPlatformTestCase.php | 6 ++- .../AbstractSQLServerPlatformTestCase.php | 2 + .../Tests/DBAL/Platforms/DB2PlatformTest.php | 41 ++++++++--------- .../Platforms/MariaDb1027PlatformTest.php | 2 + .../DBAL/Platforms/MySQL57PlatformTest.php | 2 + .../DBAL/Platforms/MySqlPlatformTest.php | 2 + .../DBAL/Platforms/OraclePlatformTest.php | 2 + .../Platforms/PostgreSQL94PlatformTest.php | 2 + .../DBAL/Platforms/PostgreSqlPlatformTest.php | 2 + .../ReservedKeywordsValidatorTest.php | 2 + .../Platforms/SQLAnywherePlatformTest.php | 45 ++++++++++--------- .../DBAL/Platforms/SQLAzurePlatformTest.php | 2 + .../Platforms/SQLServer2012PlatformTest.php | 2 + .../DBAL/Platforms/SQLServerPlatformTest.php | 2 + .../DBAL/Platforms/SqlitePlatformTest.php | 8 ++-- .../Tests/DBAL/Portability/StatementTest.php | 2 + .../Expression/CompositeExpressionTest.php | 2 + .../Expression/ExpressionBuilderTest.php | 2 + .../Tests/DBAL/Query/QueryBuilderTest.php | 2 + .../Tests/DBAL/SQLParserUtilsTest.php | 2 + .../Tests/DBAL/Schema/ColumnDiffTest.php | 2 + .../Doctrine/Tests/DBAL/Schema/ColumnTest.php | 2 + .../Tests/DBAL/Schema/ComparatorTest.php | 2 + .../DBAL/Schema/DB2SchemaManagerTest.php | 2 + .../DBAL/Schema/ForeignKeyConstraintTest.php | 2 + .../Doctrine/Tests/DBAL/Schema/IndexTest.php | 2 + .../DBAL/Schema/MySqlSchemaManagerTest.php | 2 + .../DBAL/Schema/Platforms/MySQLSchemaTest.php | 2 + .../Tests/DBAL/Schema/SchemaDiffTest.php | 2 + .../Doctrine/Tests/DBAL/Schema/SchemaTest.php | 2 + .../Tests/DBAL/Schema/SequenceTest.php | 2 + .../DBAL/Schema/SqliteSchemaManagerTest.php | 2 + .../SingleDatabaseSynchronizerTest.php | 2 + .../Tests/DBAL/Schema/TableDiffTest.php | 2 + .../Doctrine/Tests/DBAL/Schema/TableTest.php | 2 + .../Visitor/CreateSchemaSqlCollectorTest.php | 2 + .../Visitor/DropSchemaSqlCollectorTest.php | 2 + .../Visitor/RemoveNamespacedAssetsTest.php | 2 + .../Schema/Visitor/SchemaSqlCollectorTest.php | 2 + .../Sharding/PoolingShardConnectionTest.php | 2 + .../DBAL/Sharding/PoolingShardManagerTest.php | 2 + .../Sharding/SQLAzure/AbstractTestCase.php | 2 + .../DBAL/Sharding/SQLAzure/FunctionalTest.php | 2 + .../SQLAzure/MultiTenantVisitorTest.php | 2 + .../SQLAzureFederationsSynchronizerTest.php | 2 + .../SQLAzure/SQLAzureShardManagerTest.php | 2 + .../MultiTenantShardChoserTest.php | 2 + tests/Doctrine/Tests/DBAL/StatementTest.php | 2 + .../DBAL/Tools/Console/RunSqlCommandTest.php | 2 + .../Doctrine/Tests/DBAL/Tools/DumperTest.php | 2 + .../Tests/DBAL/Tools/TestAsset/ChildClass.php | 2 + .../ChildWithSameAttributesClass.php | 2 + .../DBAL/Tools/TestAsset/ParentClass.php | 2 + tests/Doctrine/Tests/DBAL/Types/ArrayTest.php | 2 + .../Tests/DBAL/Types/BaseDateTypeTestCase.php | 2 + .../Doctrine/Tests/DBAL/Types/BinaryTest.php | 2 + tests/Doctrine/Tests/DBAL/Types/BlobTest.php | 2 + .../Doctrine/Tests/DBAL/Types/BooleanTest.php | 2 + .../DBAL/Types/ConversionExceptionTest.php | 2 + .../DBAL/Types/DateImmutableTypeTest.php | 2 + .../Tests/DBAL/Types/DateIntervalTest.php | 2 + tests/Doctrine/Tests/DBAL/Types/DateTest.php | 2 + .../DBAL/Types/DateTimeImmutableTypeTest.php | 4 ++ .../Tests/DBAL/Types/DateTimeTest.php | 2 + .../Types/DateTimeTzImmutableTypeTest.php | 4 ++ .../Tests/DBAL/Types/DateTimeTzTest.php | 2 + .../Doctrine/Tests/DBAL/Types/DecimalTest.php | 2 + tests/Doctrine/Tests/DBAL/Types/FloatTest.php | 2 + .../Tests/DBAL/Types/GuidTypeTest.php | 2 + .../Doctrine/Tests/DBAL/Types/IntegerTest.php | 2 + .../Tests/DBAL/Types/JsonArrayTest.php | 2 + tests/Doctrine/Tests/DBAL/Types/JsonTest.php | 2 + .../Doctrine/Tests/DBAL/Types/ObjectTest.php | 2 + .../Tests/DBAL/Types/SmallIntTest.php | 2 + .../Doctrine/Tests/DBAL/Types/StringTest.php | 2 + .../DBAL/Types/TimeImmutableTypeTest.php | 2 + tests/Doctrine/Tests/DBAL/Types/TimeTest.php | 2 + .../Types/VarDateTimeImmutableTypeTest.php | 2 + .../Tests/DBAL/Types/VarDateTimeTest.php | 8 +++- tests/Doctrine/Tests/DBAL/UtilTest.php | 2 + .../Doctrine/Tests/DbalFunctionalTestCase.php | 2 + .../Tests/DbalPerformanceTestCase.php | 2 + .../Tests/DbalPerformanceTestListener.php | 2 + tests/Doctrine/Tests/DbalTestCase.php | 2 + .../Tests/Mocks/DriverResultStatementMock.php | 2 + .../Tests/Mocks/DriverStatementMock.php | 2 + .../Mocks/ServerInfoAwareConnectionMock.php | 2 + .../Mocks/VersionAwarePlatformDriverMock.php | 2 + tests/Doctrine/Tests/TestUtil.php | 6 ++- tests/Doctrine/Tests/Types/CommentedType.php | 2 + tests/Doctrine/Tests/Types/MySqlPointType.php | 2 + 409 files changed, 945 insertions(+), 97 deletions(-) diff --git a/bin/doctrine-dbal.php b/bin/doctrine-dbal.php index f3e064ffd62..76bed1a6701 100644 --- a/bin/doctrine-dbal.php +++ b/bin/doctrine-dbal.php @@ -1,5 +1,7 @@ conn = mysqli_init(); diff --git a/lib/Doctrine/DBAL/Driver/Mysqli/MysqliException.php b/lib/Doctrine/DBAL/Driver/Mysqli/MysqliException.php index 1fa0c900fbd..b779bc40457 100644 --- a/lib/Doctrine/DBAL/Driver/Mysqli/MysqliException.php +++ b/lib/Doctrine/DBAL/Driver/Mysqli/MysqliException.php @@ -1,5 +1,7 @@ dbh)) { - throw OCI8Exception::fromErrorInfo($this->errorInfo()); + throw OCI8Exception::fromErrorInfo(oci_error($this->dbh)); } $this->executeMode = OCI_COMMIT_ON_SUCCESS; @@ -192,7 +194,7 @@ public function commit() : void public function rollBack() : void { if (! oci_rollback($this->dbh)) { - throw OCI8Exception::fromErrorInfo($this->errorInfo()); + throw OCI8Exception::fromErrorInfo(oci_error($this->dbh)); } $this->executeMode = OCI_COMMIT_ON_SUCCESS; diff --git a/lib/Doctrine/DBAL/Driver/OCI8/OCI8Exception.php b/lib/Doctrine/DBAL/Driver/OCI8/OCI8Exception.php index af3a9d1a7a9..bdb64347a6a 100644 --- a/lib/Doctrine/DBAL/Driver/OCI8/OCI8Exception.php +++ b/lib/Doctrine/DBAL/Driver/OCI8/OCI8Exception.php @@ -1,5 +1,7 @@ convertParameterType($type) )) { - throw OCI8Exception::fromErrorInfo($this->errorInfo()); + throw OCI8Exception::fromErrorInfo(oci_error($this->_sth)); } } @@ -388,7 +390,7 @@ public function execute($params = null) : void $ret = @oci_execute($this->_sth, $this->_conn->getExecuteMode()); if (! $ret) { - throw OCI8Exception::fromErrorInfo($this->errorInfo()); + throw OCI8Exception::fromErrorInfo(oci_error($this->_sth)); } $this->result = true; diff --git a/lib/Doctrine/DBAL/Driver/PDOConnection.php b/lib/Doctrine/DBAL/Driver/PDOConnection.php index d9cbb681c8c..bc9128e1eb3 100644 --- a/lib/Doctrine/DBAL/Driver/PDOConnection.php +++ b/lib/Doctrine/DBAL/Driver/PDOConnection.php @@ -1,5 +1,7 @@ convertParamType($type); + $type = $this->convertParamType($type); + $extraParameters = array_slice(func_get_args(), 3); + + if (count($extraParameters) !== 0) { + $extraParameters[0] = $extraParameters[0] ?? 0; + } try { - $this->stmt->bindParam($column, $variable, $type, ...array_slice(func_get_args(), 3)); + $this->stmt->bindParam($column, $variable, $type, ...$extraParameters); } catch (\PDOException $exception) { throw new PDOException($exception); } diff --git a/lib/Doctrine/DBAL/Driver/PingableConnection.php b/lib/Doctrine/DBAL/Driver/PingableConnection.php index 06bfb9a7f26..93e6168013e 100644 --- a/lib/Doctrine/DBAL/Driver/PingableConnection.php +++ b/lib/Doctrine/DBAL/Driver/PingableConnection.php @@ -1,5 +1,7 @@ booleanLiterals['false'], true)) { + if (in_array($item, $this->booleanLiterals['false'], true)) { return false; } diff --git a/lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php b/lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php index 36714143b85..691d72ea908 100644 --- a/lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php +++ b/lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php @@ -1,5 +1,7 @@ _namespace . '.' . $this->_name; } - return $this->_name; + return $this->_name ?? ''; } /** diff --git a/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php b/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php index 46fbff6da30..a3edcdb2206 100644 --- a/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php +++ b/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php @@ -1,5 +1,7 @@ _setName($indexName); + if ($indexName !== null) { + $this->_setName($indexName); + } $this->_isUnique = $isUnique; $this->_isPrimary = $isPrimary; diff --git a/lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php b/lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php index b39db01ffaa..ba140a6b4d7 100644 --- a/lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php +++ b/lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php @@ -1,5 +1,7 @@ _platform->hasDoctrineTypeMappingFor($tableColumn['type'])) { + if ($tableColumn['domain_type'] !== null + && strlen($tableColumn['domain_type']) + && ! $this->_platform->hasDoctrineTypeMappingFor($tableColumn['type']) + ) { $dbType = strtolower($tableColumn['domain_type']); $tableColumn['complete_type'] = $tableColumn['domain_complete_type']; } @@ -472,7 +477,7 @@ protected function _getPortableTableColumnDefinition($tableColumn) */ private function fixVersion94NegativeNumericDefaultValue($defaultValue) { - if (strpos($defaultValue, '(') === 0) { + if ($defaultValue !== null && strpos($defaultValue, '(') === 0) { return trim($defaultValue, '()'); } diff --git a/lib/Doctrine/DBAL/Schema/SQLAnywhereSchemaManager.php b/lib/Doctrine/DBAL/Schema/SQLAnywhereSchemaManager.php index 0d875491167..b99d68429e0 100644 --- a/lib/Doctrine/DBAL/Schema/SQLAnywhereSchemaManager.php +++ b/lib/Doctrine/DBAL/Schema/SQLAnywhereSchemaManager.php @@ -1,5 +1,7 @@ 32 ? substr($value, 0, 20) . '...' : $value; + $value = is_string($value) && strlen($value) > 32 ? substr($value, 0, 20) . '...' : $value; return new self('Could not convert database value "' . $value . '" to Doctrine Type ' . $toType); } @@ -37,7 +40,7 @@ public static function conversionFailed($value, $toType) * Thrown when a Database to Doctrine Type Conversion fails and we can make a statement * about the expected format. * - * @param string $value + * @param mixed $value * @param string $toType * @param string $expectedFormat * @@ -45,7 +48,7 @@ public static function conversionFailed($value, $toType) */ public static function conversionFailedFormat($value, $toType, $expectedFormat, ?Throwable $previous = null) { - $value = strlen($value) > 32 ? substr($value, 0, 20) . '...' : $value; + $value = is_string($value) && strlen($value) > 32 ? substr($value, 0, 20) . '...' : $value; return new self( 'Could not convert database value "' . $value . '" to Doctrine Type ' . diff --git a/lib/Doctrine/DBAL/Types/DateImmutableType.php b/lib/Doctrine/DBAL/Types/DateImmutableType.php index 196fc88c7b4..66648417a3c 100644 --- a/lib/Doctrine/DBAL/Types/DateImmutableType.php +++ b/lib/Doctrine/DBAL/Types/DateImmutableType.php @@ -1,5 +1,7 @@ tests - @@ -65,4 +64,10 @@ lib/Doctrine/DBAL/Schema/Comparator.php + + + + lib/Doctrine/DBAL/Driver/IBMDB2/DB2Connection.php + diff --git a/tests/Doctrine/Tests/DBAL/Cache/QueryCacheProfileTest.php b/tests/Doctrine/Tests/DBAL/Cache/QueryCacheProfileTest.php index 2a8fe528c9d..6722f68c372 100644 --- a/tests/Doctrine/Tests/DBAL/Cache/QueryCacheProfileTest.php +++ b/tests/Doctrine/Tests/DBAL/Cache/QueryCacheProfileTest.php @@ -1,5 +1,7 @@ errorCode = $errorCode; $this->sqlState = $sqlState; diff --git a/tests/Doctrine/Tests/DBAL/Driver/AbstractMySQLDriverTest.php b/tests/Doctrine/Tests/DBAL/Driver/AbstractMySQLDriverTest.php index cde381653a9..81140b97754 100644 --- a/tests/Doctrine/Tests/DBAL/Driver/AbstractMySQLDriverTest.php +++ b/tests/Doctrine/Tests/DBAL/Driver/AbstractMySQLDriverTest.php @@ -1,5 +1,7 @@ disableOriginalConstructor() ->getMock(); $conn->expects($this->once()) - ->method('getExecuteMode'); + ->method('getExecuteMode') + ->willReturn(OCI_NO_AUTO_COMMIT); + + $connectionReflection = new ReflectionProperty($statement, '_conn'); + $connectionReflection->setAccessible(true); + $connectionReflection->setValue($statement, $conn); - $reflProperty = new ReflectionProperty($statement, '_conn'); - $reflProperty->setAccessible(true); - $reflProperty->setValue($statement, $conn); + $handleReflection = new ReflectionProperty($statement, '_sth'); + $handleReflection->setAccessible(true); + $handleReflection->setValue($statement, fopen('php://temp', 'r')); $this->expectException(OCI8Exception::class); $statement->execute($params); diff --git a/tests/Doctrine/Tests/DBAL/Driver/PDOExceptionTest.php b/tests/Doctrine/Tests/DBAL/Driver/PDOExceptionTest.php index c7564470252..08b69ee253d 100644 --- a/tests/Doctrine/Tests/DBAL/Driver/PDOExceptionTest.php +++ b/tests/Doctrine/Tests/DBAL/Driver/PDOExceptionTest.php @@ -1,5 +1,7 @@ getLocateExpression("'foo'", 'test_string') . ' AS locate5, '; $sql .= $platform->getLocateExpression("'barfoobaz'", 'test_string') . ' AS locate6, '; $sql .= $platform->getLocateExpression("'bar'", 'test_string') . ' AS locate7, '; - $sql .= $platform->getLocateExpression('test_string', "'oo'", 2) . ' AS locate8, '; - $sql .= $platform->getLocateExpression('test_string', "'oo'", 3) . ' AS locate9 '; + $sql .= $platform->getLocateExpression('test_string', "'oo'", '2') . ' AS locate8, '; + $sql .= $platform->getLocateExpression('test_string', "'oo'", '3') . ' AS locate9 '; $sql .= 'FROM fetch_table'; $row = $this->connection->fetchAssoc($sql); @@ -995,8 +997,8 @@ public function testBitComparisonExpressionSupport() $sql[] = 'SELECT '; $sql[] = 'test_int, '; $sql[] = 'test_string, '; - $sql[] = $platform->getBitOrComparisonExpression('test_int', 2) . ' AS bit_or, '; - $sql[] = $platform->getBitAndComparisonExpression('test_int', 2) . ' AS bit_and '; + $sql[] = $platform->getBitOrComparisonExpression('test_int', '2') . ' AS bit_or, '; + $sql[] = $platform->getBitAndComparisonExpression('test_int', '2') . ' AS bit_and '; $sql[] = 'FROM fetch_table'; $stmt = $this->connection->executeQuery(implode(PHP_EOL, $sql)); diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/AbstractDriverTest.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/AbstractDriverTest.php index 2e145ca6c04..0770cf7f5ae 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Driver/AbstractDriverTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/AbstractDriverTest.php @@ -1,5 +1,7 @@ $GLOBALS['db_host'], 'dbname' => $GLOBALS['db_name'], - 'port' => $GLOBALS['db_port'], + 'port' => (int) $GLOBALS['db_port'], ], $GLOBALS['db_username'], $GLOBALS['db_password'], diff --git a/tests/Doctrine/Tests/DBAL/Functional/Driver/Mysqli/DriverTest.php b/tests/Doctrine/Tests/DBAL/Functional/Driver/Mysqli/DriverTest.php index a7b7338beed..ca0f5fd49c7 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Driver/Mysqli/DriverTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Driver/Mysqli/DriverTest.php @@ -1,5 +1,7 @@ schemaManager->listTableColumns('test_jsonb'); self::assertSame($type, $columns['foo']->getType()->getName()); - self::assertTrue(true, $columns['foo']->getPlatformOption('jsonb')); + self::assertTrue($columns['foo']->getPlatformOption('jsonb')); } /** diff --git a/tests/Doctrine/Tests/DBAL/Functional/Schema/SQLAnywhereSchemaManagerTest.php b/tests/Doctrine/Tests/DBAL/Functional/Schema/SQLAnywhereSchemaManagerTest.php index 73eb07ea178..b70a3d6cce4 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Schema/SQLAnywhereSchemaManagerTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Schema/SQLAnywhereSchemaManagerTest.php @@ -1,5 +1,7 @@ 'SET NULL', 'onDelete' => 'NO ACTION', 'deferrable' => false, 'deferred' => false] ), diff --git a/tests/Doctrine/Tests/DBAL/Functional/StatementTest.php b/tests/Doctrine/Tests/DBAL/Functional/StatementTest.php index 23119f734f0..58bd96db631 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/StatementTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/StatementTest.php @@ -1,5 +1,7 @@ iniSet('error_reporting', 0); + $this->iniSet('error_reporting', '0'); self::expectException(DBALException::class); $stmt->execute([null]); diff --git a/tests/Doctrine/Tests/DBAL/Functional/TableGeneratorTest.php b/tests/Doctrine/Tests/DBAL/Functional/TableGeneratorTest.php index a6721b88f8d..7897572e84c 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/TableGeneratorTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/TableGeneratorTest.php @@ -1,5 +1,7 @@ platform->getBitAndComparisonExpression(2, 4); - self::assertEquals($this->getBitAndComparisonExpressionSql(2, 4), $sql); + $sql = $this->platform->getBitAndComparisonExpression('2', '4'); + self::assertEquals($this->getBitAndComparisonExpressionSql('2', '4'), $sql); } - protected function getBitOrComparisonExpressionSql($value1, $value2) + protected function getBitOrComparisonExpressionSql(string $value1, string $value2) { return '(' . $value1 . ' | ' . $value2 . ')'; } @@ -297,8 +299,8 @@ protected function getBitOrComparisonExpressionSql($value1, $value2) */ public function testGeneratesBitOrComparisonExpressionSql() { - $sql = $this->platform->getBitOrComparisonExpression(2, 4); - self::assertEquals($this->getBitOrComparisonExpressionSql(2, 4), $sql); + $sql = $this->platform->getBitOrComparisonExpression('2', '4'); + self::assertEquals($this->getBitOrComparisonExpressionSql('2', '4'), $sql); } public function getGenerateConstraintUniqueIndexSql() diff --git a/tests/Doctrine/Tests/DBAL/Platforms/AbstractPostgreSqlPlatformTestCase.php b/tests/Doctrine/Tests/DBAL/Platforms/AbstractPostgreSqlPlatformTestCase.php index 81d760e30b6..ed31a21fffc 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/AbstractPostgreSqlPlatformTestCase.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/AbstractPostgreSqlPlatformTestCase.php @@ -1,5 +1,7 @@ platform->getRegexpExpression(), 'Regular expression operator is not correct'); self::assertEquals('"', $this->platform->getIdentifierQuoteCharacter(), 'Identifier quote character is not correct'); self::assertEquals('column1 || column2 || column3', $this->platform->getConcatExpression('column1', 'column2', 'column3'), 'Concatenation expression is not correct'); - self::assertEquals('SUBSTRING(column FROM 5)', $this->platform->getSubstringExpression('column', 5), 'Substring expression without length is not correct'); - self::assertEquals('SUBSTRING(column FROM 1 FOR 5)', $this->platform->getSubstringExpression('column', 1, 5), 'Substring expression with length is not correct'); + self::assertEquals('SUBSTRING(column FROM 5)', $this->platform->getSubstringExpression('column', '5'), 'Substring expression without length is not correct'); + self::assertEquals('SUBSTRING(column FROM 1 FOR 5)', $this->platform->getSubstringExpression('column', '1', '5'), 'Substring expression with length is not correct'); } public function testGeneratesTransactionCommands() diff --git a/tests/Doctrine/Tests/DBAL/Platforms/AbstractSQLServerPlatformTestCase.php b/tests/Doctrine/Tests/DBAL/Platforms/AbstractSQLServerPlatformTestCase.php index f06834913eb..214fc45e42e 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/AbstractSQLServerPlatformTestCase.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/AbstractSQLServerPlatformTestCase.php @@ -1,5 +1,7 @@ platform->getDropDatabaseSQL('foobar')); self::assertEquals('DECLARE GLOBAL TEMPORARY TABLE', $this->platform->getCreateTemporaryTableSnippetSQL()); self::assertEquals('TRUNCATE foobar IMMEDIATE', $this->platform->getTruncateTableSQL('foobar')); - self::assertEquals('TRUNCATE foobar IMMEDIATE', $this->platform->getTruncateTableSQL('foobar'), true); $viewSql = 'SELECT * FROM footable'; self::assertEquals('CREATE VIEW fooview AS ' . $viewSql, $this->platform->getCreateViewSQL('fooview', $viewSql)); @@ -313,28 +314,28 @@ public function testGeneratesSQLSnippets() self::assertEquals('CURRENT DATE', $this->platform->getCurrentDateSQL()); self::assertEquals('CURRENT TIME', $this->platform->getCurrentTimeSQL()); self::assertEquals('CURRENT TIMESTAMP', $this->platform->getCurrentTimestampSQL()); - self::assertEquals("'1987/05/02' + 4 DAY", $this->platform->getDateAddDaysExpression("'1987/05/02'", 4)); - self::assertEquals("'1987/05/02' + 12 HOUR", $this->platform->getDateAddHourExpression("'1987/05/02'", 12)); - self::assertEquals("'1987/05/02' + 2 MINUTE", $this->platform->getDateAddMinutesExpression("'1987/05/02'", 2)); - self::assertEquals("'1987/05/02' + 102 MONTH", $this->platform->getDateAddMonthExpression("'1987/05/02'", 102)); - self::assertEquals("'1987/05/02' + (5 * 3) MONTH", $this->platform->getDateAddQuartersExpression("'1987/05/02'", 5)); - self::assertEquals("'1987/05/02' + 1 SECOND", $this->platform->getDateAddSecondsExpression("'1987/05/02'", 1)); - self::assertEquals("'1987/05/02' + (3 * 7) DAY", $this->platform->getDateAddWeeksExpression("'1987/05/02'", 3)); - self::assertEquals("'1987/05/02' + 10 YEAR", $this->platform->getDateAddYearsExpression("'1987/05/02'", 10)); + self::assertEquals("'1987/05/02' + 4 DAY", $this->platform->getDateAddDaysExpression("'1987/05/02'", '4')); + self::assertEquals("'1987/05/02' + 12 HOUR", $this->platform->getDateAddHourExpression("'1987/05/02'", '12')); + self::assertEquals("'1987/05/02' + 2 MINUTE", $this->platform->getDateAddMinutesExpression("'1987/05/02'", '2')); + self::assertEquals("'1987/05/02' + 102 MONTH", $this->platform->getDateAddMonthExpression("'1987/05/02'", '102')); + self::assertEquals("'1987/05/02' + (5 * 3) MONTH", $this->platform->getDateAddQuartersExpression("'1987/05/02'", '5')); + self::assertEquals("'1987/05/02' + 1 SECOND", $this->platform->getDateAddSecondsExpression("'1987/05/02'", '1')); + self::assertEquals("'1987/05/02' + (3 * 7) DAY", $this->platform->getDateAddWeeksExpression("'1987/05/02'", '3')); + self::assertEquals("'1987/05/02' + 10 YEAR", $this->platform->getDateAddYearsExpression("'1987/05/02'", '10')); self::assertEquals("DAYS('1987/05/02') - DAYS('1987/04/01')", $this->platform->getDateDiffExpression("'1987/05/02'", "'1987/04/01'")); - self::assertEquals("'1987/05/02' - 4 DAY", $this->platform->getDateSubDaysExpression("'1987/05/02'", 4)); - self::assertEquals("'1987/05/02' - 12 HOUR", $this->platform->getDateSubHourExpression("'1987/05/02'", 12)); - self::assertEquals("'1987/05/02' - 2 MINUTE", $this->platform->getDateSubMinutesExpression("'1987/05/02'", 2)); - self::assertEquals("'1987/05/02' - 102 MONTH", $this->platform->getDateSubMonthExpression("'1987/05/02'", 102)); - self::assertEquals("'1987/05/02' - (5 * 3) MONTH", $this->platform->getDateSubQuartersExpression("'1987/05/02'", 5)); - self::assertEquals("'1987/05/02' - 1 SECOND", $this->platform->getDateSubSecondsExpression("'1987/05/02'", 1)); - self::assertEquals("'1987/05/02' - (3 * 7) DAY", $this->platform->getDateSubWeeksExpression("'1987/05/02'", 3)); - self::assertEquals("'1987/05/02' - 10 YEAR", $this->platform->getDateSubYearsExpression("'1987/05/02'", 10)); + self::assertEquals("'1987/05/02' - 4 DAY", $this->platform->getDateSubDaysExpression("'1987/05/02'", '4')); + self::assertEquals("'1987/05/02' - 12 HOUR", $this->platform->getDateSubHourExpression("'1987/05/02'", '12')); + self::assertEquals("'1987/05/02' - 2 MINUTE", $this->platform->getDateSubMinutesExpression("'1987/05/02'", '2')); + self::assertEquals("'1987/05/02' - 102 MONTH", $this->platform->getDateSubMonthExpression("'1987/05/02'", '102')); + self::assertEquals("'1987/05/02' - (5 * 3) MONTH", $this->platform->getDateSubQuartersExpression("'1987/05/02'", '5')); + self::assertEquals("'1987/05/02' - 1 SECOND", $this->platform->getDateSubSecondsExpression("'1987/05/02'", '1')); + self::assertEquals("'1987/05/02' - (3 * 7) DAY", $this->platform->getDateSubWeeksExpression("'1987/05/02'", '3')); + self::assertEquals("'1987/05/02' - 10 YEAR", $this->platform->getDateSubYearsExpression("'1987/05/02'", '10')); self::assertEquals(' WITH RR USE AND KEEP UPDATE LOCKS', $this->platform->getForUpdateSQL()); self::assertEquals('LOCATE(substring_column, string_column)', $this->platform->getLocateExpression('string_column', 'substring_column')); - self::assertEquals('LOCATE(substring_column, string_column, 1)', $this->platform->getLocateExpression('string_column', 'substring_column', 1)); - self::assertEquals('SUBSTR(column, 5)', $this->platform->getSubstringExpression('column', 5)); - self::assertEquals('SUBSTR(column, 5, 2)', $this->platform->getSubstringExpression('column', 5, 2)); + self::assertEquals('LOCATE(substring_column, string_column, 1)', $this->platform->getLocateExpression('string_column', 'substring_column', '1')); + self::assertEquals('SUBSTR(column, 5)', $this->platform->getSubstringExpression('column', '5')); + self::assertEquals('SUBSTR(column, 5, 2)', $this->platform->getSubstringExpression('column', '5', '2')); } public function testModifiesLimitQuery() diff --git a/tests/Doctrine/Tests/DBAL/Platforms/MariaDb1027PlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/MariaDb1027PlatformTest.php index 7171ad714d6..bfb9d893866 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/MariaDb1027PlatformTest.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/MariaDb1027PlatformTest.php @@ -1,5 +1,7 @@ platform->getStopDatabaseSQL('"foobar"')); self::assertEquals('STOP DATABASE "create" UNCONDITIONALLY', $this->platform->getStopDatabaseSQL('create')); self::assertEquals('TRUNCATE TABLE foobar', $this->platform->getTruncateTableSQL('foobar')); - self::assertEquals('TRUNCATE TABLE foobar', $this->platform->getTruncateTableSQL('foobar'), true); $viewSql = 'SELECT * FROM footable'; self::assertEquals('CREATE VIEW fooview AS ' . $viewSql, $this->platform->getCreateViewSQL('fooview', $viewSql)); @@ -361,12 +362,12 @@ public function testGeneratesUniqueConstraintDeclarationSQL() 'CONSTRAINT unique_constraint UNIQUE CLUSTERED (a, b)', $this->platform->getUniqueConstraintDeclarationSQL( 'unique_constraint', - new UniqueConstraint(null, ['a', 'b'], ['clustered']) + new UniqueConstraint('', ['a', 'b'], ['clustered']) ) ); self::assertEquals( 'CONSTRAINT UNIQUE (a, b)', - $this->platform->getUniqueConstraintDeclarationSQL(null, new UniqueConstraint(null, ['a', 'b'])) + $this->platform->getUniqueConstraintDeclarationSQL('', new UniqueConstraint('', ['a', 'b'])) ); } @@ -615,31 +616,31 @@ public function testGeneratesSQLSnippets() self::assertEquals('CURRENT DATE', $this->platform->getCurrentDateSQL()); self::assertEquals('CURRENT TIME', $this->platform->getCurrentTimeSQL()); self::assertEquals('CURRENT TIMESTAMP', $this->platform->getCurrentTimestampSQL()); - self::assertEquals("DATEADD(DAY, 4, '1987/05/02')", $this->platform->getDateAddDaysExpression("'1987/05/02'", 4)); - self::assertEquals("DATEADD(HOUR, 12, '1987/05/02')", $this->platform->getDateAddHourExpression("'1987/05/02'", 12)); - self::assertEquals("DATEADD(MINUTE, 2, '1987/05/02')", $this->platform->getDateAddMinutesExpression("'1987/05/02'", 2)); - self::assertEquals("DATEADD(MONTH, 102, '1987/05/02')", $this->platform->getDateAddMonthExpression("'1987/05/02'", 102)); - self::assertEquals("DATEADD(QUARTER, 5, '1987/05/02')", $this->platform->getDateAddQuartersExpression("'1987/05/02'", 5)); - self::assertEquals("DATEADD(SECOND, 1, '1987/05/02')", $this->platform->getDateAddSecondsExpression("'1987/05/02'", 1)); - self::assertEquals("DATEADD(WEEK, 3, '1987/05/02')", $this->platform->getDateAddWeeksExpression("'1987/05/02'", 3)); - self::assertEquals("DATEADD(YEAR, 10, '1987/05/02')", $this->platform->getDateAddYearsExpression("'1987/05/02'", 10)); + self::assertEquals("DATEADD(DAY, 4, '1987/05/02')", $this->platform->getDateAddDaysExpression("'1987/05/02'", '4')); + self::assertEquals("DATEADD(HOUR, 12, '1987/05/02')", $this->platform->getDateAddHourExpression("'1987/05/02'", '12')); + self::assertEquals("DATEADD(MINUTE, 2, '1987/05/02')", $this->platform->getDateAddMinutesExpression("'1987/05/02'", '2')); + self::assertEquals("DATEADD(MONTH, 102, '1987/05/02')", $this->platform->getDateAddMonthExpression("'1987/05/02'", '102')); + self::assertEquals("DATEADD(QUARTER, 5, '1987/05/02')", $this->platform->getDateAddQuartersExpression("'1987/05/02'", '5')); + self::assertEquals("DATEADD(SECOND, 1, '1987/05/02')", $this->platform->getDateAddSecondsExpression("'1987/05/02'", '1')); + self::assertEquals("DATEADD(WEEK, 3, '1987/05/02')", $this->platform->getDateAddWeeksExpression("'1987/05/02'", '3')); + self::assertEquals("DATEADD(YEAR, 10, '1987/05/02')", $this->platform->getDateAddYearsExpression("'1987/05/02'", '10')); self::assertEquals("DATEDIFF(day, '1987/04/01', '1987/05/02')", $this->platform->getDateDiffExpression("'1987/05/02'", "'1987/04/01'")); - self::assertEquals("DATEADD(DAY, -1 * 4, '1987/05/02')", $this->platform->getDateSubDaysExpression("'1987/05/02'", 4)); - self::assertEquals("DATEADD(HOUR, -1 * 12, '1987/05/02')", $this->platform->getDateSubHourExpression("'1987/05/02'", 12)); - self::assertEquals("DATEADD(MINUTE, -1 * 2, '1987/05/02')", $this->platform->getDateSubMinutesExpression("'1987/05/02'", 2)); - self::assertEquals("DATEADD(MONTH, -1 * 102, '1987/05/02')", $this->platform->getDateSubMonthExpression("'1987/05/02'", 102)); - self::assertEquals("DATEADD(QUARTER, -1 * 5, '1987/05/02')", $this->platform->getDateSubQuartersExpression("'1987/05/02'", 5)); - self::assertEquals("DATEADD(SECOND, -1 * 1, '1987/05/02')", $this->platform->getDateSubSecondsExpression("'1987/05/02'", 1)); - self::assertEquals("DATEADD(WEEK, -1 * 3, '1987/05/02')", $this->platform->getDateSubWeeksExpression("'1987/05/02'", 3)); - self::assertEquals("DATEADD(YEAR, -1 * 10, '1987/05/02')", $this->platform->getDateSubYearsExpression("'1987/05/02'", 10)); + self::assertEquals("DATEADD(DAY, -1 * 4, '1987/05/02')", $this->platform->getDateSubDaysExpression("'1987/05/02'", '4')); + self::assertEquals("DATEADD(HOUR, -1 * 12, '1987/05/02')", $this->platform->getDateSubHourExpression("'1987/05/02'", '12')); + self::assertEquals("DATEADD(MINUTE, -1 * 2, '1987/05/02')", $this->platform->getDateSubMinutesExpression("'1987/05/02'", '2')); + self::assertEquals("DATEADD(MONTH, -1 * 102, '1987/05/02')", $this->platform->getDateSubMonthExpression("'1987/05/02'", '102')); + self::assertEquals("DATEADD(QUARTER, -1 * 5, '1987/05/02')", $this->platform->getDateSubQuartersExpression("'1987/05/02'", '5')); + self::assertEquals("DATEADD(SECOND, -1 * 1, '1987/05/02')", $this->platform->getDateSubSecondsExpression("'1987/05/02'", '1')); + self::assertEquals("DATEADD(WEEK, -1 * 3, '1987/05/02')", $this->platform->getDateSubWeeksExpression("'1987/05/02'", '3')); + self::assertEquals("DATEADD(YEAR, -1 * 10, '1987/05/02')", $this->platform->getDateSubYearsExpression("'1987/05/02'", '10')); self::assertEquals('Y-m-d H:i:s.u', $this->platform->getDateTimeFormatString()); self::assertEquals('H:i:s.u', $this->platform->getTimeFormatString()); self::assertEquals('', $this->platform->getForUpdateSQL()); self::assertEquals('LOCATE(string_column, substring_column)', $this->platform->getLocateExpression('string_column', 'substring_column')); - self::assertEquals('LOCATE(string_column, substring_column, 1)', $this->platform->getLocateExpression('string_column', 'substring_column', 1)); + self::assertEquals('LOCATE(string_column, substring_column, 1)', $this->platform->getLocateExpression('string_column', 'substring_column', '1')); self::assertEquals("HASH(column, 'MD5')", $this->platform->getMd5Expression('column')); - self::assertEquals('SUBSTRING(column, 5)', $this->platform->getSubstringExpression('column', 5)); - self::assertEquals('SUBSTRING(column, 5, 2)', $this->platform->getSubstringExpression('column', 5, 2)); + self::assertEquals('SUBSTRING(column, 5)', $this->platform->getSubstringExpression('column', '5')); + self::assertEquals('SUBSTRING(column, 5, 2)', $this->platform->getSubstringExpression('column', '5', '2')); self::assertEquals('GLOBAL TEMPORARY', $this->platform->getTemporaryTableSQL()); self::assertEquals( 'LTRIM(column)', diff --git a/tests/Doctrine/Tests/DBAL/Platforms/SQLAzurePlatformTest.php b/tests/Doctrine/Tests/DBAL/Platforms/SQLAzurePlatformTest.php index 8aa6bc0cda3..ae993b67fd9 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/SQLAzurePlatformTest.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/SQLAzurePlatformTest.php @@ -1,5 +1,7 @@ platform->getRegexpExpression(), 'Regular expression operator is not correct'); - self::assertEquals('SUBSTR(column, 5)', $this->platform->getSubstringExpression('column', 5), 'Substring expression without length is not correct'); - self::assertEquals('SUBSTR(column, 0, 5)', $this->platform->getSubstringExpression('column', 0, 5), 'Substring expression with length is not correct'); + self::assertEquals('SUBSTR(column, 5)', $this->platform->getSubstringExpression('column', '5'), 'Substring expression without length is not correct'); + self::assertEquals('SUBSTR(column, 0, 5)', $this->platform->getSubstringExpression('column', '0', '5'), 'Substring expression with length is not correct'); } public function testGeneratesTransactionCommands() @@ -766,7 +768,7 @@ public function testQuotesTableNameInListTableForeignKeysSQL() public function testDateAddStaticNumberOfDays() { - self::assertSame("DATETIME(rentalBeginsOn,'+' || 12 || ' DAY')", $this->platform->getDateAddDaysExpression('rentalBeginsOn', 12)); + self::assertSame("DATETIME(rentalBeginsOn,'+' || 12 || ' DAY')", $this->platform->getDateAddDaysExpression('rentalBeginsOn', '12')); } public function testDateAddNumberOfDaysFromColumn() diff --git a/tests/Doctrine/Tests/DBAL/Portability/StatementTest.php b/tests/Doctrine/Tests/DBAL/Portability/StatementTest.php index 622e030c245..2477efcd4d3 100644 --- a/tests/Doctrine/Tests/DBAL/Portability/StatementTest.php +++ b/tests/Doctrine/Tests/DBAL/Portability/StatementTest.php @@ -1,5 +1,7 @@ platform->getDateTimeFormatString()->willReturn('Y-m-d H:i:s')->shouldBeCalled(); + $this->expectException(ConversionException::class); $this->type->convertToPHPValue('invalid datetime string', $this->platform->reveal()); diff --git a/tests/Doctrine/Tests/DBAL/Types/DateTimeTest.php b/tests/Doctrine/Tests/DBAL/Types/DateTimeTest.php index 615c14d584d..923f22151b4 100644 --- a/tests/Doctrine/Tests/DBAL/Types/DateTimeTest.php +++ b/tests/Doctrine/Tests/DBAL/Types/DateTimeTest.php @@ -1,5 +1,7 @@ platform->getDateTimeTzFormatString()->willReturn('Y-m-d H:i:s T')->shouldBeCalled(); + $this->expectException(ConversionException::class); $this->type->convertToPHPValue('invalid datetime with timezone string', $this->platform->reveal()); diff --git a/tests/Doctrine/Tests/DBAL/Types/DateTimeTzTest.php b/tests/Doctrine/Tests/DBAL/Types/DateTimeTzTest.php index 419974c6b09..7407c70beb3 100644 --- a/tests/Doctrine/Tests/DBAL/Types/DateTimeTzTest.php +++ b/tests/Doctrine/Tests/DBAL/Types/DateTimeTzTest.php @@ -1,5 +1,7 @@ platform = $this->createMock(AbstractPlatform::class); + $this->platform->expects($this->any()) + ->method('getDateTimeFormatString') + ->will($this->returnValue('U')); + if (! Type::hasType('vardatetime')) { Type::addType('vardatetime', VarDateTimeType::class); } @@ -31,7 +37,7 @@ public function testDateTimeConvertsToDatabaseValue() { $date = new DateTime('1985-09-01 10:10:10'); - $expected = $date->format($this->platform->getDateTimeTzFormatString()); + $expected = $date->format($this->platform->getDateTimeFormatString()); $actual = $this->type->convertToDatabaseValue($date, $this->platform); self::assertEquals($expected, $actual); diff --git a/tests/Doctrine/Tests/DBAL/UtilTest.php b/tests/Doctrine/Tests/DBAL/UtilTest.php index e7800fceba3..6bec241c483 100644 --- a/tests/Doctrine/Tests/DBAL/UtilTest.php +++ b/tests/Doctrine/Tests/DBAL/UtilTest.php @@ -1,5 +1,7 @@ $GLOBALS['tmpdb_password'], 'host' => $GLOBALS['tmpdb_host'], 'dbname' => null, - 'port' => $GLOBALS['tmpdb_port'], + 'port' => (int) $GLOBALS['tmpdb_port'], ]; if (isset($GLOBALS['tmpdb_name'])) { @@ -177,7 +179,7 @@ private static function getParamsForMainConnection() 'password' => $GLOBALS['db_password'], 'host' => $GLOBALS['db_host'], 'dbname' => $GLOBALS['db_name'], - 'port' => $GLOBALS['db_port'], + 'port' => (int) $GLOBALS['db_port'], ]; if (isset($GLOBALS['db_server'])) { diff --git a/tests/Doctrine/Tests/Types/CommentedType.php b/tests/Doctrine/Tests/Types/CommentedType.php index cbe98b2324b..0b02bcef995 100644 --- a/tests/Doctrine/Tests/Types/CommentedType.php +++ b/tests/Doctrine/Tests/Types/CommentedType.php @@ -1,5 +1,7 @@