From 08dfc37492f9e8b7fd54e0f423c9cfb0b4633cbf Mon Sep 17 00:00:00 2001 From: David Grudl Date: Sun, 12 Dec 2021 17:40:23 +0100 Subject: [PATCH] added PHP 8 typehints --- src/Dibi/Bridges/Tracy/Panel.php | 2 +- src/Dibi/Connection.php | 33 +++++++++-------------------- src/Dibi/DataSource.php | 10 ++++----- src/Dibi/DateTime.php | 5 +---- src/Dibi/Drivers/DummyDriver.php | 5 +++-- src/Dibi/Drivers/FirebirdDriver.php | 2 +- src/Dibi/Drivers/FirebirdResult.php | 2 +- src/Dibi/Drivers/MySqliDriver.php | 5 +---- src/Dibi/Drivers/NoDataResult.php | 2 +- src/Dibi/Drivers/OdbcDriver.php | 2 +- src/Dibi/Drivers/OdbcResult.php | 2 +- src/Dibi/Drivers/OracleDriver.php | 2 +- src/Dibi/Drivers/OracleResult.php | 2 +- src/Dibi/Drivers/PostgreDriver.php | 2 +- src/Dibi/Drivers/PostgreResult.php | 2 +- src/Dibi/Drivers/SqlsrvDriver.php | 2 +- src/Dibi/Drivers/SqlsrvResult.php | 2 +- src/Dibi/Event.php | 5 +---- src/Dibi/Fluent.php | 21 +++++++++--------- src/Dibi/Helpers.php | 9 ++++---- src/Dibi/Reflection/Column.php | 6 ++---- src/Dibi/Result.php | 17 +++++++-------- src/Dibi/ResultIterator.php | 6 ++---- src/Dibi/Row.php | 6 ++---- src/Dibi/Translator.php | 3 +-- src/Dibi/dibi.php | 5 ++--- src/Dibi/exceptions.php | 11 +++++----- src/Dibi/interfaces.php | 7 ++---- 28 files changed, 72 insertions(+), 106 deletions(-) diff --git a/src/Dibi/Bridges/Tracy/Panel.php b/src/Dibi/Bridges/Tracy/Panel.php index de1614a..268e18e 100644 --- a/src/Dibi/Bridges/Tracy/Panel.php +++ b/src/Dibi/Bridges/Tracy/Panel.php @@ -26,7 +26,7 @@ class Panel implements Tracy\IBarPanel private array $events = []; - public function __construct($explain = true, ?int $filter = null) + public function __construct(bool $explain = true, ?int $filter = null) { $this->filter = $filter ?: Event::QUERY; $this->explain = $explain; diff --git a/src/Dibi/Connection.php b/src/Dibi/Connection.php index e43b8e2..2042ae3 100644 --- a/src/Dibi/Connection.php +++ b/src/Dibi/Connection.php @@ -179,9 +179,8 @@ class Connection implements IConnection /** * Returns configuration variable. If no $key is passed, returns the entire array. * @see self::__construct - * @return mixed */ - final public function getConfig(?string $key = null, $default = null) + final public function getConfig(?string $key = null, $default = null): mixed { return $key === null ? $this->config @@ -204,10 +203,9 @@ class Connection implements IConnection /** * Generates (translates) and executes SQL query. - * @param mixed ...$args * @throws Exception */ - final public function query(...$args): Result + final public function query(mixed ...$args): Result { return $this->nativeQuery($this->translate(...$args)); } @@ -215,10 +213,9 @@ class Connection implements IConnection /** * Generates SQL query. - * @param mixed ...$args * @throws Exception */ - final public function translate(...$args): string + final public function translate(mixed ...$args): string { if (!$this->driver) { $this->connect(); @@ -230,9 +227,8 @@ class Connection implements IConnection /** * Generates and prints SQL query. - * @param mixed ...$args */ - final public function test(...$args): bool + final public function test(mixed ...$args): bool { try { Helpers::dump($this->translate(...$args)); @@ -252,10 +248,9 @@ class Connection implements IConnection /** * Generates (translates) and returns SQL query as DataSource. - * @param mixed ...$args * @throws Exception */ - final public function dataSource(...$args): DataSource + final public function dataSource(mixed ...$args): DataSource { return new DataSource($this->translate(...$args), $this); } @@ -418,10 +413,7 @@ class Connection implements IConnection } - /** - * @return mixed - */ - public function transaction(callable $callback) + public function transaction(callable $callback): mixed { if ($this->transactionDepth === 0) { $this->begin(); @@ -527,10 +519,9 @@ class Connection implements IConnection /** * Executes SQL query and fetch result - shortcut for query() & fetch(). - * @param mixed ...$args * @throws Exception */ - public function fetch(...$args): ?Row + public function fetch(mixed ...$args): ?Row { return $this->query($args)->fetch(); } @@ -538,11 +529,10 @@ class Connection implements IConnection /** * Executes SQL query and fetch results - shortcut for query() & fetchAll(). - * @param mixed ...$args * @return Row[]|array[] * @throws Exception */ - public function fetchAll(...$args): array + public function fetchAll(mixed ...$args): array { return $this->query($args)->fetchAll(); } @@ -550,11 +540,9 @@ class Connection implements IConnection /** * Executes SQL query and fetch first column - shortcut for query() & fetchSingle(). - * @param mixed ...$args - * @return mixed * @throws Exception */ - public function fetchSingle(...$args) + public function fetchSingle(mixed ...$args): mixed { return $this->query($args)->fetchSingle(); } @@ -562,10 +550,9 @@ class Connection implements IConnection /** * Executes SQL query and fetch pairs - shortcut for query() & fetchPairs(). - * @param mixed ...$args * @throws Exception */ - public function fetchPairs(...$args): array + public function fetchPairs(mixed ...$args): array { return $this->query($args)->fetchPairs(); } diff --git a/src/Dibi/DataSource.php b/src/Dibi/DataSource.php index 1367aaf..89aa370 100644 --- a/src/Dibi/DataSource.php +++ b/src/Dibi/DataSource.php @@ -44,7 +44,7 @@ class DataSource implements IDataSource * @param string|array $col column name or array of column names * @param string $as column alias */ - public function select($col, ?string $as = null): self + public function select(string|array $col, ?string $as = null): static { if (is_array($col)) { $this->cols = $col; @@ -60,7 +60,7 @@ class DataSource implements IDataSource /** * Adds conditions to query. */ - public function where($cond): self + public function where($cond): static { $this->conds[] = is_array($cond) ? $cond // TODO: not consistent with select and orderBy @@ -74,7 +74,7 @@ class DataSource implements IDataSource * Selects columns to order by. * @param string|array $row column name or array of column names */ - public function orderBy($row, string $direction = 'ASC'): self + public function orderBy(string|array $row, string $direction = 'ASC'): static { if (is_array($row)) { $this->sorting = $row; @@ -90,7 +90,7 @@ class DataSource implements IDataSource /** * Limits number of rows. */ - public function applyLimit(int $limit, ?int $offset = null): self + public function applyLimit(int $limit, ?int $offset = null): static { $this->limit = $limit; $this->offset = $offset; @@ -140,7 +140,7 @@ class DataSource implements IDataSource * Like fetch(), but returns only first field. * @return mixed value on success, null if no next record */ - public function fetchSingle() + public function fetchSingle(): mixed { return $this->getResult()->fetchSingle(); } diff --git a/src/Dibi/DateTime.php b/src/Dibi/DateTime.php index 849e6a2..befcd98 100644 --- a/src/Dibi/DateTime.php +++ b/src/Dibi/DateTime.php @@ -15,10 +15,7 @@ namespace Dibi; */ class DateTime extends \DateTimeImmutable { - /** - * @param string|int $time - */ - public function __construct($time = 'now', ?\DateTimeZone $timezone = null) + public function __construct(string|int $time = 'now', ?\DateTimeZone $timezone = null) { $timezone = $timezone ?: new \DateTimeZone(date_default_timezone_get()); if (is_numeric($time)) { diff --git a/src/Dibi/Drivers/DummyDriver.php b/src/Dibi/Drivers/DummyDriver.php index 9dac7d6..6f8b0e6 100644 --- a/src/Dibi/Drivers/DummyDriver.php +++ b/src/Dibi/Drivers/DummyDriver.php @@ -55,7 +55,7 @@ class DummyDriver implements Dibi\Driver, Dibi\ResultDriver, Dibi\Reflector } - public function getResource() + public function getResource(): mixed { return null; } @@ -169,8 +169,9 @@ class DummyDriver implements Dibi\Driver, Dibi\ResultDriver, Dibi\Reflector } - public function getResultResource() + public function getResultResource(): mixed { + return null; } diff --git a/src/Dibi/Drivers/FirebirdDriver.php b/src/Dibi/Drivers/FirebirdDriver.php index 962f974..dcd545f 100644 --- a/src/Dibi/Drivers/FirebirdDriver.php +++ b/src/Dibi/Drivers/FirebirdDriver.php @@ -187,7 +187,7 @@ class FirebirdDriver implements Dibi\Driver * Returns the connection resource. * @return resource|null */ - public function getResource() + public function getResource(): mixed { return is_resource($this->connection) ? $this->connection : null; } diff --git a/src/Dibi/Drivers/FirebirdResult.php b/src/Dibi/Drivers/FirebirdResult.php index e40dd48..a4c0ba7 100644 --- a/src/Dibi/Drivers/FirebirdResult.php +++ b/src/Dibi/Drivers/FirebirdResult.php @@ -87,7 +87,7 @@ class FirebirdResult implements Dibi\ResultDriver * Returns the result set resource. * @return resource|null */ - public function getResultResource() + public function getResultResource(): mixed { return is_resource($this->resultSet) ? $this->resultSet : null; } diff --git a/src/Dibi/Drivers/MySqliDriver.php b/src/Dibi/Drivers/MySqliDriver.php index fd4e80d..f0bd33b 100644 --- a/src/Dibi/Drivers/MySqliDriver.php +++ b/src/Dibi/Drivers/MySqliDriver.php @@ -152,10 +152,7 @@ class MySqliDriver implements Dibi\Driver } - /** - * @param int|string $code - */ - public static function createException(string $message, $code, string $sql): Dibi\DriverException + public static function createException(string $message, int|string $code, string $sql): Dibi\DriverException { if (in_array($code, [1216, 1217, 1451, 1452, 1701], true)) { return new Dibi\ForeignKeyConstraintViolationException($message, $code, $sql); diff --git a/src/Dibi/Drivers/NoDataResult.php b/src/Dibi/Drivers/NoDataResult.php index 6172457..f427dc4 100644 --- a/src/Dibi/Drivers/NoDataResult.php +++ b/src/Dibi/Drivers/NoDataResult.php @@ -58,7 +58,7 @@ class NoDataResult implements Dibi\ResultDriver } - public function getResultResource() + public function getResultResource(): mixed { return null; } diff --git a/src/Dibi/Drivers/OdbcDriver.php b/src/Dibi/Drivers/OdbcDriver.php index 6050283..5e9df98 100644 --- a/src/Dibi/Drivers/OdbcDriver.php +++ b/src/Dibi/Drivers/OdbcDriver.php @@ -166,7 +166,7 @@ class OdbcDriver implements Dibi\Driver * Returns the connection resource. * @return resource|null */ - public function getResource() + public function getResource(): mixed { return is_resource($this->connection) ? $this->connection : null; } diff --git a/src/Dibi/Drivers/OdbcResult.php b/src/Dibi/Drivers/OdbcResult.php index 84fab2b..c8d88e7 100644 --- a/src/Dibi/Drivers/OdbcResult.php +++ b/src/Dibi/Drivers/OdbcResult.php @@ -109,7 +109,7 @@ class OdbcResult implements Dibi\ResultDriver * Returns the result set resource. * @return resource|null */ - public function getResultResource() + public function getResultResource(): mixed { return is_resource($this->resultSet) ? $this->resultSet : null; } diff --git a/src/Dibi/Drivers/OracleDriver.php b/src/Dibi/Drivers/OracleDriver.php index f431e1e..46a757d 100644 --- a/src/Dibi/Drivers/OracleDriver.php +++ b/src/Dibi/Drivers/OracleDriver.php @@ -180,7 +180,7 @@ class OracleDriver implements Dibi\Driver * Returns the connection resource. * @return resource|null */ - public function getResource() + public function getResource(): mixed { return is_resource($this->connection) ? $this->connection : null; } diff --git a/src/Dibi/Drivers/OracleResult.php b/src/Dibi/Drivers/OracleResult.php index 8c5adff..258b077 100644 --- a/src/Dibi/Drivers/OracleResult.php +++ b/src/Dibi/Drivers/OracleResult.php @@ -93,7 +93,7 @@ class OracleResult implements Dibi\ResultDriver * Returns the result set resource. * @return resource|null */ - public function getResultResource() + public function getResultResource(): mixed { return is_resource($this->resultSet) ? $this->resultSet : null; } diff --git a/src/Dibi/Drivers/PostgreDriver.php b/src/Dibi/Drivers/PostgreDriver.php index 6a3bd4e..776e528 100644 --- a/src/Dibi/Drivers/PostgreDriver.php +++ b/src/Dibi/Drivers/PostgreDriver.php @@ -224,7 +224,7 @@ class PostgreDriver implements Dibi\Driver * Returns the connection resource. * @return resource|null */ - public function getResource() + public function getResource(): mixed { return is_resource($this->connection) || $this->connection instanceof PgSql\Connection ? $this->connection diff --git a/src/Dibi/Drivers/PostgreResult.php b/src/Dibi/Drivers/PostgreResult.php index 1594e31..bcbecd2 100644 --- a/src/Dibi/Drivers/PostgreResult.php +++ b/src/Dibi/Drivers/PostgreResult.php @@ -96,7 +96,7 @@ class PostgreResult implements Dibi\ResultDriver * Returns the result set resource. * @return resource|PgSql\Result|null */ - public function getResultResource() + public function getResultResource(): mixed { return is_resource($this->resultSet) || $this->resultSet instanceof PgSql\Result ? $this->resultSet diff --git a/src/Dibi/Drivers/SqlsrvDriver.php b/src/Dibi/Drivers/SqlsrvDriver.php index d741cc6..523fd19 100644 --- a/src/Dibi/Drivers/SqlsrvDriver.php +++ b/src/Dibi/Drivers/SqlsrvDriver.php @@ -164,7 +164,7 @@ class SqlsrvDriver implements Dibi\Driver * Returns the connection resource. * @return resource|null */ - public function getResource() + public function getResource(): mixed { return is_resource($this->connection) ? $this->connection : null; } diff --git a/src/Dibi/Drivers/SqlsrvResult.php b/src/Dibi/Drivers/SqlsrvResult.php index c9b7dbc..ecd6ed5 100644 --- a/src/Dibi/Drivers/SqlsrvResult.php +++ b/src/Dibi/Drivers/SqlsrvResult.php @@ -89,7 +89,7 @@ class SqlsrvResult implements Dibi\ResultDriver * Returns the result set resource. * @return resource|null */ - public function getResultResource() + public function getResultResource(): mixed { return is_resource($this->resultSet) ? $this->resultSet : null; } diff --git a/src/Dibi/Event.php b/src/Dibi/Event.php index d3cfc94..9777b82 100644 --- a/src/Dibi/Event.php +++ b/src/Dibi/Event.php @@ -71,10 +71,7 @@ class Event } - /** - * @param Result|DriverException|null $result - */ - public function done($result = null): self + public function done(Result|DriverException|null $result = null): static { $this->result = $result; try { diff --git a/src/Dibi/Fluent.php b/src/Dibi/Fluent.php index 7b4bc68..5c4a643 100644 --- a/src/Dibi/Fluent.php +++ b/src/Dibi/Fluent.php @@ -115,7 +115,7 @@ class Fluent implements IDataSource /** * Appends new argument to the clause. */ - public function __call(string $clause, array $args): self + public function __call(string $clause, array $args): static { $clause = self::$normalizer->$clause; @@ -202,7 +202,7 @@ class Fluent implements IDataSource /** * Switch to a clause. */ - public function clause(string $clause): self + public function clause(string $clause): static { $this->cursor = &$this->clauses[self::$normalizer->$clause]; if ($this->cursor === null) { @@ -216,7 +216,7 @@ class Fluent implements IDataSource /** * Removes a clause. */ - public function removeClause(string $clause): self + public function removeClause(string $clause): static { $this->clauses[self::$normalizer->$clause] = null; return $this; @@ -226,7 +226,7 @@ class Fluent implements IDataSource /** * Change a SQL flag. */ - public function setFlag(string $flag, bool $value = true): self + public function setFlag(string $flag, bool $value = true): static { $flag = strtoupper($flag); if ($value) { @@ -266,7 +266,7 @@ class Fluent implements IDataSource /** * Adds Result setup. */ - public function setupResult(string $method): self + public function setupResult(string $method): static { $this->setups[] = func_get_args(); return $this; @@ -278,10 +278,10 @@ class Fluent implements IDataSource /** * Generates and executes SQL query. - * @return Result|int|null result set or number of affected rows + * Returns result set or number of affected rows * @throws Exception */ - public function execute(?string $return = null) + public function execute(?string $return = null): Result|int|null { $res = $this->query($this->_export()); switch ($return) { @@ -297,9 +297,8 @@ class Fluent implements IDataSource /** * Generates, executes SQL query and fetches the single row. - * @return Row|array|null */ - public function fetch() + public function fetch(): Row|array|null { return $this->command === 'SELECT' && !$this->clauses['LIMIT'] ? $this->query($this->_export(null, ['%lmt', 1]))->fetch() @@ -309,9 +308,9 @@ class Fluent implements IDataSource /** * Like fetch(), but returns only first field. - * @return mixed value on success, null if no next record + * Returns value on success, null if no next record */ - public function fetchSingle() + public function fetchSingle(): mixed { return $this->command === 'SELECT' && !$this->clauses['LIMIT'] ? $this->query($this->_export(null, ['%lmt', 1]))->fetchSingle() diff --git a/src/Dibi/Helpers.php b/src/Dibi/Helpers.php index af59f3c..cf67a86 100644 --- a/src/Dibi/Helpers.php +++ b/src/Dibi/Helpers.php @@ -17,9 +17,8 @@ class Helpers /** * Prints out a syntax highlighted version of the SQL command or Result. - * @param string|Result $sql */ - public static function dump($sql = null, bool $return = false): ?string + public static function dump(string|Result|null $sql = null, bool $return = false): ?string { ob_start(); if ($sql instanceof Result && PHP_SAPI === 'cli') { @@ -235,7 +234,7 @@ class Helpers /** * Import SQL dump from file. - * @return int count of sql commands + * Returns count of sql commands */ public static function loadFromFile(Connection $connection, string $file, ?callable $onProgress = null): int { @@ -283,14 +282,14 @@ class Helpers /** @internal */ - public static function false2Null($val) + public static function false2Null(mixed $val): mixed { return $val === false ? null : $val; } /** @internal */ - public static function intVal($value): int + public static function intVal(mixed $value): int { if (is_int($value)) { return $value; diff --git a/src/Dibi/Reflection/Column.php b/src/Dibi/Reflection/Column.php index ad1793d..5415501 100644 --- a/src/Dibi/Reflection/Column.php +++ b/src/Dibi/Reflection/Column.php @@ -107,15 +107,13 @@ class Column } - /** @return mixed */ - public function getDefault() + public function getDefault(): mixed { return $this->info['default'] ?? null; } - /** @return mixed */ - public function getVendorInfo(string $key) + public function getVendorInfo(string $key): mixed { return $this->info['vendor'][$key] ?? null; } diff --git a/src/Dibi/Result.php b/src/Dibi/Result.php index 502a7a4..d089b19 100644 --- a/src/Dibi/Result.php +++ b/src/Dibi/Result.php @@ -126,7 +126,7 @@ class Result implements IDataSource /** * Set fetched object class. This class should extend the Row class. */ - public function setRowClass(?string $class): self + public function setRowClass(?string $class): static { $this->rowClass = $class; return $this; @@ -145,7 +145,7 @@ class Result implements IDataSource /** * Set a factory to create fetched object instances. These should extend the Row class. */ - public function setRowFactory(callable $callback): self + public function setRowFactory(callable $callback): static { $this->rowFactory = $callback; return $this; @@ -155,9 +155,8 @@ 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|null */ - final public function fetch() + final public function fetch(): mixed { $row = $this->getResultDriver()->fetch(true); if ($row === null) { @@ -178,9 +177,9 @@ class Result implements IDataSource /** * Like fetch(), but returns only first field. - * @return mixed value on success, null if no next record + * Returns value on success, null if no next record */ - final public function fetchSingle() + final public function fetchSingle(): mixed { $row = $this->getResultDriver()->fetch(true); if ($row === null) { @@ -522,7 +521,7 @@ class Result implements IDataSource * Define column type. * @param string|null $type use constant Type::* */ - final public function setType(string $column, ?string $type): self + final public function setType(string $column, ?string $type): static { $this->types[$column] = $type; return $this; @@ -550,7 +549,7 @@ class Result implements IDataSource /** * Sets type format. */ - final public function setFormat(string $type, ?string $format): self + final public function setFormat(string $type, ?string $format): static { $this->formats[$type] = $format; return $this; @@ -560,7 +559,7 @@ class Result implements IDataSource /** * Sets type formats. */ - final public function setFormats(array $formats): self + final public function setFormats(array $formats): static { $this->formats = $formats; return $this; diff --git a/src/Dibi/ResultIterator.php b/src/Dibi/ResultIterator.php index a6c609b..505489a 100644 --- a/src/Dibi/ResultIterator.php +++ b/src/Dibi/ResultIterator.php @@ -39,10 +39,9 @@ class ResultIterator implements \Iterator, \Countable /** * Returns the key of the current element. - * @return mixed */ #[\ReturnTypeWillChange] - public function key() + public function key(): mixed { return $this->pointer; } @@ -50,10 +49,9 @@ class ResultIterator implements \Iterator, \Countable /** * Returns the current element. - * @return mixed */ #[\ReturnTypeWillChange] - public function current() + public function current(): mixed { return $this->row; } diff --git a/src/Dibi/Row.php b/src/Dibi/Row.php index 07dfd74..ad4a17d 100644 --- a/src/Dibi/Row.php +++ b/src/Dibi/Row.php @@ -32,9 +32,8 @@ class Row implements \ArrayAccess, \IteratorAggregate, \Countable /** * Converts value to DateTime object. - * @return DateTime|string|null */ - public function asDateTime(string $key, ?string $format = null) + public function asDateTime(string $key, ?string $format = null): DateTime|string|null { $time = $this[$key]; if (!$time instanceof DateTime) { @@ -83,8 +82,7 @@ class Row implements \ArrayAccess, \IteratorAggregate, \Countable } - #[\ReturnTypeWillChange] - final public function offsetGet($nm) + final public function offsetGet($nm): mixed { return $this->$nm; } diff --git a/src/Dibi/Translator.php b/src/Dibi/Translator.php index 213cb83..98299d4 100644 --- a/src/Dibi/Translator.php +++ b/src/Dibi/Translator.php @@ -151,9 +151,8 @@ final class Translator /** * Apply modifier to single value. - * @param mixed $value */ - public function formatValue($value, ?string $modifier): string + public function formatValue(mixed $value, ?string $modifier): string { if ($this->comment) { return '...'; diff --git a/src/Dibi/dibi.php b/src/Dibi/dibi.php index 87cb4f8..41e630b 100644 --- a/src/Dibi/dibi.php +++ b/src/Dibi/dibi.php @@ -85,7 +85,7 @@ class dibi * @param array $config connection parameters * @throws Dibi\Exception */ - public static function connect($config = [], string $name = '0'): Dibi\Connection + public static function connect(array $config = [], string $name = '0'): Dibi\Connection { return self::$connection = self::$registry[$name] = new Dibi\Connection($config, $name); } @@ -148,10 +148,9 @@ class dibi /** * Prints out a syntax highlighted version of the SQL command or Result. - * @param string|Dibi\Result $sql * @param bool $return return output instead of printing it? */ - public static function dump($sql = null, bool $return = false): ?string + public static function dump(string|Dibi\Result|null $sql = null, bool $return = false): ?string { return Dibi\Helpers::dump($sql, $return); } diff --git a/src/Dibi/exceptions.php b/src/Dibi/exceptions.php index 5841db5..8711cb6 100644 --- a/src/Dibi/exceptions.php +++ b/src/Dibi/exceptions.php @@ -18,11 +18,12 @@ class Exception extends \Exception private ?string $sql; - /** - * @param int|string $code - */ - public function __construct(string $message = '', $code = 0, ?string $sql = null, ?\Throwable $previous = null) - { + public function __construct( + string $message = '', + int|string $code = 0, + ?string $sql = null, + ?\Throwable $previous = null, + ) { parent::__construct($message, 0, $previous); $this->code = $code; $this->sql = $sql; diff --git a/src/Dibi/interfaces.php b/src/Dibi/interfaces.php index 51cc143..3cf3368 100644 --- a/src/Dibi/interfaces.php +++ b/src/Dibi/interfaces.php @@ -67,9 +67,8 @@ interface Driver /** * Returns the connection resource. - * @return mixed */ - function getResource(); + function getResource(): mixed; /** * Returns the connection reflector. @@ -117,7 +116,6 @@ interface ResultDriver /** * Moves cursor position without fetching row. - * @return bool true on success, false if unable to seek to specified record * @throws Exception */ function seek(int $row): bool; @@ -142,9 +140,8 @@ interface ResultDriver /** * Returns the result set resource. - * @return mixed */ - function getResultResource(); + function getResultResource(): mixed; /** * Decodes data from result set.