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

type fixes

This commit is contained in:
David Grudl
2018-04-17 10:38:07 +02:00
parent 4049ea4717
commit 0d5fd9d65b
16 changed files with 29 additions and 29 deletions

View File

@@ -23,7 +23,7 @@ class Panel implements Tracy\IBarPanel
/** @var int maximum SQL length */ /** @var int maximum SQL length */
public static $maxLength = 1000; public static $maxLength = 1000;
/** @var bool explain queries? */ /** @var bool|string explain queries? */
public $explain; public $explain;
/** @var int */ /** @var int */

View File

@@ -29,7 +29,7 @@ class Connection
/** @var Driver */ /** @var Driver */
private $driver; private $driver;
/** @var Translator */ /** @var Translator|null */
private $translator; private $translator;
/** @var bool Is connected? */ /** @var bool Is connected? */
@@ -559,7 +559,7 @@ class Connection
/** /**
* Executes SQL query and fetch results - shortcut for query() & fetchAll(). * Executes SQL query and fetch results - shortcut for query() & fetchAll().
* @param array|mixed one or more arguments * @param array|mixed one or more arguments
* @return Row[] * @return Row[]|array[]
* @throws Exception * @throws Exception
*/ */
public function fetchAll($args) public function fetchAll($args)

View File

@@ -21,13 +21,13 @@ class DataSource implements IDataSource
/** @var string */ /** @var string */
private $sql; private $sql;
/** @var Result */ /** @var Result|null */
private $result; private $result;
/** @var int */ /** @var int|null */
private $count; private $count;
/** @var int */ /** @var int|null */
private $totalCount; private $totalCount;
/** @var array */ /** @var array */

View File

@@ -256,7 +256,7 @@ class MySqliDriver implements Dibi\Driver, Dibi\ResultDriver
/** /**
* Returns the connection resource. * Returns the connection resource.
* @return \mysqli * @return \mysqli|null
*/ */
public function getResource() public function getResource()
{ {

View File

@@ -27,7 +27,7 @@ class PdoDriver implements Dibi\Driver, Dibi\ResultDriver
{ {
use Dibi\Strict; use Dibi\Strict;
/** @var PDO Connection resource */ /** @var PDO|null Connection resource */
private $connection; private $connection;
/** @var \PDOStatement|null Resultset resource */ /** @var \PDOStatement|null Resultset resource */
@@ -200,7 +200,7 @@ class PdoDriver implements Dibi\Driver, Dibi\ResultDriver
/** /**
* Returns the connection resource. * Returns the connection resource.
* @return PDO * @return PDO|null
*/ */
public function getResource() public function getResource()
{ {

View File

@@ -214,7 +214,7 @@ class Sqlite3Driver implements Dibi\Driver, Dibi\ResultDriver
/** /**
* Returns the connection resource. * Returns the connection resource.
* @return SQLite3 * @return SQLite3|null
*/ */
public function getResource() public function getResource()
{ {

View File

@@ -43,7 +43,7 @@ class Event
/** @var float */ /** @var float */
public $time; public $time;
/** @var int */ /** @var int|null */
public $count; public $count;
/** @var array */ /** @var array */
@@ -74,7 +74,7 @@ class Event
} }
} }
\dibi::$elapsedTime = false; \dibi::$elapsedTime = null;
\dibi::$numOfQueries++; \dibi::$numOfQueries++;
\dibi::$sql = $sql; \dibi::$sql = $sql;
} }

View File

@@ -13,7 +13,7 @@ namespace Dibi;
* *
* @method Fluent select(...$field) * @method Fluent select(...$field)
* @method Fluent distinct() * @method Fluent distinct()
* @method Fluent from($table) * @method Fluent from($table, ...$args)
* @method Fluent where(...$cond) * @method Fluent where(...$cond)
* @method Fluent groupBy(...$field) * @method Fluent groupBy(...$field)
* @method Fluent having(...$cond) * @method Fluent having(...$cond)
@@ -95,7 +95,7 @@ class Fluent implements IDataSource
/** @var array */ /** @var array */
private $flags = []; private $flags = [];
/** @var array */ /** @var array|null */
private $cursor; private $cursor;
/** @var HashMap normalized clauses */ /** @var HashMap normalized clauses */

View File

@@ -12,7 +12,7 @@ class Helpers
{ {
use Strict; use Strict;
/** @var array */ /** @var HashMap */
private static $types; private static $types;

View File

@@ -29,7 +29,7 @@ class FirePhpLogger
/** @var int */ /** @var int */
public $filter; public $filter;
/** @var int Elapsed time for all queries */ /** @var float Elapsed time for all queries */
public $totalTime = 0; public $totalTime = 0;
/** @var int Number of all queries */ /** @var int Number of all queries */

View File

@@ -24,7 +24,7 @@ class Database
/** @var Dibi\Reflector */ /** @var Dibi\Reflector */
private $reflector; private $reflector;
/** @var string */ /** @var string|null */
private $name; private $name;
/** @var array */ /** @var array */
@@ -39,7 +39,7 @@ class Database
/** /**
* @return string * @return string|null
*/ */
public function getName() public function getName()
{ {

View File

@@ -42,10 +42,10 @@ class Result implements IDataSource
/** @var bool Already fetched? Used for allowance for first seek(0) */ /** @var bool Already fetched? Used for allowance for first seek(0) */
private $fetched = false; private $fetched = false;
/** @var string returned object class */ /** @var string|null returned object class */
private $rowClass = 'Dibi\Row'; private $rowClass = 'Dibi\Row';
/** @var callable returned object factory*/ /** @var callable|null returned object factory */
private $rowFactory; private $rowFactory;
/** @var array format */ /** @var array format */
@@ -225,7 +225,7 @@ class Result implements IDataSource
* Fetches all records from table. * Fetches all records from table.
* @param int offset * @param int offset
* @param int limit * @param int limit
* @return Row[] * @return Row[]|array[]
*/ */
final public function fetchAll($offset = null, $limit = null) final public function fetchAll($offset = null, $limit = null)
{ {

View File

@@ -31,7 +31,7 @@ class Row implements \ArrayAccess, \IteratorAggregate, \Countable
* Converts value to DateTime object. * Converts value to DateTime object.
* @param string key * @param string key
* @param string format * @param string format
* @return \DateTime * @return DateTime|string|null
*/ */
public function asDateTime($key, $format = null) public function asDateTime($key, $format = null)
{ {

View File

@@ -39,10 +39,10 @@ final class Translator
/** @var int */ /** @var int */
private $ifLevelStart = 0; private $ifLevelStart = 0;
/** @var int */ /** @var int|null */
private $limit; private $limit;
/** @var int */ /** @var int|null */
private $offset; private $offset;
/** @var HashMap */ /** @var HashMap */

View File

@@ -49,13 +49,13 @@ class dibi
FIELD_DATETIME = Type::DATETIME, FIELD_DATETIME = Type::DATETIME,
FIELD_TIME = Type::TIME; FIELD_TIME = Type::TIME;
/** @var string Last SQL command @see dibi::query() */ /** @var string|null Last SQL command @see dibi::query() */
public static $sql; public static $sql;
/** @var int Elapsed time for last query */ /** @var float|null Elapsed time for last query */
public static $elapsedTime; public static $elapsedTime;
/** @var int Elapsed time for all queries */ /** @var float Elapsed time for all queries */
public static $totalTime; public static $totalTime;
/** @var int Number or queries */ /** @var int Number or queries */
@@ -441,7 +441,7 @@ class dibi
* Prints out a syntax highlighted version of the SQL command or Result. * Prints out a syntax highlighted version of the SQL command or Result.
* @param string|Result * @param string|Result
* @param bool return output instead of printing it? * @param bool return output instead of printing it?
* @return string * @return string|null
*/ */
public static function dump($sql = null, $return = false) public static function dump($sql = null, $return = false)
{ {

View File

@@ -104,7 +104,7 @@ class ProcedureException extends Exception
* @param int Some code * @param int Some code
* @param string SQL command * @param string SQL command
*/ */
public function __construct($message = null, $code = 0, $severity = null, $sql = null) public function __construct($message = '', $code = 0, $severity = '', $sql = null)
{ {
parent::__construct($message, (int) $code, $sql); parent::__construct($message, (int) $code, $sql);
$this->severity = $severity; $this->severity = $severity;