Skip to content

Commit b76cb9e

Browse files
committed
added property typehints
1 parent 568b675 commit b76cb9e

25 files changed

Lines changed: 155 additions & 235 deletions

src/Bridges/DatabaseDI/DatabaseExtension.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818
*/
1919
class DatabaseExtension extends Nette\DI\CompilerExtension
2020
{
21-
/** @var bool */
22-
private $debugMode;
21+
private bool $debugMode;
2322

2423

2524
public function __construct(bool $debugMode = false)

src/Bridges/DatabaseTracy/ConnectionPanel.php

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,32 +22,23 @@ class ConnectionPanel implements Tracy\IBarPanel
2222
{
2323
use Nette\SmartObject;
2424

25-
/** @var int */
26-
public $maxQueries = 100;
25+
public int $maxQueries = 100;
2726

28-
/** @var string */
29-
public $name;
27+
public string $name;
3028

31-
/** @var bool|string explain queries? */
32-
public $explain = true;
29+
public bool|string $explain = true;
3330

34-
/** @var bool */
35-
public $disabled = false;
31+
public bool $disabled = false;
3632

37-
/** @var float */
38-
public $performanceScale = 0.25;
33+
public float $performanceScale = 0.25;
3934

40-
/** @var float logged time */
41-
private $totalTime = 0;
35+
private float $totalTime = 0;
4236

43-
/** @var int */
44-
private $count = 0;
37+
private int $count = 0;
4538

46-
/** @var array */
47-
private $queries = [];
39+
private array $queries = [];
4840

49-
/** @var Tracy\BlueScreen */
50-
private $blueScreen;
41+
private Tracy\BlueScreen $blueScreen;
5142

5243

5344
public function __construct(Connection $connection, Tracy\BlueScreen $blueScreen)

src/Database/Connection.php

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,29 +28,22 @@ class Connection
2828
/** @var array<callable(self, ResultSet|DriverException): void> Occurs after query is executed */
2929
public $onQuery = [];
3030

31-
/** @var array */
32-
private $params;
31+
private array $params;
3332

34-
/** @var array */
35-
private $options;
33+
private array $options;
3634

37-
/** @var Driver */
38-
private $driver;
35+
private Driver $driver;
3936

40-
/** @var SqlPreprocessor */
41-
private $preprocessor;
37+
private SqlPreprocessor $preprocessor;
4238

43-
/** @var PDO|null */
44-
private $pdo;
39+
private ?PDO $pdo = null;
4540

4641
/** @var callable(array, ResultSet): array */
4742
private $rowNormalizer = [Helpers::class, 'normalizeRow'];
4843

49-
/** @var string|null */
50-
private $sql;
44+
private ?string $sql = null;
5145

52-
/** @var int */
53-
private $transactionDepth = 0;
46+
private int $transactionDepth = 0;
5447

5548

5649
public function __construct(string $dsn, string $user = null, string $password = null, array $options = null)

src/Database/Conventions/DiscoveredConventions.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818
*/
1919
class DiscoveredConventions implements Conventions
2020
{
21-
/** @var IStructure */
22-
protected $structure;
21+
protected IStructure $structure;
2322

2423

2524
public function __construct(IStructure $structure)

src/Database/Conventions/StaticConventions.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,11 @@ class StaticConventions implements Conventions
2020
{
2121
use Nette\SmartObject;
2222

23-
/** @var string */
24-
protected $primary;
23+
protected string $primary;
2524

26-
/** @var string */
27-
protected $foreign;
25+
protected string $foreign;
2826

29-
/** @var string */
30-
protected $table;
27+
protected string $table;
3128

3229

3330
/**

src/Database/DriverException.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,9 @@
1515
*/
1616
class DriverException extends \PDOException
1717
{
18-
/** @var string */
19-
public $queryString;
18+
public ?string $queryString = null;
2019

21-
/** @var array */
22-
public $params;
20+
public ?array $params = null;
2321

2422

2523
/**

src/Database/Drivers/MsSqlDriver.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ class MsSqlDriver implements Nette\Database\Driver
1919
{
2020
use Nette\SmartObject;
2121

22-
/** @var Nette\Database\Connection */
23-
private $connection;
22+
private Nette\Database\Connection $connection;
2423

2524

2625
public function initialize(Nette\Database\Connection $connection, array $options): void

src/Database/Drivers/MySqlDriver.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ class MySqlDriver implements Nette\Database\Driver
2424
ERROR_DUPLICATE_ENTRY = 1062,
2525
ERROR_DATA_TRUNCATED = 1265;
2626

27-
/** @var Nette\Database\Connection */
28-
private $connection;
27+
private Nette\Database\Connection $connection;
2928

3029

3130
/**

src/Database/Drivers/OciDriver.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,10 @@ class OciDriver implements Nette\Database\Driver
1919
{
2020
use Nette\SmartObject;
2121

22-
/** @var Nette\Database\Connection */
23-
private $connection;
22+
private Nette\Database\Connection $connection;
2423

25-
/** @var string Datetime format */
26-
private $fmtDateTime;
24+
/** Datetime format */
25+
private string $fmtDateTime;
2726

2827

2928
public function initialize(Nette\Database\Connection $connection, array $options): void

src/Database/Drivers/PgSqlDriver.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ class PgSqlDriver implements Nette\Database\Driver
1919
{
2020
use Nette\SmartObject;
2121

22-
/** @var Nette\Database\Connection */
23-
private $connection;
22+
private Nette\Database\Connection $connection;
2423

2524

2625
public function initialize(Nette\Database\Connection $connection, array $options): void

0 commit comments

Comments
 (0)