Skip to content

Commit 2053cea

Browse files
committed
Database PreparedQuery typos changes
1 parent 48c4dc5 commit 2053cea

4 files changed

Lines changed: 14 additions & 10 deletions

File tree

system/Database/BasePreparedQuery.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737

3838
namespace CodeIgniter\Database;
3939

40+
use CodeIgniter\Database\MySQLi\Connection;
4041
use CodeIgniter\Events\Events;
4142

4243
/**
@@ -85,7 +86,7 @@ abstract class BasePreparedQuery implements PreparedQueryInterface
8586

8687
public function __construct(ConnectionInterface $db)
8788
{
88-
$this->db = & $db;
89+
$this->db = &$db;
8990
}
9091

9192
//--------------------------------------------------------------------
@@ -103,7 +104,7 @@ public function __construct(ConnectionInterface $db)
103104
*
104105
* @return mixed
105106
*/
106-
public function prepare(string $sql, array $options = [], $queryClass = 'CodeIgniter\\Database\\Query')
107+
public function prepare(string $sql, array $options = [], string $queryClass = 'CodeIgniter\\Database\\Query')
107108
{
108109
// We only supports positional placeholders (?)
109110
// in order to work with the execute method below, so we
@@ -180,9 +181,9 @@ public function execute(...$data)
180181
*
181182
* @param array $data
182183
*
183-
* @return ResultInterface
184+
* @return boolean
184185
*/
185-
abstract public function _execute($data);
186+
abstract public function _execute(array $data): bool;
186187

187188
//--------------------------------------------------------------------
188189

@@ -196,7 +197,9 @@ abstract public function _getResult();
196197
//--------------------------------------------------------------------
197198

198199
/**
199-
* Explicity closes the statement.
200+
* Explicitly closes the statement.
201+
*
202+
* @return null|void
200203
*/
201204
public function close()
202205
{
@@ -232,7 +235,7 @@ public function getQueryString(): string
232235
*
233236
* @return boolean
234237
*/
235-
public function hasError()
238+
public function hasError(): bool
236239
{
237240
return ! empty($this->errorString);
238241
}

system/Database/MySQLi/PreparedQuery.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ public function _prepare(string $sql, array $options = [])
8080
*
8181
* @param array $data
8282
*
83-
* @return \CodeIgniter\Database\ResultInterface
83+
* @return bool
8484
*/
85-
public function _execute($data)
85+
public function _execute(array $data): bool
8686
{
8787
if (is_null($this->statement))
8888
{

system/Database/Postgre/PreparedQuery.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ class PreparedQuery extends BasePreparedQuery implements PreparedQueryInterface
7474
* Unused in the MySQLi driver.
7575
*
7676
* @return mixed
77+
* @throws \Exception
7778
*/
7879
public function _prepare(string $sql, array $options = [])
7980
{
@@ -104,7 +105,7 @@ public function _prepare(string $sql, array $options = [])
104105
*
105106
* @return boolean
106107
*/
107-
public function _execute($data)
108+
public function _execute(array $data): bool
108109
{
109110
if (is_null($this->statement))
110111
{

system/Database/SQLite3/PreparedQuery.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public function _prepare(string $sql, array $options = [])
8989
*
9090
* @return boolean
9191
*/
92-
public function _execute($data)
92+
public function _execute(array $data): bool
9393
{
9494
if (is_null($this->statement))
9595
{

0 commit comments

Comments
 (0)