mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 02:31:40 +09:00
Clarify return types of DB::prepare() and DB::query()
This commit is contained in:
parent
63e81751b1
commit
0da9244e33
1 changed files with 6 additions and 3 deletions
|
|
@ -171,6 +171,9 @@ class DB
|
|||
* Table names in the FROM or JOIN clause of the statement are
|
||||
* automatically prefixed with the configured prefix.
|
||||
*
|
||||
* Note that this method will throw an exception (DBError) on error,
|
||||
* instead of returning false or null as legacy functions do.
|
||||
*
|
||||
* @param string $statement
|
||||
* @param array $driver_options
|
||||
* @return Helpers\DBStmtHelper
|
||||
|
|
@ -205,9 +208,9 @@ class DB
|
|||
*
|
||||
* @param string $query_string
|
||||
* @param mixed ...$args
|
||||
* @return Helpers\DBStmtHelper
|
||||
* @return ?Helpers\DBStmtHelper
|
||||
*/
|
||||
public function query(string $query_string, ...$args): Helpers\DBStmtHelper
|
||||
public function query(string $query_string, ...$args): ?Helpers\DBStmtHelper
|
||||
{
|
||||
// If query parameters are given as a single array, unpack it.
|
||||
if (count($args) === 1 && is_array($args[0]))
|
||||
|
|
@ -235,7 +238,7 @@ class DB
|
|||
{
|
||||
$this->_last_stmt = $this->_handle->query($query_string);
|
||||
}
|
||||
return $this->_last_stmt;
|
||||
return $this->_last_stmt ?: null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue