From 779cbd5ab8ca0d0f09473fbfe22694270a0cab65 Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Sat, 6 Mar 2021 18:14:44 +0100 Subject: [PATCH] [GH-3088] Deprecate usage of PDO Fetch Mode and Param constants. --- lib/Doctrine/DBAL/Driver/PDOStatement.php | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/lib/Doctrine/DBAL/Driver/PDOStatement.php b/lib/Doctrine/DBAL/Driver/PDOStatement.php index 86d6a15d49e..d0539103566 100644 --- a/lib/Doctrine/DBAL/Driver/PDOStatement.php +++ b/lib/Doctrine/DBAL/Driver/PDOStatement.php @@ -6,6 +6,7 @@ use Doctrine\DBAL\Driver\Statement as StatementInterface; use Doctrine\DBAL\FetchMode; use Doctrine\DBAL\ParameterType; +use Doctrine\Deprecations\Deprecation; use PDO; use PDOException; @@ -13,10 +14,6 @@ use function assert; use function func_get_args; use function is_array; -use function sprintf; -use function trigger_error; - -use const E_USER_DEPRECATED; /** * The PDO implementation of the Statement interface. @@ -274,10 +271,13 @@ private function convertParamType(int $type): int { if (! isset(self::PARAM_TYPE_MAP[$type])) { // TODO: next major: throw an exception - @trigger_error(sprintf( - 'Using a PDO parameter type (%d given) is deprecated and will cause an error in Doctrine DBAL 3.0', + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pull/3088', + 'Using a PDO parameter type (%d given) is deprecated, ' . + 'use \Doctrine\DBAL\Types\Types constants instead.', $type - ), E_USER_DEPRECATED); + ); return $type; } @@ -293,12 +293,13 @@ private function convertParamType(int $type): int private function convertFetchMode(int $fetchMode): int { if (! isset(self::FETCH_MODE_MAP[$fetchMode])) { - // TODO: next major: throw an exception - @trigger_error(sprintf( - 'Using a PDO fetch mode or their combination (%d given)' . + Deprecation::trigger( + 'doctrine/dbal', + 'https://github.com/doctrine/dbal/pull/3088', + 'Using an unsupported PDO fetch mode or a bitmask of fetch modes (%d given)' . ' is deprecated and will cause an error in Doctrine DBAL 3.0', $fetchMode - ), E_USER_DEPRECATED); + ); return $fetchMode; }