Skip to content

Commit a9d59be

Browse files
committed
Add template types to PreparedQuery
1 parent 6309010 commit a9d59be

File tree

7 files changed

+13
-35
lines changed

7 files changed

+13
-35
lines changed

phpstan-baseline.neon.dist

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -200,26 +200,6 @@ parameters:
200200
count: 3
201201
path: system/Database/MySQLi/PreparedQuery.php
202202

203-
-
204-
message: "#^Cannot call method bind_param\\(\\) on object\\|resource\\.$#"
205-
count: 1
206-
path: system/Database/MySQLi/PreparedQuery.php
207-
208-
-
209-
message: "#^Cannot call method execute\\(\\) on object\\|resource\\.$#"
210-
count: 1
211-
path: system/Database/MySQLi/PreparedQuery.php
212-
213-
-
214-
message: "#^Cannot call method get_result\\(\\) on object\\|resource\\.$#"
215-
count: 1
216-
path: system/Database/MySQLi/PreparedQuery.php
217-
218-
-
219-
message: "#^Cannot call method close\\(\\) on object\\|resource\\.$#"
220-
count: 1
221-
path: system/Database/MySQLi/PreparedQuery.php
222-
223203
-
224204
message: "#^Cannot access property \\$field_count on object\\|resource\\|false\\.$#"
225205
count: 1
@@ -315,16 +295,6 @@ parameters:
315295
count: 1
316296
path: system/Database/SQLite3/Connection.php
317297

318-
-
319-
message: "#^Cannot call method bindValue\\(\\) on object\\|resource\\.$#"
320-
count: 1
321-
path: system/Database/SQLite3/PreparedQuery.php
322-
323-
-
324-
message: "#^Cannot call method execute\\(\\) on object\\|resource\\.$#"
325-
count: 1
326-
path: system/Database/SQLite3/PreparedQuery.php
327-
328298
-
329299
message: "#^Cannot call method lastErrorCode\\(\\) on bool\\|object\\|resource\\.$#"
330300
count: 1
@@ -340,11 +310,6 @@ parameters:
340310
count: 1
341311
path: system/Database/SQLite3/PreparedQuery.php
342312

343-
-
344-
message: "#^Cannot call method close\\(\\) on object\\|resource\\.$#"
345-
count: 1
346-
path: system/Database/SQLite3/PreparedQuery.php
347-
348313
-
349314
message: "#^Cannot call method columnName\\(\\) on object\\|resource\\|false\\.$#"
350315
count: 2

system/Database/BasePreparedQuery.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,16 @@
1919

2020
/**
2121
* Base prepared query
22+
*
23+
* @template TStatement of object|resource
2224
*/
2325
abstract class BasePreparedQuery implements PreparedQueryInterface
2426
{
2527
/**
2628
* The prepared statement itself.
2729
*
2830
* @var object|resource|null
31+
* @phpstan-var TStatement|null
2932
*/
3033
protected $statement;
3134

system/Database/MySQLi/PreparedQuery.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
/**
1919
* Prepared query for MySQLi
20+
*
21+
* @extends BasePreparedQuery<\mysqli_stmt>
2022
*/
2123
class PreparedQuery extends BasePreparedQuery
2224
{

system/Database/OCI8/PreparedQuery.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
/**
2020
* Prepared query for OCI8
21+
*
22+
* @extends BasePreparedQuery<resource>
2123
*/
2224
class PreparedQuery extends BasePreparedQuery implements PreparedQueryInterface
2325
{

system/Database/Postgre/PreparedQuery.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
/**
2020
* Prepared query for Postgre
21+
*
22+
* @extends BasePreparedQuery<\PgSql\Result>
2123
*/
2224
class PreparedQuery extends BasePreparedQuery
2325
{

system/Database/SQLSRV/PreparedQuery.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
/**
2020
* Prepared query for Postgre
21+
*
22+
* @extends BasePreparedQuery<resource>
2123
*/
2224
class PreparedQuery extends BasePreparedQuery
2325
{

system/Database/SQLite3/PreparedQuery.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
/**
1919
* Prepared query for SQLite3
20+
*
21+
* @extends BasePreparedQuery<\SQLite3Stmt>
2022
*/
2123
class PreparedQuery extends BasePreparedQuery
2224
{

0 commit comments

Comments
 (0)