diff --git a/ci/github/phpunit/ibm_db2.xml b/ci/github/phpunit/ibm_db2.xml index 21bd09b2034..c0ac603aacf 100644 --- a/ci/github/phpunit/ibm_db2.xml +++ b/ci/github/phpunit/ibm_db2.xml @@ -6,8 +6,11 @@ beStrictAboutTodoAnnotatedTests="true" failOnRisky="true" failOnWarning="true" + convertDeprecationsToExceptions="true" > + + diff --git a/ci/github/phpunit/mysqli-tls.xml b/ci/github/phpunit/mysqli-tls.xml index 6931889a392..804fc80103a 100644 --- a/ci/github/phpunit/mysqli-tls.xml +++ b/ci/github/phpunit/mysqli-tls.xml @@ -6,8 +6,11 @@ beStrictAboutTodoAnnotatedTests="true" failOnRisky="true" failOnWarning="true" + convertDeprecationsToExceptions="true" > + + diff --git a/ci/github/phpunit/mysqli.xml b/ci/github/phpunit/mysqli.xml index 8b5c48c2b9d..9ed7d336827 100644 --- a/ci/github/phpunit/mysqli.xml +++ b/ci/github/phpunit/mysqli.xml @@ -6,8 +6,11 @@ beStrictAboutTodoAnnotatedTests="true" failOnRisky="true" failOnWarning="true" + convertDeprecationsToExceptions="true" > + + diff --git a/ci/github/phpunit/oci8.xml b/ci/github/phpunit/oci8.xml index 327318f1247..ae6d21609be 100644 --- a/ci/github/phpunit/oci8.xml +++ b/ci/github/phpunit/oci8.xml @@ -6,8 +6,11 @@ beStrictAboutTodoAnnotatedTests="true" failOnRisky="true" failOnWarning="true" + convertDeprecationsToExceptions="true" > + + diff --git a/ci/github/phpunit/pdo_mysql.xml b/ci/github/phpunit/pdo_mysql.xml index a698bacc9ed..64b2bac7316 100644 --- a/ci/github/phpunit/pdo_mysql.xml +++ b/ci/github/phpunit/pdo_mysql.xml @@ -6,8 +6,11 @@ beStrictAboutTodoAnnotatedTests="true" failOnRisky="true" failOnWarning="true" + convertDeprecationsToExceptions="true" > + + diff --git a/ci/github/phpunit/pdo_oci.xml b/ci/github/phpunit/pdo_oci.xml index d06b81f4a37..6df5f914121 100644 --- a/ci/github/phpunit/pdo_oci.xml +++ b/ci/github/phpunit/pdo_oci.xml @@ -6,8 +6,11 @@ beStrictAboutTodoAnnotatedTests="true" failOnRisky="true" failOnWarning="true" + convertDeprecationsToExceptions="true" > + + diff --git a/ci/github/phpunit/pdo_pgsql.xml b/ci/github/phpunit/pdo_pgsql.xml index ec291ad8f2c..e477dfc11e8 100644 --- a/ci/github/phpunit/pdo_pgsql.xml +++ b/ci/github/phpunit/pdo_pgsql.xml @@ -6,8 +6,11 @@ beStrictAboutTodoAnnotatedTests="true" failOnRisky="true" failOnWarning="true" + convertDeprecationsToExceptions="true" > + + diff --git a/ci/github/phpunit/pdo_sqlsrv.xml b/ci/github/phpunit/pdo_sqlsrv.xml index d986bfd8ff6..c0eaf4bf7d3 100644 --- a/ci/github/phpunit/pdo_sqlsrv.xml +++ b/ci/github/phpunit/pdo_sqlsrv.xml @@ -6,8 +6,11 @@ beStrictAboutTodoAnnotatedTests="true" failOnRisky="true" failOnWarning="true" + convertDeprecationsToExceptions="true" > + + diff --git a/ci/github/phpunit/sqlite.xml b/ci/github/phpunit/sqlite.xml index fc46cb75852..5b3b7f613c7 100644 --- a/ci/github/phpunit/sqlite.xml +++ b/ci/github/phpunit/sqlite.xml @@ -6,7 +6,12 @@ beStrictAboutTodoAnnotatedTests="true" failOnRisky="true" failOnWarning="true" + convertDeprecationsToExceptions="true" > + + + + ../../../tests diff --git a/ci/github/phpunit/sqlsrv.xml b/ci/github/phpunit/sqlsrv.xml index bcd4679f88e..8064a064b7d 100644 --- a/ci/github/phpunit/sqlsrv.xml +++ b/ci/github/phpunit/sqlsrv.xml @@ -6,8 +6,11 @@ beStrictAboutTodoAnnotatedTests="true" failOnRisky="true" failOnWarning="true" + convertDeprecationsToExceptions="true" > + + diff --git a/src/Connection.php b/src/Connection.php index 46648423408..8dc055726ee 100644 --- a/src/Connection.php +++ b/src/Connection.php @@ -1674,11 +1674,11 @@ private function _bindTypedValues(DriverStatement $stmt, array $params, array $t * @param mixed $value The value to bind. * @param int|string|Type|null $type The type to bind (PDO or DBAL). * - * @return mixed[] [0] => the (escaped) value, [1] => the binding type. + * @return array{mixed, int} [0] => the (escaped) value, [1] => the binding type. * * @throws Exception */ - private function getBindingInfo($value, $type) + private function getBindingInfo($value, $type): array { if (is_string($type)) { $type = Type::getType($type); @@ -1688,7 +1688,7 @@ private function getBindingInfo($value, $type) $value = $type->convertToDatabaseValue($value, $this->getDatabasePlatform()); $bindingType = $type->getBindingType(); } else { - $bindingType = $type; + $bindingType = $type ?? ParameterType::STRING; } return [$value, $bindingType]; diff --git a/src/Driver/PDO/SQLSrv/Statement.php b/src/Driver/PDO/SQLSrv/Statement.php index d2da1625c48..2f48874e0d6 100644 --- a/src/Driver/PDO/SQLSrv/Statement.php +++ b/src/Driver/PDO/SQLSrv/Statement.php @@ -59,7 +59,7 @@ public function bindParam($param, &$variable, $type = ParameterType::STRING, $le break; } - return $this->statement->bindParam($param, $variable, $type, $length, $driverOptions); + return $this->statement->bindParam($param, $variable, $type, $length ?? 0, $driverOptions); } /** diff --git a/src/Schema/OracleSchemaManager.php b/src/Schema/OracleSchemaManager.php index e24f79ffbec..13c8852435b 100644 --- a/src/Schema/OracleSchemaManager.php +++ b/src/Schema/OracleSchemaManager.php @@ -9,6 +9,7 @@ use function array_change_key_case; use function array_values; use function assert; +use function is_string; use function preg_match; use function str_replace; use function strpos; @@ -68,7 +69,7 @@ protected function _getPortableTableIndexesList($tableIndexes, $tableName = null $keyName = strtolower($tableIndex['name']); $buffer = []; - if (strtolower($tableIndex['is_primary']) === 'p') { + if ($tableIndex['is_primary'] === 'P') { $keyName = 'primary'; $buffer['primary'] = true; $buffer['non_unique'] = false; @@ -108,7 +109,9 @@ protected function _getPortableTableColumnDefinition($tableColumn) } // Default values returned from database sometimes have trailing spaces. - $tableColumn['data_default'] = trim($tableColumn['data_default']); + if (is_string($tableColumn['data_default'])) { + $tableColumn['data_default'] = trim($tableColumn['data_default']); + } if ($tableColumn['data_default'] === '' || $tableColumn['data_default'] === 'NULL') { $tableColumn['data_default'] = null; diff --git a/src/Schema/PostgreSQLSchemaManager.php b/src/Schema/PostgreSQLSchemaManager.php index 1559f5b1c7b..abc06af4785 100644 --- a/src/Schema/PostgreSQLSchemaManager.php +++ b/src/Schema/PostgreSQLSchemaManager.php @@ -21,7 +21,6 @@ use function preg_replace; use function sprintf; use function str_replace; -use function strlen; use function strpos; use function strtolower; use function trim; @@ -347,16 +346,22 @@ protected function _getPortableTableColumnDefinition($tableColumn) $matches = []; $autoincrement = false; - if (preg_match("/^nextval\('(.*)'(::.*)?\)$/", $tableColumn['default'], $matches) === 1) { + + if ( + $tableColumn['default'] !== null + && preg_match("/^nextval\('(.*)'(::.*)?\)$/", $tableColumn['default'], $matches) === 1 + ) { $tableColumn['sequence'] = $matches[1]; $tableColumn['default'] = null; $autoincrement = true; } - if (preg_match("/^['(](.*)[')]::/", $tableColumn['default'], $matches) === 1) { - $tableColumn['default'] = $matches[1]; - } elseif (preg_match('/^NULL::/', $tableColumn['default']) === 1) { - $tableColumn['default'] = null; + if ($tableColumn['default'] !== null) { + if (preg_match("/^['(](.*)[')]::/", $tableColumn['default'], $matches) === 1) { + $tableColumn['default'] = $matches[1]; + } elseif (preg_match('/^NULL::/', $tableColumn['default']) === 1) { + $tableColumn['default'] = null; + } } $length = $tableColumn['length'] ?? null; @@ -380,7 +385,8 @@ protected function _getPortableTableColumnDefinition($tableColumn) $dbType = strtolower($tableColumn['type']); if ( - strlen($tableColumn['domain_type']) > 0 + $tableColumn['domain_type'] !== null + && $tableColumn['domain_type'] !== '' && ! $this->_platform->hasDoctrineTypeMappingFor($tableColumn['type']) ) { $dbType = strtolower($tableColumn['domain_type']); @@ -520,7 +526,7 @@ protected function _getPortableTableColumnDefinition($tableColumn) */ private function fixVersion94NegativeNumericDefaultValue($defaultValue) { - if (strpos($defaultValue, '(') === 0) { + if ($defaultValue !== null && strpos($defaultValue, '(') === 0) { return trim($defaultValue, '()'); }