diff --git a/UPGRADE.md b/UPGRADE.md
index 5b3425f82bb..332e8d4fd3c 100644
--- a/UPGRADE.md
+++ b/UPGRADE.md
@@ -8,6 +8,15 @@ awareness about deprecated code.
# Upgrade to 3.4
+## Deprecated wrapper- and driver-level `Statement::bindParam()` methods.
+
+The following methods have been deprecated:
+
+1. `Doctrine\DBAL\Statement::bindParam()`,
+2. `Doctrine\DBAL\Driver\Statement::bindParam()`.
+
+Use the corresponding `bindValue()` instead.
+
## Deprecated not passing parameter type to the driver-level `Statement::bind*()` methods.
Not passing `$type` to the driver-level `Statement::bindParam()` and `::bindValue()` is deprecated.
diff --git a/psalm.xml.dist b/psalm.xml.dist
index 6fcee4db4dd..30f831d6d3c 100644
--- a/psalm.xml.dist
+++ b/psalm.xml.dist
@@ -399,6 +399,16 @@
-->
+
+
+
+
+
+
+
+
diff --git a/src/Driver/IBMDB2/Statement.php b/src/Driver/IBMDB2/Statement.php
index 02bdd989196..56f2913ed82 100644
--- a/src/Driver/IBMDB2/Statement.php
+++ b/src/Driver/IBMDB2/Statement.php
@@ -76,9 +76,18 @@ public function bindValue($param, $value, $type = ParameterType::STRING): bool
/**
* {@inheritdoc}
+ *
+ * @deprecated Use {@see bindValue()} instead.
*/
public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null): bool
{
+ Deprecation::trigger(
+ 'doctrine/dbal',
+ 'https://github.com/doctrine/dbal/pull/5563',
+ '%s is deprecated. Use bindValue() instead.',
+ __METHOD__
+ );
+
assert(is_int($param));
if (func_num_args() < 3) {
diff --git a/src/Driver/Middleware/AbstractStatementMiddleware.php b/src/Driver/Middleware/AbstractStatementMiddleware.php
index fba62cd6ed7..9b61b595d5d 100644
--- a/src/Driver/Middleware/AbstractStatementMiddleware.php
+++ b/src/Driver/Middleware/AbstractStatementMiddleware.php
@@ -37,9 +37,18 @@ public function bindValue($param, $value, $type = ParameterType::STRING)
/**
* {@inheritdoc}
+ *
+ * @deprecated Use {@see bindValue()} instead.
*/
public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null)
{
+ Deprecation::trigger(
+ 'doctrine/dbal',
+ 'https://github.com/doctrine/dbal/pull/5563',
+ '%s is deprecated. Use bindValue() instead.',
+ __METHOD__
+ );
+
if (func_num_args() < 3) {
Deprecation::trigger(
'doctrine/dbal',
diff --git a/src/Driver/Mysqli/Statement.php b/src/Driver/Mysqli/Statement.php
index 8365ee1e68f..4714d80b929 100644
--- a/src/Driver/Mysqli/Statement.php
+++ b/src/Driver/Mysqli/Statement.php
@@ -66,9 +66,18 @@ public function __construct(mysqli_stmt $stmt)
/**
* {@inheritdoc}
+ *
+ * @deprecated Use {@see bindValue()} instead.
*/
public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null): bool
{
+ Deprecation::trigger(
+ 'doctrine/dbal',
+ 'https://github.com/doctrine/dbal/pull/5563',
+ '%s is deprecated. Use bindValue() instead.',
+ __METHOD__
+ );
+
assert(is_int($param));
if (func_num_args() < 3) {
diff --git a/src/Driver/OCI8/Statement.php b/src/Driver/OCI8/Statement.php
index 1d5bd9584ca..99b4e2f4473 100644
--- a/src/Driver/OCI8/Statement.php
+++ b/src/Driver/OCI8/Statement.php
@@ -70,9 +70,18 @@ public function bindValue($param, $value, $type = ParameterType::STRING): bool
/**
* {@inheritdoc}
+ *
+ * @deprecated Use {@see bindValue()} instead.
*/
public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null): bool
{
+ Deprecation::trigger(
+ 'doctrine/dbal',
+ 'https://github.com/doctrine/dbal/pull/5563',
+ '%s is deprecated. Use bindValue() instead.',
+ __METHOD__
+ );
+
if (func_num_args() < 3) {
Deprecation::trigger(
'doctrine/dbal',
diff --git a/src/Driver/PDO/SQLSrv/Statement.php b/src/Driver/PDO/SQLSrv/Statement.php
index 80e018d5494..e4ab5e119fa 100644
--- a/src/Driver/PDO/SQLSrv/Statement.php
+++ b/src/Driver/PDO/SQLSrv/Statement.php
@@ -27,6 +27,8 @@ public function __construct(PDOStatement $statement)
/**
* {@inheritdoc}
*
+ * @deprecated Use {@see bindValue()} instead.
+ *
* @param string|int $param
* @param mixed $variable
* @param int $type
@@ -40,6 +42,13 @@ public function bindParam(
$length = null,
$driverOptions = null
): bool {
+ Deprecation::trigger(
+ 'doctrine/dbal',
+ 'https://github.com/doctrine/dbal/pull/5563',
+ '%s is deprecated. Use bindValue() instead.',
+ __METHOD__
+ );
+
if (func_num_args() < 3) {
Deprecation::trigger(
'doctrine/dbal',
diff --git a/src/Driver/PDO/Statement.php b/src/Driver/PDO/Statement.php
index 497bc5e24e8..cdc1cf6a519 100644
--- a/src/Driver/PDO/Statement.php
+++ b/src/Driver/PDO/Statement.php
@@ -64,6 +64,8 @@ public function bindValue($param, $value, $type = ParameterType::STRING)
/**
* {@inheritDoc}
*
+ * @deprecated Use {@see bindValue()} instead.
+ *
* @param mixed $param
* @param mixed $variable
* @param int $type
@@ -77,6 +79,13 @@ public function bindParam(
$length = null,
$driverOptions = null
): bool {
+ Deprecation::trigger(
+ 'doctrine/dbal',
+ 'https://github.com/doctrine/dbal/pull/5563',
+ '%s is deprecated. Use bindValue() instead.',
+ __METHOD__
+ );
+
if (func_num_args() < 3) {
Deprecation::trigger(
'doctrine/dbal',
diff --git a/src/Driver/SQLSrv/Statement.php b/src/Driver/SQLSrv/Statement.php
index 2d7c1c6040a..e5525482832 100644
--- a/src/Driver/SQLSrv/Statement.php
+++ b/src/Driver/SQLSrv/Statement.php
@@ -105,9 +105,18 @@ public function bindValue($param, $value, $type = ParameterType::STRING): bool
/**
* {@inheritdoc}
+ *
+ * @deprecated Use {@see bindValue()} instead.
*/
public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null): bool
{
+ Deprecation::trigger(
+ 'doctrine/dbal',
+ 'https://github.com/doctrine/dbal/pull/5563',
+ '%s is deprecated. Use bindValue() instead.',
+ __METHOD__
+ );
+
assert(is_int($param));
if (func_num_args() < 3) {
diff --git a/src/Driver/Statement.php b/src/Driver/Statement.php
index 50fac842d5c..b273128f1ec 100644
--- a/src/Driver/Statement.php
+++ b/src/Driver/Statement.php
@@ -43,6 +43,8 @@ public function bindValue($param, $value, $type = ParameterType::STRING);
* of stored procedures that return data as output parameters, and some also as input/output
* parameters that both send in data and are updated to receive it.
*
+ * @deprecated Use {@see bindValue()} instead.
+ *
* @param string|int $param Parameter identifier. For a prepared statement using named placeholders,
* this will be a parameter name of the form :name. For a prepared statement using
* question mark placeholders, this will be the 1-indexed position of the parameter.
diff --git a/src/Logging/Statement.php b/src/Logging/Statement.php
index 672f5647cc7..55d1d628c2b 100644
--- a/src/Logging/Statement.php
+++ b/src/Logging/Statement.php
@@ -39,9 +39,18 @@ public function __construct(StatementInterface $statement, LoggerInterface $logg
/**
* {@inheritdoc}
+ *
+ * @deprecated Use {@see bindValue()} instead.
*/
public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null)
{
+ Deprecation::trigger(
+ 'doctrine/dbal',
+ 'https://github.com/doctrine/dbal/pull/5563',
+ '%s is deprecated. Use bindValue() instead.',
+ __METHOD__
+ );
+
if (func_num_args() < 3) {
Deprecation::trigger(
'doctrine/dbal',
diff --git a/src/Statement.php b/src/Statement.php
index 39a33f33e10..86cea667eb8 100644
--- a/src/Statement.php
+++ b/src/Statement.php
@@ -123,6 +123,8 @@ public function bindValue($param, $value, $type = ParameterType::STRING)
*
* Binding a parameter by reference does not support DBAL mapping types.
*
+ * @deprecated Use {@see bindValue()} instead.
+ *
* @param string|int $param The name or position of the parameter.
* @param mixed $variable The reference to the variable to bind.
* @param int $type The binding type.
@@ -135,6 +137,13 @@ public function bindValue($param, $value, $type = ParameterType::STRING)
*/
public function bindParam($param, &$variable, $type = ParameterType::STRING, $length = null)
{
+ Deprecation::trigger(
+ 'doctrine/dbal',
+ 'https://github.com/doctrine/dbal/pull/5563',
+ '%s is deprecated. Use bindValue() instead.',
+ __METHOD__
+ );
+
$this->params[$param] = $variable;
$this->types[$param] = $type;