Repository: doctrine/dbal (php)

Issue:
QueryBuilder uses 1-based positional parameter keys
### Bug Report

|    Q        |   A
|------------ | ------
| BC Break    |no
| Version     | 2.12.1

#### Summary

According to the documentation,

https://github.com/doctrine/dbal/blob/84328cd947706210caebcaea3ca0394b3ebc4673/docs/en/reference/query-builder.rst#L47-L48

The usage of non-zero-based keys has been explicitly deprecated in https://github.com/doctrine/dbal/pull/4411. The issue was discovered during the work on https://github.com/doctrine/dbal/pull/4397 which enforces this deprecation. 

#### Current behaviour

When using `QueryBuilder::creartePositionalParameter()`, the keys are created starting from `1`.

#### How to reproduce

```php
$qb = $conn->createQueryBuilder();
$qb->select($qb->createPositionalParameter('FOO'));

var_dump($qb->getParameters());
// array(1) {
//   [1] =>
//   string(3) "FOO"
// }
```

#### Expected behaviour

```php
// array(1) {
//   [0] =>
//   string(3) "FOO"
// }
```


Pull request description:
QueryBuilder must use 0-based positional parameter keys
|      Q       |   A
|------------- | -----------
| Type         | bug
| BC Break     | no

Fixes #4421.

Although this bug exists in `2.x`, I don't think we have to fix it in a patch release. It's sufficient to fix it in `3.0.x`.

Patch:
diff --git a/src/Query/QueryBuilder.php b/src/Query/QueryBuilder.php
index 89dc2efde..c8bf98149 100644
--- a/src/Query/QueryBuilder.php
+++ b/src/Query/QueryBuilder.php
@@ -1330,8 +1330,8 @@ class QueryBuilder
      */
     public function createPositionalParameter($value, $type = ParameterType::STRING)
     {
-        $this->boundCounter++;
         $this->setParameter($this->boundCounter, $value, $type);
+        $this->boundCounter++;
 
         return '?';
     }


Test patch:
diff --git a/tests/Query/QueryBuilderTest.php b/tests/Query/QueryBuilderTest.php
index 9f81d36fd..d3574b6d0 100644
--- a/tests/Query/QueryBuilderTest.php
+++ b/tests/Query/QueryBuilderTest.php
@@ -679,8 +679,8 @@ class QueryBuilderTest extends TestCase
         );
 
         self::assertEquals('SELECT u.* FROM users u WHERE u.name = ?', (string) $qb);
-        self::assertEquals(10, $qb->getParameter(1));
-        self::assertEquals(ParameterType::INTEGER, $qb->getParameterType(1));
+        self::assertEquals(10, $qb->getParameter(0));
+        self::assertEquals(ParameterType::INTEGER, $qb->getParameterType(0));
     }
 
     public function testReferenceJoinFromJoin(): void