1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-07 22:56:35 +02:00

added property typehints

This commit is contained in:
David Grudl
2021-03-01 19:17:16 +01:00
parent 76b8ed2108
commit 0575f9ea17
46 changed files with 165 additions and 265 deletions

View File

@@ -19,11 +19,9 @@ use Tracy;
*/ */
class DibiExtension22 extends Nette\DI\CompilerExtension class DibiExtension22 extends Nette\DI\CompilerExtension
{ {
/** @var bool|null */ private ?bool $debugMode;
private $debugMode;
/** @var bool|null */ private ?bool $cliMode;
private $cliMode;
public function __construct(?bool $debugMode = null, ?bool $cliMode = null) public function __construct(?bool $debugMode = null, ?bool $cliMode = null)

View File

@@ -22,17 +22,14 @@ class Panel implements Tracy\IBarPanel
{ {
use Dibi\Strict; use Dibi\Strict;
/** @var int maximum SQL length */ /** maximum SQL length */
public static $maxLength = 1000; public static int $maxLength = 1000;
/** @var bool|string explain queries? */ public bool|string $explain;
public $explain;
/** @var int */ public int $filter;
public $filter;
/** @var array */ private array $events = [];
private $events = [];
public function __construct($explain = true, ?int $filter = null) public function __construct($explain = true, ?int $filter = null)

View File

@@ -22,25 +22,22 @@ class Connection implements IConnection
{ {
use Strict; use Strict;
/** @var array of function (Event $event); Occurs after query is executed */ /** function (Event $event); Occurs after query is executed */
public $onEvent = []; public ?array $onEvent = [];
/** @var array Current connection configuration */ /** Current connection configuration */
private $config; private array $config;
/** @var string[] resultset formats */ /** @var string[] resultset formats */
private $formats; private array $formats;
/** @var Driver|null */ private ?Driver $driver = null;
private $driver;
/** @var Translator|null */ private ?Translator $translator = null;
private $translator;
/** @var HashMap Substitutes for identifiers */ private HashMap $substitutes;
private $substitutes;
private $transactionDepth = 0; private int $transactionDepth = 0;
/** /**

View File

@@ -17,35 +17,25 @@ class DataSource implements IDataSource
{ {
use Strict; use Strict;
/** @var Connection */ private Connection $connection;
private $connection;
/** @var string */ private string $sql;
private $sql;
/** @var Result|null */ private ?Result $result = null;
private $result;
/** @var int|null */ private ?int $count = null;
private $count;
/** @var int|null */ private ?int $totalCount = null;
private $totalCount;
/** @var array */ private array $cols = [];
private $cols = [];
/** @var array */ private array $sorting = [];
private $sorting = [];
/** @var array */ private array $conds = [];
private $conds = [];
/** @var int|null */ private ?int $offset = null;
private $offset;
/** @var int|null */ private ?int $limit = null;
private $limit;
/** /**

View File

@@ -33,11 +33,10 @@ class FirebirdDriver implements Dibi\Driver
/** @var resource */ /** @var resource */
private $connection; private $connection;
/** @var resource|null */ /** @var ?resource */
private $transaction; private $transaction;
/** @var bool */ private bool $inTransaction = false;
private $inTransaction = false;
/** @throws Dibi\NotSupportedException */ /** @throws Dibi\NotSupportedException */

View File

@@ -19,8 +19,7 @@ class FirebirdReflector implements Dibi\Reflector
{ {
use Dibi\Strict; use Dibi\Strict;
/** @var Dibi\Driver */ private Dibi\Driver $driver;
private $driver;
public function __construct(Dibi\Driver $driver) public function __construct(Dibi\Driver $driver)

View File

@@ -23,8 +23,7 @@ class FirebirdResult implements Dibi\ResultDriver
/** @var resource */ /** @var resource */
private $resultSet; private $resultSet;
/** @var bool */ private bool $autoFree = true;
private $autoFree = true;
/** /**

View File

@@ -20,8 +20,7 @@ class MySqlReflector implements Dibi\Reflector
{ {
use Dibi\Strict; use Dibi\Strict;
/** @var Dibi\Driver */ private Dibi\Driver $driver;
private $driver;
public function __construct(Dibi\Driver $driver) public function __construct(Dibi\Driver $driver)

View File

@@ -40,11 +40,10 @@ class MySqliDriver implements Dibi\Driver
public const ERROR_DATA_TRUNCATED = 1265; public const ERROR_DATA_TRUNCATED = 1265;
/** @var \mysqli */ private \mysqli $connection;
private $connection;
/** @var bool Is buffered (seekable and countable)? */ /** Is buffered (seekable and countable)? */
private $buffered; private bool $buffered = false;
/** @throws Dibi\NotSupportedException */ /** @throws Dibi\NotSupportedException */

View File

@@ -19,14 +19,12 @@ class MySqliResult implements Dibi\ResultDriver
{ {
use Dibi\Strict; use Dibi\Strict;
/** @var \mysqli_result */ private \mysqli_result $resultSet;
private $resultSet;
/** @var bool */ private bool $autoFree = true;
private $autoFree = true;
/** @var bool Is buffered (seekable and countable)? */ /** Is buffered (seekable and countable)? */
private $buffered; private bool $buffered;
public function __construct(\mysqli_result $resultSet, bool $buffered) public function __construct(\mysqli_result $resultSet, bool $buffered)

View File

@@ -19,8 +19,7 @@ class NoDataResult implements Dibi\ResultDriver
{ {
use Dibi\Strict; use Dibi\Strict;
/** @var int */ private int $rows;
private $rows;
public function __construct(int $rows) public function __construct(int $rows)

View File

@@ -30,11 +30,9 @@ class OdbcDriver implements Dibi\Driver
/** @var resource */ /** @var resource */
private $connection; private $connection;
/** @var int|null Affected rows */ private ?int $affectedRows;
private $affectedRows;
/** @var bool */ private bool $microseconds = true;
private $microseconds = true;
/** @throws Dibi\NotSupportedException */ /** @throws Dibi\NotSupportedException */

View File

@@ -19,8 +19,7 @@ class OdbcReflector implements Dibi\Reflector
{ {
use Dibi\Strict; use Dibi\Strict;
/** @var Dibi\Driver */ private Dibi\Driver $driver;
private $driver;
public function __construct(Dibi\Driver $driver) public function __construct(Dibi\Driver $driver)

View File

@@ -22,11 +22,9 @@ class OdbcResult implements Dibi\ResultDriver
/** @var resource */ /** @var resource */
private $resultSet; private $resultSet;
/** @var bool */ private bool $autoFree = true;
private $autoFree = true;
/** @var int Cursor */ private int $row = 0;
private $row = 0;
/** /**

View File

@@ -32,14 +32,12 @@ class OracleDriver implements Dibi\Driver
/** @var resource */ /** @var resource */
private $connection; private $connection;
/** @var bool */ private bool $autocommit = true;
private $autocommit = true;
/** @var bool use native datetime format */ /** use native datetime format */
private $nativeDate; private bool $nativeDate;
/** @var int|null Number of affected rows */ private ?int $affectedRows;
private $affectedRows;
/** @throws Dibi\NotSupportedException */ /** @throws Dibi\NotSupportedException */

View File

@@ -19,8 +19,7 @@ class OracleReflector implements Dibi\Reflector
{ {
use Dibi\Strict; use Dibi\Strict;
/** @var Dibi\Driver */ private Dibi\Driver $driver;
private $driver;
public function __construct(Dibi\Driver $driver) public function __construct(Dibi\Driver $driver)

View File

@@ -22,8 +22,7 @@ class OracleResult implements Dibi\ResultDriver
/** @var resource */ /** @var resource */
private $resultSet; private $resultSet;
/** @var bool */ private bool $autoFree = true;
private $autoFree = true;
/** /**

View File

@@ -29,17 +29,13 @@ class PdoDriver implements Dibi\Driver
{ {
use Dibi\Strict; use Dibi\Strict;
/** @var PDO|null Connection resource */ private ?PDO $connection;
private $connection;
/** @var int|null Affected rows */ private ?int $affectedRows;
private $affectedRows;
/** @var string */ private string $driverName;
private $driverName;
/** @var string */ private string $serverVersion = '';
private $serverVersion = '';
/** @throws Dibi\NotSupportedException */ /** @throws Dibi\NotSupportedException */

View File

@@ -21,11 +21,9 @@ class PdoResult implements Dibi\ResultDriver
{ {
use Dibi\Strict; use Dibi\Strict;
/** @var \PDOStatement|null */ private ?\PDOStatement $resultSet;
private $resultSet;
/** @var string */ private string $driverName;
private $driverName;
public function __construct(\PDOStatement $resultSet, string $driverName) public function __construct(\PDOStatement $resultSet, string $driverName)

View File

@@ -33,8 +33,7 @@ class PostgreDriver implements Dibi\Driver
/** @var resource|PgSql\Connection */ /** @var resource|PgSql\Connection */
private $connection; private $connection;
/** @var int|null Affected rows */ private ?int $affectedRows;
private $affectedRows;
/** @throws Dibi\NotSupportedException */ /** @throws Dibi\NotSupportedException */

View File

@@ -19,11 +19,9 @@ class PostgreReflector implements Dibi\Reflector
{ {
use Dibi\Strict; use Dibi\Strict;
/** @var Dibi\Driver */ private Dibi\Driver $driver;
private $driver;
/** @var string */ private string $version;
private $version;
public function __construct(Dibi\Driver $driver, string $version) public function __construct(Dibi\Driver $driver, string $version)

View File

@@ -24,8 +24,7 @@ class PostgreResult implements Dibi\ResultDriver
/** @var resource|PgSql\Result */ /** @var resource|PgSql\Result */
private $resultSet; private $resultSet;
/** @var bool */ private bool $autoFree = true;
private $autoFree = true;
/** /**

View File

@@ -27,14 +27,11 @@ class SqliteDriver implements Dibi\Driver
{ {
use Dibi\Strict; use Dibi\Strict;
/** @var SQLite3 */ private SQLite3 $connection;
private $connection;
/** @var string Date format */ private string $fmtDate;
private $fmtDate;
/** @var string Datetime format */ private string $fmtDateTime;
private $fmtDateTime;
/** @throws Dibi\NotSupportedException */ /** @throws Dibi\NotSupportedException */

View File

@@ -19,8 +19,7 @@ class SqliteReflector implements Dibi\Reflector
{ {
use Dibi\Strict; use Dibi\Strict;
/** @var Dibi\Driver */ private Dibi\Driver $driver;
private $driver;
public function __construct(Dibi\Driver $driver) public function __construct(Dibi\Driver $driver)

View File

@@ -20,11 +20,9 @@ class SqliteResult implements Dibi\ResultDriver
{ {
use Dibi\Strict; use Dibi\Strict;
/** @var \SQLite3Result */ private \SQLite3Result $resultSet;
private $resultSet;
/** @var bool */ private bool $autoFree = true;
private $autoFree = true;
public function __construct(\SQLite3Result $resultSet) public function __construct(\SQLite3Result $resultSet)

View File

@@ -32,11 +32,9 @@ class SqlsrvDriver implements Dibi\Driver
/** @var resource */ /** @var resource */
private $connection; private $connection;
/** @var int|null Affected rows */ private ?int $affectedRows;
private $affectedRows;
/** @var string */ private string $version = '';
private $version = '';
/** @throws Dibi\NotSupportedException */ /** @throws Dibi\NotSupportedException */

View File

@@ -19,8 +19,7 @@ class SqlsrvReflector implements Dibi\Reflector
{ {
use Dibi\Strict; use Dibi\Strict;
/** @var Dibi\Driver */ private Dibi\Driver $driver;
private $driver;
public function __construct(Dibi\Driver $driver) public function __construct(Dibi\Driver $driver)

View File

@@ -22,8 +22,7 @@ class SqlsrvResult implements Dibi\ResultDriver
/** @var resource */ /** @var resource */
private $resultSet; private $resultSet;
/** @var bool */ private bool $autoFree = true;
private $autoFree = true;
/** /**

View File

@@ -31,26 +31,19 @@ class Event
TRANSACTION = 448, // BEGIN | COMMIT | ROLLBACK TRANSACTION = 448, // BEGIN | COMMIT | ROLLBACK
ALL = 1023; ALL = 1023;
/** @var Connection */ public Connection $connection;
public $connection;
/** @var int */ public int $type;
public $type;
/** @var string */ public string $sql;
public $sql;
/** @var Result|DriverException|null */ public Result|DriverException|null $result;
public $result;
/** @var float */ public float $time;
public $time;
/** @var int|null */ public ?int $count = null;
public $count;
/** @var array|null */ public ?array $source = null;
public $source;
public function __construct(Connection $connection, int $type, ?string $sql = null) public function __construct(Connection $connection, int $type, ?string $sql = null)

View File

@@ -17,8 +17,7 @@ class Expression
{ {
use Strict; use Strict;
/** @var array */ private array $values;
private $values;
public function __construct(...$values) public function __construct(...$values)

View File

@@ -47,8 +47,7 @@ class Fluent implements IDataSource
public const REMOVE = false; public const REMOVE = false;
/** @var array */ public static array $masks = [
public static $masks = [
'SELECT' => ['SELECT', 'DISTINCT', 'FROM', 'WHERE', 'GROUP BY', 'SELECT' => ['SELECT', 'DISTINCT', 'FROM', 'WHERE', 'GROUP BY',
'HAVING', 'ORDER BY', 'LIMIT', 'OFFSET', ], 'HAVING', 'ORDER BY', 'LIMIT', 'OFFSET', ],
'UPDATE' => ['UPDATE', 'SET', 'WHERE', 'ORDER BY', 'LIMIT'], 'UPDATE' => ['UPDATE', 'SET', 'WHERE', 'ORDER BY', 'LIMIT'],
@@ -56,8 +55,8 @@ class Fluent implements IDataSource
'DELETE' => ['DELETE', 'FROM', 'USING', 'WHERE', 'ORDER BY', 'LIMIT'], 'DELETE' => ['DELETE', 'FROM', 'USING', 'WHERE', 'ORDER BY', 'LIMIT'],
]; ];
/** @var array default modifiers for arrays */ /** default modifiers for arrays */
public static $modifiers = [ public static array $modifiers = [
'SELECT' => '%n', 'SELECT' => '%n',
'FROM' => '%n', 'FROM' => '%n',
'IN' => '%in', 'IN' => '%in',
@@ -69,8 +68,8 @@ class Fluent implements IDataSource
'GROUP BY' => '%by', 'GROUP BY' => '%by',
]; ];
/** @var array clauses separators */ /** clauses separators */
public static $separators = [ public static array $separators = [
'SELECT' => ',', 'SELECT' => ',',
'FROM' => ',', 'FROM' => ',',
'WHERE' => 'AND', 'WHERE' => 'AND',
@@ -84,41 +83,35 @@ class Fluent implements IDataSource
'INTO' => false, 'INTO' => false,
]; ];
/** @var array clauses */ /** clauses */
public static $clauseSwitches = [ public static array $clauseSwitches = [
'JOIN' => 'FROM', 'JOIN' => 'FROM',
'INNER JOIN' => 'FROM', 'INNER JOIN' => 'FROM',
'LEFT JOIN' => 'FROM', 'LEFT JOIN' => 'FROM',
'RIGHT JOIN' => 'FROM', 'RIGHT JOIN' => 'FROM',
]; ];
/** @var Connection */ private Connection $connection;
private $connection;
/** @var array */ private array $setups = [];
private $setups = [];
/** @var string|null */ private ?string $command = null;
private $command;
/** @var array */ private array $clauses = [];
private $clauses = [];
/** @var array */ private array $flags = [];
private $flags = [];
/** @var array|null */
private $cursor; private $cursor;
/** @var HashMap normalized clauses */ /** normalized clauses */
private static $normalizer; private static HashMap $normalizer;
public function __construct(Connection $connection) public function __construct(Connection $connection)
{ {
$this->connection = $connection; $this->connection = $connection;
if (self::$normalizer === null) { if (!isset(self::$normalizer)) {
self::$normalizer = new HashMap([self::class, '_formatClause']); self::$normalizer = new HashMap([self::class, '_formatClause']);
} }
} }

View File

@@ -14,8 +14,7 @@ class Helpers
{ {
use Strict; use Strict;
/** @var HashMap */ private static HashMap $types;
private static $types;
/** /**
@@ -211,7 +210,7 @@ class Helpers
/** @internal */ /** @internal */
public static function getTypeCache(): HashMap public static function getTypeCache(): HashMap
{ {
if (self::$types === null) { if (!isset(self::$types)) {
self::$types = new HashMap([self::class, 'detectType']); self::$types = new HashMap([self::class, 'detectType']);
} }

View File

@@ -17,8 +17,7 @@ class Literal
{ {
use Strict; use Strict;
/** @var string */ private string $value;
private $value;
public function __construct($value) public function __construct($value)

View File

@@ -19,14 +19,12 @@ class FileLogger
{ {
use Dibi\Strict; use Dibi\Strict;
/** @var string Name of the file where SQL errors should be logged */ /** Name of the file where SQL errors should be logged */
public $file; public string $file;
/** @var int */ public int $filter;
public $filter;
/** @var bool */ private bool $errorsOnly;
private $errorsOnly;
public function __construct(string $file, ?int $filter = null, bool $errorsOnly = false) public function __construct(string $file, ?int $filter = null, bool $errorsOnly = false)

View File

@@ -29,11 +29,11 @@ class Column
{ {
use Dibi\Strict; use Dibi\Strict;
/** @var Dibi\Reflector|null when created by Result */ /** when created by Result */
private $reflector; private ?Dibi\Reflector $reflector;
/** @var array (name, nativetype, [table], [fullname], [size], [nullable], [default], [autoincrement], [vendor]) */ /** @var array (name, nativetype, [table], [fullname], [size], [nullable], [default], [autoincrement], [vendor]) */
private $info; private array $info;
public function __construct(?Dibi\Reflector $reflector, array $info) public function __construct(?Dibi\Reflector $reflector, array $info)

View File

@@ -23,14 +23,12 @@ class Database
{ {
use Dibi\Strict; use Dibi\Strict;
/** @var Dibi\Reflector */ private Dibi\Reflector $reflector;
private $reflector;
/** @var string|null */ private ?string $name;
private $name;
/** @var Table[]|null */ /** @var Table[] */
private $tables; private array $tables;
public function __construct(Dibi\Reflector $reflector, ?string $name = null) public function __construct(Dibi\Reflector $reflector, ?string $name = null)
@@ -89,7 +87,7 @@ class Database
protected function init(): void protected function init(): void
{ {
if ($this->tables === null) { if (!isset($this->tables)) {
$this->tables = []; $this->tables = [];
foreach ($this->reflector->getTables() as $info) { foreach ($this->reflector->getTables() as $info) {
$this->tables[strtolower($info['name'])] = new Table($this->reflector, $info); $this->tables[strtolower($info['name'])] = new Table($this->reflector, $info);

View File

@@ -22,11 +22,10 @@ class ForeignKey
{ {
use Dibi\Strict; use Dibi\Strict;
/** @var string */ private string $name;
private $name;
/** @var array of [local, foreign, onDelete, onUpdate] */ /** @var array of [local, foreign, onDelete, onUpdate] */
private $references; private array $references;
public function __construct(string $name, array $references) public function __construct(string $name, array $references)

View File

@@ -25,7 +25,7 @@ class Index
use Dibi\Strict; use Dibi\Strict;
/** @var array (name, columns, [unique], [primary]) */ /** @var array (name, columns, [unique], [primary]) */
private $info; private array $info;
public function __construct(array $info) public function __construct(array $info)

View File

@@ -22,14 +22,13 @@ class Result
{ {
use Dibi\Strict; use Dibi\Strict;
/** @var Dibi\ResultDriver */ private Dibi\ResultDriver $driver;
private $driver;
/** @var Column[]|null */ /** @var Column[]|null */
private $columns; private ?array $columns;
/** @var Column[]|null */ /** @var Column[]|null */
private $names; private ?array $names;
public function __construct(Dibi\ResultDriver $driver) public function __construct(Dibi\ResultDriver $driver)
@@ -81,7 +80,7 @@ class Result
protected function initColumns(): void protected function initColumns(): void
{ {
if ($this->columns === null) { if (!isset($this->columns)) {
$this->columns = []; $this->columns = [];
$reflector = $this->driver instanceof Dibi\Reflector $reflector = $this->driver instanceof Dibi\Reflector
? $this->driver ? $this->driver

View File

@@ -27,26 +27,22 @@ class Table
{ {
use Dibi\Strict; use Dibi\Strict;
/** @var Dibi\Reflector */ private Dibi\Reflector $reflector;
private $reflector;
/** @var string */ private string $name;
private $name;
/** @var bool */ private bool $view;
private $view;
/** @var Column[]|null */ /** @var Column[] */
private $columns; private array $columns;
/** @var ForeignKey[]|null */ /** @var ForeignKey[] */
private $foreignKeys; private array $foreignKeys;
/** @var Index[]|null */ /** @var Index[] */
private $indexes; private array $indexes;
/** @var Index|null */ private ?Index $primaryKey;
private $primaryKey;
public function __construct(Dibi\Reflector $reflector, array $info) public function __construct(Dibi\Reflector $reflector, array $info)
@@ -135,7 +131,7 @@ class Table
protected function initColumns(): void protected function initColumns(): void
{ {
if ($this->columns === null) { if (!isset($this->columns)) {
$this->columns = []; $this->columns = [];
foreach ($this->reflector->getColumns($this->name) as $info) { foreach ($this->reflector->getColumns($this->name) as $info) {
$this->columns[strtolower($info['name'])] = new Column($this->reflector, $info); $this->columns[strtolower($info['name'])] = new Column($this->reflector, $info);
@@ -146,7 +142,7 @@ class Table
protected function initIndexes(): void protected function initIndexes(): void
{ {
if ($this->indexes === null) { if (!isset($this->indexes)) {
$this->initColumns(); $this->initColumns();
$this->indexes = []; $this->indexes = [];
foreach ($this->reflector->getIndexes($this->name) as $info) { foreach ($this->reflector->getIndexes($this->name) as $info) {

View File

@@ -19,26 +19,23 @@ class Result implements IDataSource
{ {
use Strict; use Strict;
/** @var ResultDriver|null */ private ?ResultDriver $driver;
private $driver;
/** @var array Translate table */ /** Translate table */
private $types = []; private array $types = [];
/** @var Reflection\Result|null */ private ?Reflection\Result $meta;
private $meta;
/** @var bool Already fetched? Used for allowance for first seek(0) */ /** Already fetched? Used for allowance for first seek(0) */
private $fetched = false; private bool $fetched = false;
/** @var string|null returned object class */ /** returned object class */
private $rowClass = Row::class; private ?string $rowClass = Row::class;
/** @var callable|null returned object factory */ /** @var callable|null returned object factory */
private $rowFactory; private $rowFactory;
/** @var array format */ private array $formats = [];
private $formats = [];
public function __construct(ResultDriver $driver, bool $normalize = true) public function __construct(ResultDriver $driver, bool $normalize = true)
@@ -591,7 +588,7 @@ class Result implements IDataSource
*/ */
public function getInfo(): Reflection\Result public function getInfo(): Reflection\Result
{ {
if ($this->meta === null) { if (!isset($this->meta)) {
$this->meta = new Reflection\Result($this->getResultDriver()); $this->meta = new Reflection\Result($this->getResultDriver());
} }

View File

@@ -17,14 +17,11 @@ class ResultIterator implements \Iterator, \Countable
{ {
use Strict; use Strict;
/** @var Result */ private Result $result;
private $result;
/** @var mixed */ private mixed $row;
private $row;
/** @var int */ private int $pointer = 0;
private $pointer = 0;
public function __construct(Result $result) public function __construct(Result $result)

View File

@@ -20,7 +20,7 @@ use ReflectionProperty;
trait Strict trait Strict
{ {
/** @var array [method => [type => callback]] */ /** @var array [method => [type => callback]] */
private static $extMethods; private static array $extMethods;
/** /**

View File

@@ -17,38 +17,28 @@ final class Translator
{ {
use Strict; use Strict;
/** @var Connection */ private Connection $connection;
private $connection;
/** @var Driver */ private Driver $driver;
private $driver;
/** @var int */ private int $cursor = 0;
private $cursor = 0;
/** @var array */ private array $args;
private $args;
/** @var string[] */ /** @var string[] */
private $errors; private array $errors;
/** @var bool */ private bool $comment = false;
private $comment = false;
/** @var int */ private int $ifLevel = 0;
private $ifLevel = 0;
/** @var int */ private int $ifLevelStart = 0;
private $ifLevelStart = 0;
/** @var int|null */ private ?int $limit = null;
private $limit;
/** @var int|null */ private ?int $offset = null;
private $offset;
/** @var HashMap */ private HashMap $identifiers;
private $identifiers;
public function __construct(Connection $connection) public function __construct(Connection $connection)

View File

@@ -51,23 +51,23 @@ class dibi
ASC = 'ASC', ASC = 'ASC',
DESC = 'DESC'; DESC = 'DESC';
/** @var string|null Last SQL command @see dibi::query() */ /** Last SQL command @see dibi::query() */
public static $sql; public static ?string $sql = null;
/** @var float|null Elapsed time for last query */ /** Elapsed time for last query */
public static $elapsedTime; public static ?float $elapsedTime = null;
/** @var float Elapsed time for all queries */ /** Elapsed time for all queries */
public static $totalTime; public static float $totalTime = 0;
/** @var int Number or queries */ /** Number or queries */
public static $numOfQueries = 0; public static int $numOfQueries = 0;
/** @var Dibi\Connection[] Connection registry storage for Dibi\Connection objects */ /** @var Dibi\Connection[] Connection registry storage for Dibi\Connection objects */
private static $registry = []; private static array $registry = [];
/** @var Dibi\Connection Current connection */ /** Current connection */
private static $connection; private static Dibi\Connection $connection;
/** /**

View File

@@ -15,8 +15,7 @@ namespace Dibi;
*/ */
class Exception extends \Exception class Exception extends \Exception
{ {
/** @var string|null */ private ?string $sql;
private $sql;
/** /**
@@ -86,8 +85,7 @@ class NotSupportedException extends Exception
*/ */
class ProcedureException extends Exception class ProcedureException extends Exception
{ {
/** @var string */ protected string $severity;
protected $severity;
/** /**