@@ -36,6 +36,7 @@ public function __construct(PDO $connection, ?Options $options = null)
3636 public function begin (): void
3737 {
3838 if (!$ this ->conn ->beginTransaction ()) {
39+ /** @phpstan-ignore argument.type */
3940 throw $ this ->getError ('Failed to begin transaction ' , $ this ->conn ->errorInfo ());
4041 }
4142 }
@@ -47,6 +48,7 @@ public function begin(): void
4748 public function commit (): void
4849 {
4950 if (!$ this ->conn ->commit ()) {
51+ /** @phpstan-ignore argument.type */
5052 throw $ this ->getError ('Failed to commit transaction ' , $ this ->conn ->errorInfo ());
5153 }
5254 }
@@ -58,6 +60,7 @@ public function commit(): void
5860 public function rollback (): void
5961 {
6062 if (!$ this ->conn ->rollback ()) {
63+ /** @phpstan-ignore argument.type */
6164 throw $ this ->getError ('Failed to roll back transaction ' , $ this ->conn ->errorInfo ());
6265 }
6366 }
@@ -72,10 +75,12 @@ final public function makeBinaryParam(?string $binaryStr): array
7275 return [$ binaryStr , PDO ::PARAM_LOB , 0 , $ driverOptions ];
7376 }
7477
75- /** @internal */
78+ /**
79+ * @param array{0: string, 1: int|null, 2: string|null} $error
80+ * @internal
81+ */
7682 public static function getError (string $ message , array $ error ): SqlException
7783 {
78- /** @var array{0: string, 1: int|null, 2: string|null} $error */
7984 $ code = $ error [1 ] ?? 0 ;
8085 $ details = $ error [2 ] ?? '' ;
8186 $ sqlState = $ error [0 ];
@@ -84,18 +89,19 @@ public static function getError(string $message, array $error): SqlException
8489 }
8590
8691 /**
87- * Returns a prepared statement which can be executed multiple times
92+ * Returns a prepared statement which can be executed multiple times.
93+ * @param list<mixed> $params
8894 * @throws SqlException if an error occurs
8995 */
9096 public function prepare (string $ sql , array $ params = []): Statement
9197 {
9298 try {
9399 if (!$ stmt = $ this ->conn ->prepare ($ sql )) {
100+ /** @phpstan-ignore argument.type */
94101 throw $ this ->getError ('Failed to prepare statement ' , $ this ->conn ->errorInfo ());
95102 }
96103
97104 $ i = 0 ;
98- /** @psalm-suppress MixedAssignment */
99105 foreach ($ params as &$ param ) {
100106 $ i ++;
101107
@@ -111,14 +117,16 @@ public function prepare(string $sql, array $params = []): Statement
111117 }
112118 }
113119 } catch (\PDOException $ e ) {
120+ /** @phpstan-ignore argument.type */
114121 throw $ this ->getError ('Failed to prepare statement ' , $ this ->conn ->errorInfo ());
115122 }
116123
117124 return new Statement ($ stmt , $ this ->usedPrepare , $ this ->options );
118125 }
119126
120127 /**
121- * Prepares and executes a single query with bound parameters
128+ * Prepares and executes a single query with bound parameters.
129+ * @param list<mixed> $params
122130 */
123131 public function query (string $ sql , array $ params = []): Statement
124132 {
0 commit comments