diff --git a/lib/Doctrine/DBAL/Driver/PDOStatement.php b/lib/Doctrine/DBAL/Driver/PDOStatement.php index 6e61d22555a..42d20dd2be7 100644 --- a/lib/Doctrine/DBAL/Driver/PDOStatement.php +++ b/lib/Doctrine/DBAL/Driver/PDOStatement.php @@ -4,14 +4,12 @@ use Doctrine\DBAL\FetchMode; use Doctrine\DBAL\ParameterType; +use InvalidArgumentException; use PDO; -use const E_USER_DEPRECATED; use function array_slice; use function assert; use function func_get_args; use function is_array; -use function sprintf; -use function trigger_error; /** * The PDO implementation of the Statement interface. @@ -193,13 +191,7 @@ public function fetchColumn($columnIndex = 0) 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', - $type - ), E_USER_DEPRECATED); - - return $type; + throw new InvalidArgumentException('Invalid parameter type: ' . $type); } return self::PARAM_TYPE_MAP[$type]; @@ -213,14 +205,7 @@ 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)' . - ' is deprecated and will cause an error in Doctrine DBAL 3.0', - $fetchMode - ), E_USER_DEPRECATED); - - return $fetchMode; + throw new InvalidArgumentException('Invalid fetch mode: ' . $fetchMode); } return self::FETCH_MODE_MAP[$fetchMode]; diff --git a/tests/Doctrine/Tests/DBAL/Functional/PDOStatementTest.php b/tests/Doctrine/Tests/DBAL/Functional/PDOStatementTest.php deleted file mode 100644 index 2ea5fa49284..00000000000 --- a/tests/Doctrine/Tests/DBAL/Functional/PDOStatementTest.php +++ /dev/null @@ -1,54 +0,0 @@ -markTestSkipped('PDO is not installed'); - } - - parent::setUp(); - - if (! $this->connection->getWrappedConnection() instanceof PDOConnection) { - $this->markTestSkipped('PDO-only test'); - } - - $table = new Table('stmt_test'); - $table->addColumn('id', 'integer'); - $table->addColumn('name', 'string'); - $this->connection->getSchemaManager()->dropAndCreateTable($table); - } - - /** - * @group legacy - * @expectedDeprecation Using a PDO fetch mode or their combination (%d given) is deprecated and will cause an error in Doctrine DBAL 3.0 - */ - public function testPDOSpecificModeIsAccepted() : void - { - $this->connection->insert('stmt_test', [ - 'id' => 1, - 'name' => 'Alice', - ]); - $this->connection->insert('stmt_test', [ - 'id' => 2, - 'name' => 'Bob', - ]); - - $data = $this->connection->query('SELECT id, name FROM stmt_test ORDER BY id') - ->fetchAll(PDO::FETCH_KEY_PAIR); - - self::assertSame([ - 1 => 'Alice', - 2 => 'Bob', - ], $data); - } -}