mirror of
https://github.com/dg/dibi.git
synced 2025-08-06 14:16:39 +02:00
added PHP 8 typehints
This commit is contained in:
@@ -32,7 +32,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;
|
||||
|
@@ -187,9 +187,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
|
||||
@@ -212,10 +211,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));
|
||||
}
|
||||
@@ -223,10 +221,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();
|
||||
@@ -238,9 +235,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));
|
||||
@@ -260,10 +256,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);
|
||||
}
|
||||
@@ -426,10 +421,7 @@ class Connection implements IConnection
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function transaction(callable $callback)
|
||||
public function transaction(callable $callback): mixed
|
||||
{
|
||||
if ($this->transactionDepth === 0) {
|
||||
$this->begin();
|
||||
@@ -535,10 +527,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();
|
||||
}
|
||||
@@ -546,11 +537,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();
|
||||
}
|
||||
@@ -558,11 +548,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();
|
||||
}
|
||||
@@ -570,10 +558,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();
|
||||
}
|
||||
|
@@ -55,7 +55,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;
|
||||
@@ -71,7 +71,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
|
||||
@@ -85,7 +85,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;
|
||||
@@ -101,7 +101,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;
|
||||
@@ -151,7 +151,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();
|
||||
}
|
||||
|
@@ -17,10 +17,7 @@ class DateTime extends \DateTimeImmutable
|
||||
{
|
||||
use Strict;
|
||||
|
||||
/**
|
||||
* @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)) {
|
||||
|
@@ -57,7 +57,7 @@ class DummyDriver implements Dibi\Driver, Dibi\ResultDriver, Dibi\Reflector
|
||||
}
|
||||
|
||||
|
||||
public function getResource()
|
||||
public function getResource(): mixed
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -171,8 +171,9 @@ class DummyDriver implements Dibi\Driver, Dibi\ResultDriver, Dibi\Reflector
|
||||
}
|
||||
|
||||
|
||||
public function getResultResource()
|
||||
public function getResultResource(): mixed
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -190,7 +190,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;
|
||||
}
|
||||
|
@@ -102,7 +102,7 @@ class FirebirdResult implements Dibi\ResultDriver
|
||||
* Returns the result set resource.
|
||||
* @return resource|null
|
||||
*/
|
||||
public function getResultResource()
|
||||
public function getResultResource(): mixed
|
||||
{
|
||||
$this->autoFree = false;
|
||||
return is_resource($this->resultSet) ? $this->resultSet : null;
|
||||
|
@@ -158,10 +158,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);
|
||||
|
@@ -60,7 +60,7 @@ class NoDataResult implements Dibi\ResultDriver
|
||||
}
|
||||
|
||||
|
||||
public function getResultResource()
|
||||
public function getResultResource(): mixed
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@@ -170,7 +170,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;
|
||||
}
|
||||
|
@@ -125,7 +125,7 @@ class OdbcResult implements Dibi\ResultDriver
|
||||
* Returns the result set resource.
|
||||
* @return resource|null
|
||||
*/
|
||||
public function getResultResource()
|
||||
public function getResultResource(): mixed
|
||||
{
|
||||
$this->autoFree = false;
|
||||
return is_resource($this->resultSet) ? $this->resultSet : null;
|
||||
|
@@ -186,7 +186,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;
|
||||
}
|
||||
|
@@ -108,7 +108,7 @@ class OracleResult implements Dibi\ResultDriver
|
||||
* Returns the result set resource.
|
||||
* @return resource|null
|
||||
*/
|
||||
public function getResultResource()
|
||||
public function getResultResource(): mixed
|
||||
{
|
||||
$this->autoFree = false;
|
||||
return is_resource($this->resultSet) ? $this->resultSet : null;
|
||||
|
@@ -227,7 +227,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
|
||||
|
@@ -111,7 +111,7 @@ class PostgreResult implements Dibi\ResultDriver
|
||||
* Returns the result set resource.
|
||||
* @return resource|PgSql\Result|null
|
||||
*/
|
||||
public function getResultResource()
|
||||
public function getResultResource(): mixed
|
||||
{
|
||||
$this->autoFree = false;
|
||||
return is_resource($this->resultSet) || $this->resultSet instanceof PgSql\Result
|
||||
|
@@ -168,7 +168,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;
|
||||
}
|
||||
|
@@ -104,7 +104,7 @@ class SqlsrvResult implements Dibi\ResultDriver
|
||||
* Returns the result set resource.
|
||||
* @return resource|null
|
||||
*/
|
||||
public function getResultResource()
|
||||
public function getResultResource(): mixed
|
||||
{
|
||||
$this->autoFree = false;
|
||||
return is_resource($this->resultSet) ? $this->resultSet : null;
|
||||
|
@@ -79,10 +79,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 {
|
||||
|
@@ -120,7 +120,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;
|
||||
|
||||
@@ -207,7 +207,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) {
|
||||
@@ -221,7 +221,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;
|
||||
@@ -231,7 +231,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) {
|
||||
@@ -271,7 +271,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;
|
||||
@@ -283,10 +283,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) {
|
||||
@@ -302,9 +302,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()
|
||||
@@ -314,9 +313,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()
|
||||
|
@@ -19,9 +19,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') {
|
||||
@@ -237,7 +236,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
|
||||
{
|
||||
@@ -285,14 +284,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;
|
||||
|
@@ -109,15 +109,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;
|
||||
}
|
||||
|
@@ -130,7 +130,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;
|
||||
@@ -149,7 +149,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;
|
||||
@@ -159,9 +159,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) {
|
||||
@@ -182,9 +181,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) {
|
||||
@@ -526,7 +525,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;
|
||||
@@ -554,7 +553,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;
|
||||
@@ -564,7 +563,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;
|
||||
|
@@ -41,23 +41,19 @@ class ResultIterator implements \Iterator, \Countable
|
||||
}
|
||||
|
||||
|
||||
#[\ReturnTypeWillChange]
|
||||
/**
|
||||
* Returns the key of the current element.
|
||||
* @return mixed
|
||||
*/
|
||||
public function key()
|
||||
public function key(): mixed
|
||||
{
|
||||
return $this->pointer;
|
||||
}
|
||||
|
||||
|
||||
#[\ReturnTypeWillChange]
|
||||
/**
|
||||
* Returns the current element.
|
||||
* @return mixed
|
||||
*/
|
||||
public function current()
|
||||
public function current(): mixed
|
||||
{
|
||||
return $this->row;
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -162,9 +162,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 '...';
|
||||
|
@@ -87,7 +87,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);
|
||||
}
|
||||
@@ -150,10 +150,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);
|
||||
}
|
||||
|
@@ -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;
|
||||
|
@@ -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.
|
||||
|
Reference in New Issue
Block a user