Skip to content

Commit

Permalink
added property typehints
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Apr 23, 2021
1 parent 03b1f1b commit 9fb73cb
Show file tree
Hide file tree
Showing 46 changed files with 164 additions and 263 deletions.
3 changes: 1 addition & 2 deletions src/Dibi/Bridges/Nette/DibiExtension22.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
*/
class DibiExtension22 extends Nette\DI\CompilerExtension
{
/** @var bool|null */
private $debugMode;
private ?bool $debugMode;


public function __construct(bool $debugMode = null)
Expand Down
13 changes: 5 additions & 8 deletions src/Dibi/Bridges/Tracy/Panel.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,14 @@ class Panel implements Tracy\IBarPanel
{
use Dibi\Strict;

/** @var int maximum SQL length */
public static $maxLength = 1000;
/** maximum SQL length */
public static int $maxLength = 1000;

/** @var bool|string explain queries? */
public $explain;
public bool|string $explain;

/** @var int */
public $filter;
public int $filter;

/** @var array */
private $events = [];
private array $events = [];


public function __construct($explain = true, int $filter = null)
Expand Down
21 changes: 9 additions & 12 deletions src/Dibi/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,22 @@ class Connection implements IConnection
{
use Strict;

/** @var array of function (Event $event); Occurs after query is executed */
public $onEvent = [];
/** function (Event $event); Occurs after query is executed */
public array $onEvent = [];

/** @var array Current connection configuration */
private $config;
/** Current connection configuration */
private array $config;

/** @var string[] resultset formats */
private $formats;
private array $formats;

/** @var Driver|null */
private $driver;
private ?Driver $driver = null;

/** @var Translator|null */
private $translator;
private ?Translator $translator = null;

/** @var HashMap Substitutes for identifiers */
private $substitutes;
private HashMap $substitutes;

private $transactionDepth = 0;
private int $transactionDepth = 0;


/**
Expand Down
30 changes: 10 additions & 20 deletions src/Dibi/DataSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,35 +17,25 @@ class DataSource implements IDataSource
{
use Strict;

/** @var Connection */
private $connection;
private Connection $connection;

/** @var string */
private $sql;
private string $sql;

/** @var Result|null */
private $result;
private ?Result $result = null;

/** @var int|null */
private $count;
private ?int $count = null;

/** @var int|null */
private $totalCount;
private ?int $totalCount = null;

/** @var array */
private $cols = [];
private array $cols = [];

/** @var array */
private $sorting = [];
private array $sorting = [];

/** @var array */
private $conds = [];
private array $conds = [];

/** @var int|null */
private $offset;
private ?int $offset = null;

/** @var int|null */
private $limit;
private ?int $limit = null;


/**
Expand Down
5 changes: 2 additions & 3 deletions src/Dibi/Drivers/FirebirdDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,10 @@ class FirebirdDriver implements Dibi\Driver
/** @var resource */
private $connection;

/** @var resource|null */
/** @var ?resource */
private $transaction;

/** @var bool */
private $inTransaction = false;
private bool $inTransaction = false;


/** @throws Dibi\NotSupportedException */
Expand Down
3 changes: 1 addition & 2 deletions src/Dibi/Drivers/FirebirdReflector.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ class FirebirdReflector implements Dibi\Reflector
{
use Dibi\Strict;

/** @var Dibi\Driver */
private $driver;
private Dibi\Driver $driver;


public function __construct(Dibi\Driver $driver)
Expand Down
3 changes: 1 addition & 2 deletions src/Dibi/Drivers/FirebirdResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ class FirebirdResult implements Dibi\ResultDriver
/** @var resource */
private $resultSet;

/** @var bool */
private $autoFree = true;
private bool $autoFree = true;


/**
Expand Down
3 changes: 1 addition & 2 deletions src/Dibi/Drivers/MySqlReflector.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ class MySqlReflector implements Dibi\Reflector
{
use Dibi\Strict;

/** @var Dibi\Driver */
private $driver;
private Dibi\Driver $driver;


public function __construct(Dibi\Driver $driver)
Expand Down
7 changes: 3 additions & 4 deletions src/Dibi/Drivers/MySqliDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,10 @@ class MySqliDriver implements Dibi\Driver

public const ERROR_DATA_TRUNCATED = 1265;

/** @var \mysqli */
private $connection;
private \mysqli $connection;

/** @var bool Is buffered (seekable and countable)? */
private $buffered;
/** Is buffered (seekable and countable)? */
private bool $buffered = false;


/** @throws Dibi\NotSupportedException */
Expand Down
10 changes: 4 additions & 6 deletions src/Dibi/Drivers/MySqliResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,12 @@ class MySqliResult implements Dibi\ResultDriver
{
use Dibi\Strict;

/** @var \mysqli_result */
private $resultSet;
private \mysqli_result $resultSet;

/** @var bool */
private $autoFree = true;
private bool $autoFree = true;

/** @var bool Is buffered (seekable and countable)? */
private $buffered;
/** Is buffered (seekable and countable)? */
private bool $buffered;


public function __construct(\mysqli_result $resultSet, bool $buffered)
Expand Down
3 changes: 1 addition & 2 deletions src/Dibi/Drivers/NoDataResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ class NoDataResult implements Dibi\ResultDriver
{
use Dibi\Strict;

/** @var int */
private $rows;
private int $rows;


public function __construct(int $rows)
Expand Down
6 changes: 2 additions & 4 deletions src/Dibi/Drivers/OdbcDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,9 @@ class OdbcDriver implements Dibi\Driver
/** @var resource */
private $connection;

/** @var int|null Affected rows */
private $affectedRows;
private ?int $affectedRows;

/** @var bool */
private $microseconds = true;
private bool $microseconds = true;


/** @throws Dibi\NotSupportedException */
Expand Down
3 changes: 1 addition & 2 deletions src/Dibi/Drivers/OdbcReflector.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ class OdbcReflector implements Dibi\Reflector
{
use Dibi\Strict;

/** @var Dibi\Driver */
private $driver;
private Dibi\Driver $driver;


public function __construct(Dibi\Driver $driver)
Expand Down
6 changes: 2 additions & 4 deletions src/Dibi/Drivers/OdbcResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@ class OdbcResult implements Dibi\ResultDriver
/** @var resource */
private $resultSet;

/** @var bool */
private $autoFree = true;
private bool $autoFree = true;

/** @var int Cursor */
private $row = 0;
private int $row = 0;


/**
Expand Down
10 changes: 4 additions & 6 deletions src/Dibi/Drivers/OracleDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,12 @@ class OracleDriver implements Dibi\Driver
/** @var resource */
private $connection;

/** @var bool */
private $autocommit = true;
private bool $autocommit = true;

/** @var bool use native datetime format */
private $nativeDate;
/** use native datetime format */
private bool $nativeDate;

/** @var int|null Number of affected rows */
private $affectedRows;
private ?int $affectedRows;


/** @throws Dibi\NotSupportedException */
Expand Down
3 changes: 1 addition & 2 deletions src/Dibi/Drivers/OracleReflector.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ class OracleReflector implements Dibi\Reflector
{
use Dibi\Strict;

/** @var Dibi\Driver */
private $driver;
private Dibi\Driver $driver;


public function __construct(Dibi\Driver $driver)
Expand Down
3 changes: 1 addition & 2 deletions src/Dibi/Drivers/OracleResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ class OracleResult implements Dibi\ResultDriver
/** @var resource */
private $resultSet;

/** @var bool */
private $autoFree = true;
private bool $autoFree = true;


/**
Expand Down
12 changes: 4 additions & 8 deletions src/Dibi/Drivers/PdoDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,13 @@ class PdoDriver implements Dibi\Driver
{
use Dibi\Strict;

/** @var PDO|null Connection resource */
private $connection;
private ?PDO $connection;

/** @var int|null Affected rows */
private $affectedRows;
private ?int $affectedRows;

/** @var string */
private $driverName;
private string $driverName;

/** @var string */
private $serverVersion = '';
private string $serverVersion = '';


/** @throws Dibi\NotSupportedException */
Expand Down
6 changes: 2 additions & 4 deletions src/Dibi/Drivers/PdoResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@ class PdoResult implements Dibi\ResultDriver
{
use Dibi\Strict;

/** @var \PDOStatement|null */
private $resultSet;
private ?\PDOStatement $resultSet;

/** @var string */
private $driverName;
private string $driverName;


public function __construct(\PDOStatement $resultSet, string $driverName)
Expand Down
3 changes: 1 addition & 2 deletions src/Dibi/Drivers/PostgreDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ class PostgreDriver implements Dibi\Driver
/** @var resource */
private $connection;

/** @var int|null Affected rows */
private $affectedRows;
private ?int $affectedRows;


/** @throws Dibi\NotSupportedException */
Expand Down
6 changes: 2 additions & 4 deletions src/Dibi/Drivers/PostgreReflector.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@ class PostgreReflector implements Dibi\Reflector
{
use Dibi\Strict;

/** @var Dibi\Driver */
private $driver;
private Dibi\Driver $driver;

/** @var string */
private $version;
private string $version;


public function __construct(Dibi\Driver $driver, string $version)
Expand Down
3 changes: 1 addition & 2 deletions src/Dibi/Drivers/PostgreResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ class PostgreResult implements Dibi\ResultDriver
/** @var resource */
private $resultSet;

/** @var bool */
private $autoFree = true;
private bool $autoFree = true;


/**
Expand Down
9 changes: 3 additions & 6 deletions src/Dibi/Drivers/SqliteDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,11 @@ class SqliteDriver implements Dibi\Driver
{
use Dibi\Strict;

/** @var SQLite3 */
private $connection;
private SQLite3 $connection;

/** @var string Date format */
private $fmtDate;
private string $fmtDate;

/** @var string Datetime format */
private $fmtDateTime;
private string $fmtDateTime;


/** @throws Dibi\NotSupportedException */
Expand Down
3 changes: 1 addition & 2 deletions src/Dibi/Drivers/SqliteReflector.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ class SqliteReflector implements Dibi\Reflector
{
use Dibi\Strict;

/** @var Dibi\Driver */
private $driver;
private Dibi\Driver $driver;


public function __construct(Dibi\Driver $driver)
Expand Down
6 changes: 2 additions & 4 deletions src/Dibi/Drivers/SqliteResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@ class SqliteResult implements Dibi\ResultDriver
{
use Dibi\Strict;

/** @var \SQLite3Result */
private $resultSet;
private \SQLite3Result $resultSet;

/** @var bool */
private $autoFree = true;
private bool $autoFree = true;


public function __construct(\SQLite3Result $resultSet)
Expand Down
Loading

0 comments on commit 9fb73cb

Please sign in to comment.