From 8fc6c2827decef3525154b151db369064d6d7427 Mon Sep 17 00:00:00 2001
From: Markus Staab <maggus.staab@googlemail.com>
Date: Sat, 29 Oct 2022 11:26:58 +0200
Subject: [PATCH 1/3] try reproduce bug #394

---
 tests/default/DbaInferenceTest.php |  1 +
 tests/default/data/bug394.php      | 21 +++++++++++++++++++++
 2 files changed, 22 insertions(+)
 create mode 100644 tests/default/data/bug394.php

diff --git a/tests/default/DbaInferenceTest.php b/tests/default/DbaInferenceTest.php
index bff723c81..76163f646 100644
--- a/tests/default/DbaInferenceTest.php
+++ b/tests/default/DbaInferenceTest.php
@@ -65,6 +65,7 @@ public function dataFileAsserts(): iterable
         yield from $this->gatherAssertTypes(__DIR__.'/data/pdo-default-fetch-types.php');
         yield from $this->gatherAssertTypes(__DIR__.'/data/bug372.php');
         yield from $this->gatherAssertTypes(__DIR__.'/data/inference-placeholder.php');
+        yield from $this->gatherAssertTypes(__DIR__.'/data/bug394.php');
     }
 
     /**
diff --git a/tests/default/data/bug394.php b/tests/default/data/bug394.php
new file mode 100644
index 000000000..5b2bfd104
--- /dev/null
+++ b/tests/default/data/bug394.php
@@ -0,0 +1,21 @@
+<?php
+
+namespace Bug394;
+
+class X {
+    /**
+     * @var \Doctrine\DBAL\Connection
+     */
+    private $conn;
+
+    public function bug394($sequence)
+    {
+        if ($sequence['conditionId'] !== null) {
+            $query = 'SELECT email, adaid FROM ada WHERE adaid = ?';
+            $fetchResult = $this->conn->fetchAssociative($query, [$sequence['conditionId']]);
+            assertType('array{email: string, adaid: int<-32768, 32767>}|false', $fetchResult);
+        }
+    }
+}
+
+

From fe622d5db1efa57bcc654b74e12a6db4890f7ec1 Mon Sep 17 00:00:00 2001
From: Markus Staab <maggus.staab@googlemail.com>
Date: Mon, 31 Oct 2022 15:25:13 +0100
Subject: [PATCH 2/3] Update bug394.php

---
 tests/default/data/bug394.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/default/data/bug394.php b/tests/default/data/bug394.php
index 5b2bfd104..5a4ae649b 100644
--- a/tests/default/data/bug394.php
+++ b/tests/default/data/bug394.php
@@ -8,7 +8,7 @@ class X {
      */
     private $conn;
 
-    public function bug394($sequence)
+    public function bug394(mixed $sequence)
     {
         if ($sequence['conditionId'] !== null) {
             $query = 'SELECT email, adaid FROM ada WHERE adaid = ?';

From 142bd75cde6b4a45f72a0020c2632d8ab4a93729 Mon Sep 17 00:00:00 2001
From: Markus Staab <maggus.staab@googlemail.com>
Date: Wed, 2 Nov 2022 19:05:22 +0100
Subject: [PATCH 3/3] Update bug394.php

---
 tests/default/data/bug394.php | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/tests/default/data/bug394.php b/tests/default/data/bug394.php
index 5a4ae649b..d90a04d31 100644
--- a/tests/default/data/bug394.php
+++ b/tests/default/data/bug394.php
@@ -8,14 +8,12 @@ class X {
      */
     private $conn;
 
-    public function bug394(mixed $sequence)
+    public function bug394(mixed $conditionId)
     {
-        if ($sequence['conditionId'] !== null) {
+        if ($conditionId !== null) {
             $query = 'SELECT email, adaid FROM ada WHERE adaid = ?';
-            $fetchResult = $this->conn->fetchAssociative($query, [$sequence['conditionId']]);
+            $fetchResult = $this->conn->fetchAssociative($query, [$conditionId]);
             assertType('array{email: string, adaid: int<-32768, 32767>}|false', $fetchResult);
         }
     }
 }
-
-