1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-03 20:57:36 +02:00

type improvements

This commit is contained in:
David Grudl
2018-05-01 13:24:22 +02:00
parent 809386edf8
commit f474abfeda
11 changed files with 22 additions and 16 deletions

View File

@@ -36,9 +36,10 @@ class Sqlite3Driver implements Dibi\Driver, Dibi\ResultDriver
/** @var bool */ /** @var bool */
private $autoFree = true; private $autoFree = true;
/** @var string Date and datetime format */ /** @var string Date format */
private $fmtDate; private $fmtDate;
/** @var string Datetime format */
private $fmtDateTime; private $fmtDateTime;
/** @var string character encoding */ /** @var string character encoding */

View File

@@ -46,7 +46,7 @@ class Event
/** @var int|null */ /** @var int|null */
public $count; public $count;
/** @var array */ /** @var array|null */
public $source; public $source;
@@ -80,6 +80,9 @@ class Event
} }
/**
* @param Result|DriverException|null
*/
public function done($result = null) public function done($result = null)
{ {
$this->result = $result; $this->result = $result;

View File

@@ -86,7 +86,7 @@ class Fluent implements IDataSource
/** @var array */ /** @var array */
private $setups = []; private $setups = [];
/** @var string */ /** @var string|null */
private $command; private $command;
/** @var array */ /** @var array */

View File

@@ -14,6 +14,7 @@ namespace Dibi;
*/ */
abstract class HashMapBase abstract class HashMapBase
{ {
/** @var callable */
private $callback; private $callback;
@@ -45,7 +46,7 @@ final class HashMap extends HashMapBase
{ {
public function __set($nm, $val) public function __set($nm, $val)
{ {
if ($nm == '') { if ($nm === '') {
$nm = "\xFF"; $nm = "\xFF";
} }
$this->$nm = $val; $this->$nm = $val;
@@ -54,7 +55,7 @@ final class HashMap extends HashMapBase
public function __get($nm) public function __get($nm)
{ {
if ($nm == '') { if ($nm === '') {
$nm = "\xFF"; $nm = "\xFF";
return isset($this->$nm) ? $this->$nm : $this->$nm = call_user_func($this->getCallback(), ''); return isset($this->$nm) ? $this->$nm : $this->$nm = call_user_func($this->getCallback(), '');
} else { } else {

View File

@@ -27,7 +27,7 @@ class Database
/** @var string|null */ /** @var string|null */
private $name; private $name;
/** @var array */ /** @var Table[]|null */
private $tables; private $tables;

View File

@@ -23,10 +23,10 @@ class Result
/** @var Dibi\ResultDriver */ /** @var Dibi\ResultDriver */
private $driver; private $driver;
/** @var array */ /** @var Column[]|null */
private $columns; private $columns;
/** @var array */ /** @var string[]|null */
private $names; private $names;

View File

@@ -34,16 +34,16 @@ class Table
/** @var bool */ /** @var bool */
private $view; private $view;
/** @var array */ /** @var Column[]|null */
private $columns; private $columns;
/** @var array */ /** @var ForeignKey[]|null */
private $foreignKeys; private $foreignKeys;
/** @var array */ /** @var Index[]|null */
private $indexes; private $indexes;
/** @var Index */ /** @var Index|null */
private $primaryKey; private $primaryKey;

View File

@@ -31,7 +31,7 @@ class ResultIterator implements \Iterator, \Countable
private $row; private $row;
/** @var int */ /** @var int */
private $pointer; private $pointer = 0;
/** /**

View File

@@ -70,6 +70,7 @@ final class Translator
$args = array_values($args[0]); $args = array_values($args[0]);
} }
$this->args = $args; $this->args = $args;
$this->errors = [];
$commandIns = null; $commandIns = null;
$lastArr = null; $lastArr = null;

View File

@@ -85,7 +85,7 @@ class dibi
/** /**
* Creates a new Connection object and connects it to specified database. * Creates a new Connection object and connects it to specified database.
* @param mixed connection parameters * @param array|string connection parameters
* @param string connection name * @param string connection name
* @return Dibi\Connection * @return Dibi\Connection
* @throws Dibi\Exception * @throws Dibi\Exception

View File

@@ -20,7 +20,7 @@ class Exception extends \Exception
/** /**
* Construct a dibi exception. * Construct a dibi exception.
* @param string Message describing the exception * @param string Message describing the exception
* @param mixed * @param string|int
* @param string SQL command * @param string SQL command
* @param \Exception * @param \Exception
*/ */
@@ -117,7 +117,7 @@ class ProcedureException extends Exception
*/ */
public function getSeverity() public function getSeverity()
{ {
$this->severity; return $this->severity;
} }
} }