diff --git a/src/Dibi/Connection.php b/src/Dibi/Connection.php index 69f2cef2..785406ef 100644 --- a/src/Dibi/Connection.php +++ b/src/Dibi/Connection.php @@ -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(); } diff --git a/src/Dibi/DataSource.php b/src/Dibi/DataSource.php index 15365796..af013b57 100644 --- a/src/Dibi/DataSource.php +++ b/src/Dibi/DataSource.php @@ -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(); } diff --git a/src/Dibi/DateTime.php b/src/Dibi/DateTime.php index 0347bee1..e71a3bf1 100644 --- a/src/Dibi/DateTime.php +++ b/src/Dibi/DateTime.php @@ -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); } diff --git a/src/Dibi/Fluent.php b/src/Dibi/Fluent.php index 21007604..f637159d 100644 --- a/src/Dibi/Fluent.php +++ b/src/Dibi/Fluent.php @@ -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(); diff --git a/src/Dibi/Helpers.php b/src/Dibi/Helpers.php index e13dcaef..d1b3d80f 100644 --- a/src/Dibi/Helpers.php +++ b/src/Dibi/Helpers.php @@ -289,7 +289,6 @@ class Helpers /** * @internal - * @return string|int */ public static function intVal($value): int { diff --git a/src/Dibi/Result.php b/src/Dibi/Result.php index 11030dc5..5add1ee5 100644 --- a/src/Dibi/Result.php +++ b/src/Dibi/Result.php @@ -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() { diff --git a/src/Dibi/Row.php b/src/Dibi/Row.php index 3ff38393..ef96dd33 100644 --- a/src/Dibi/Row.php +++ b/src/Dibi/Row.php @@ -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) { diff --git a/src/Dibi/dibi.php b/src/Dibi/dibi.php index f9cd61e1..27ef0347 100644 --- a/src/Dibi/dibi.php +++ b/src/Dibi/dibi.php @@ -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(); }