mirror of
https://github.com/dg/dibi.git
synced 2025-08-06 06:07:39 +02:00
type fixes
This commit is contained in:
@@ -482,10 +482,9 @@ class Connection
|
||||
/**
|
||||
* Executes SQL query and fetch result - shortcut for query() & fetch().
|
||||
* @param mixed one or more arguments
|
||||
* @return Row|NULL
|
||||
* @throws Exception
|
||||
*/
|
||||
public function fetch(...$args)
|
||||
public function fetch(...$args): ?Row
|
||||
{
|
||||
return $this->query($args)->fetch();
|
||||
}
|
||||
|
@@ -155,9 +155,8 @@ class DataSource implements IDataSource
|
||||
|
||||
/**
|
||||
* Generates, executes SQL query and fetches the single row.
|
||||
* @return Row|NULL
|
||||
*/
|
||||
public function fetch()
|
||||
public function fetch(): ?Row
|
||||
{
|
||||
return $this->getResult()->fetch();
|
||||
}
|
||||
|
@@ -24,7 +24,7 @@ class DateTime extends \DateTime
|
||||
{
|
||||
if (is_numeric($time)) {
|
||||
parent::__construct('@' . $time);
|
||||
$this->setTimeZone($timezone ? $timezone : new \DateTimeZone(date_default_timezone_get()));
|
||||
$this->setTimezone($timezone ? $timezone : new \DateTimeZone(date_default_timezone_get()));
|
||||
} elseif ($timezone === null) {
|
||||
parent::__construct($time);
|
||||
} else {
|
||||
@@ -44,7 +44,7 @@ class DateTime extends \DateTime
|
||||
{
|
||||
$zone = $this->getTimezone();
|
||||
$this->__construct('@' . $timestamp);
|
||||
return $this->setTimeZone($zone);
|
||||
return $this->setTimezone($zone);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -302,9 +302,8 @@ class Fluent implements IDataSource
|
||||
|
||||
/**
|
||||
* Generates, executes SQL query and fetches the single row.
|
||||
* @return Row|NULL
|
||||
*/
|
||||
public function fetch()
|
||||
public function fetch(): ?Row
|
||||
{
|
||||
if ($this->command === 'SELECT' && !$this->clauses['LIMIT']) {
|
||||
return $this->query($this->_export(null, ['%lmt', 1]))->fetch();
|
||||
|
@@ -289,7 +289,6 @@ class Helpers
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @return string|int
|
||||
*/
|
||||
public static function intVal($value): int
|
||||
{
|
||||
|
@@ -32,13 +32,13 @@ class Result implements IDataSource
|
||||
{
|
||||
use Strict;
|
||||
|
||||
/** @var array ResultDriver */
|
||||
/** @var ResultDriver|null */
|
||||
private $driver;
|
||||
|
||||
/** @var array Translate table */
|
||||
private $types = [];
|
||||
|
||||
/** @var Reflection\Result */
|
||||
/** @var Reflection\Result|null */
|
||||
private $meta;
|
||||
|
||||
/** @var bool Already fetched? Used for allowance for first seek(0) */
|
||||
@@ -162,7 +162,7 @@ class Result implements IDataSource
|
||||
/**
|
||||
* Fetches the row at current position, process optional type conversion.
|
||||
* and moves the internal cursor to the next position
|
||||
* @return ?Row|array
|
||||
* @return Row|array|null
|
||||
*/
|
||||
final public function fetch()
|
||||
{
|
||||
|
@@ -31,8 +31,9 @@ class Row implements \ArrayAccess, \IteratorAggregate, \Countable
|
||||
|
||||
/**
|
||||
* Converts value to DateTime object.
|
||||
* @return \DateTime|string|null
|
||||
*/
|
||||
public function asDateTime(string $key, string $format = null): \DateTime
|
||||
public function asDateTime(string $key, string $format = null)
|
||||
{
|
||||
$time = $this[$key];
|
||||
if (!$time instanceof DateTime) {
|
||||
|
@@ -170,10 +170,9 @@ class dibi
|
||||
/**
|
||||
* Executes SQL query and fetch result - Monostate for Dibi\Connection::query() & fetch().
|
||||
* @param mixed one or more arguments
|
||||
* @return Dibi\Row|NULL
|
||||
* @throws Dibi\Exception
|
||||
*/
|
||||
public static function fetch(...$args)
|
||||
public static function fetch(...$args): ?Dibi\Row
|
||||
{
|
||||
return self::getConnection()->query($args)->fetch();
|
||||
}
|
||||
|
Reference in New Issue
Block a user