Skip to content

Commit

Permalink
uses promoted properties
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Sep 3, 2024
1 parent 4cb2500 commit 3d13aff
Show file tree
Hide file tree
Showing 26 changed files with 95 additions and 197 deletions.
12 changes: 4 additions & 8 deletions src/Dibi/Bridges/Nette/DibiExtension22.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,10 @@
*/
class DibiExtension22 extends Nette\DI\CompilerExtension
{
private ?bool $debugMode;
private ?bool $cliMode;


public function __construct(?bool $debugMode = null, ?bool $cliMode = null)
{
$this->debugMode = $debugMode;
$this->cliMode = $cliMode;
public function __construct(
private ?bool $debugMode = null,
private ?bool $cliMode = null,
) {
}


Expand Down
12 changes: 4 additions & 8 deletions src/Dibi/Bridges/Nette/DibiExtension3.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,10 @@
*/
class DibiExtension3 extends Nette\DI\CompilerExtension
{
private ?bool $debugMode;
private ?bool $cliMode;


public function __construct(?bool $debugMode = null, ?bool $cliMode = null)
{
$this->debugMode = $debugMode;
$this->cliMode = $cliMode;
public function __construct(
private ?bool $debugMode = null,
private ?bool $cliMode = null,
) {
}


Expand Down
11 changes: 5 additions & 6 deletions src/Dibi/Bridges/Tracy/Panel.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,14 @@
class Panel implements Tracy\IBarPanel
{
public static int $maxLength = 1000;
public bool|string $explain;
public int $filter;

private array $events = [];


public function __construct(bool $explain = true, ?int $filter = null)
{
$this->filter = $filter ?: Event::QUERY;
$this->explain = $explain;
public function __construct(
public bool|string $explain = true,
public int $filter = Event::QUERY,
) {
}


Expand Down
9 changes: 3 additions & 6 deletions src/Dibi/Drivers/FirebirdReflector.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,9 @@
*/
class FirebirdReflector implements Dibi\Reflector
{
private Dibi\Driver $driver;


public function __construct(Dibi\Driver $driver)
{
$this->driver = $driver;
public function __construct(
private Dibi\Driver $driver,
) {
}


Expand Down
14 changes: 4 additions & 10 deletions src/Dibi/Drivers/FirebirdResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,10 @@
*/
class FirebirdResult implements Dibi\ResultDriver
{
/** @var resource */
private $resultSet;


/**
* @param resource $resultSet
*/
public function __construct($resultSet)
{
$this->resultSet = $resultSet;
public function __construct(
/** @var resource */
private $resultSet,
) {
}


Expand Down
9 changes: 3 additions & 6 deletions src/Dibi/Drivers/MySqlReflector.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,9 @@
*/
class MySqlReflector implements Dibi\Reflector
{
private Dibi\Driver $driver;


public function __construct(Dibi\Driver $driver)
{
$this->driver = $driver;
public function __construct(
private Dibi\Driver $driver,
) {
}


Expand Down
12 changes: 4 additions & 8 deletions src/Dibi/Drivers/MySqliResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,10 @@
*/
class MySqliResult implements Dibi\ResultDriver
{
private \mysqli_result $resultSet;
private bool $buffered;


public function __construct(\mysqli_result $resultSet, bool $buffered)
{
$this->resultSet = $resultSet;
$this->buffered = $buffered;
public function __construct(
private \mysqli_result $resultSet,
private bool $buffered,
) {
}


Expand Down
9 changes: 3 additions & 6 deletions src/Dibi/Drivers/NoDataResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,9 @@
*/
class NoDataResult implements Dibi\ResultDriver
{
private int $rows;


public function __construct(int $rows)
{
$this->rows = $rows;
public function __construct(
private int $rows,
) {
}


Expand Down
9 changes: 3 additions & 6 deletions src/Dibi/Drivers/OdbcReflector.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,9 @@
*/
class OdbcReflector implements Dibi\Reflector
{
private Dibi\Driver $driver;


public function __construct(Dibi\Driver $driver)
{
$this->driver = $driver;
public function __construct(
private Dibi\Driver $driver,
) {
}


Expand Down
12 changes: 4 additions & 8 deletions src/Dibi/Drivers/OdbcResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,13 @@
*/
class OdbcResult implements Dibi\ResultDriver
{
/** @var resource */
private $resultSet;
private int $row = 0;


/**
* @param resource $resultSet
*/
public function __construct($resultSet)
{
$this->resultSet = $resultSet;
public function __construct(
/** @var resource */
private $resultSet,
) {
}


Expand Down
9 changes: 3 additions & 6 deletions src/Dibi/Drivers/OracleReflector.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,9 @@
*/
class OracleReflector implements Dibi\Reflector
{
private Dibi\Driver $driver;


public function __construct(Dibi\Driver $driver)
{
$this->driver = $driver;
public function __construct(
private Dibi\Driver $driver,
) {
}


Expand Down
14 changes: 4 additions & 10 deletions src/Dibi/Drivers/OracleResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,10 @@
*/
class OracleResult implements Dibi\ResultDriver
{
/** @var resource */
private $resultSet;


/**
* @param resource $resultSet
*/
public function __construct($resultSet)
{
$this->resultSet = $resultSet;
public function __construct(
/** @var resource */
private $resultSet,
) {
}


Expand Down
12 changes: 4 additions & 8 deletions src/Dibi/Drivers/PdoResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,10 @@
*/
class PdoResult implements Dibi\ResultDriver
{
private ?\PDOStatement $resultSet;
private string $driverName;


public function __construct(\PDOStatement $resultSet, string $driverName)
{
$this->resultSet = $resultSet;
$this->driverName = $driverName;
public function __construct(
private ?\PDOStatement $resultSet,
private string $driverName,
) {
}


Expand Down
12 changes: 4 additions & 8 deletions src/Dibi/Drivers/PostgreReflector.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,10 @@
*/
class PostgreReflector implements Dibi\Reflector
{
private Dibi\Driver $driver;
private string $version;


public function __construct(Dibi\Driver $driver, string $version)
{
$this->driver = $driver;
$this->version = $version;
public function __construct(
private Dibi\Driver $driver,
private string $version,
) {
}


Expand Down
14 changes: 4 additions & 10 deletions src/Dibi/Drivers/PostgreResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,10 @@
*/
class PostgreResult implements Dibi\ResultDriver
{
/** @var resource|PgSql\Result */
private $resultSet;


/**
* @param resource|PgSql\Result $resultSet
*/
public function __construct($resultSet)
{
$this->resultSet = $resultSet;
public function __construct(
/** @var resource|PgSql\Result */
private $resultSet,
) {
}


Expand Down
9 changes: 3 additions & 6 deletions src/Dibi/Drivers/SqliteReflector.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,9 @@
*/
class SqliteReflector implements Dibi\Reflector
{
private Dibi\Driver $driver;


public function __construct(Dibi\Driver $driver)
{
$this->driver = $driver;
public function __construct(
private Dibi\Driver $driver,
) {
}


Expand Down
9 changes: 3 additions & 6 deletions src/Dibi/Drivers/SqliteResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,9 @@
*/
class SqliteResult implements Dibi\ResultDriver
{
private \SQLite3Result $resultSet;


public function __construct(\SQLite3Result $resultSet)
{
$this->resultSet = $resultSet;
public function __construct(
private \SQLite3Result $resultSet,
) {
}


Expand Down
9 changes: 3 additions & 6 deletions src/Dibi/Drivers/SqlsrvReflector.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,9 @@
*/
class SqlsrvReflector implements Dibi\Reflector
{
private Dibi\Driver $driver;


public function __construct(Dibi\Driver $driver)
{
$this->driver = $driver;
public function __construct(
private Dibi\Driver $driver,
) {
}


Expand Down
14 changes: 4 additions & 10 deletions src/Dibi/Drivers/SqlsrvResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,10 @@
*/
class SqlsrvResult implements Dibi\ResultDriver
{
/** @var resource */
private $resultSet;


/**
* @param resource $resultSet
*/
public function __construct($resultSet)
{
$this->resultSet = $resultSet;
public function __construct(
/** @var resource */
private $resultSet,
) {
}


Expand Down
16 changes: 5 additions & 11 deletions src/Dibi/Loggers/FileLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,11 @@
*/
class FileLogger
{
/** Name of the file where SQL errors should be logged */
public string $file;
public int $filter;
private bool $errorsOnly;


public function __construct(string $file, ?int $filter = null, bool $errorsOnly = false)
{
$this->file = $file;
$this->filter = $filter ?: Dibi\Event::QUERY;
$this->errorsOnly = $errorsOnly;
public function __construct(
public string $file,
public int $filter = Dibi\Event::QUERY,
private bool $errorsOnly = false,
) {
}


Expand Down
15 changes: 4 additions & 11 deletions src/Dibi/Reflection/Column.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,10 @@
*/
class Column
{
/** when created by Result */
private ?Dibi\Reflector $reflector;

/** @var array (name, nativetype, [table], [fullname], [size], [nullable], [default], [autoincrement], [vendor]) */
private array $info;


public function __construct(?Dibi\Reflector $reflector, array $info)
{
$this->reflector = $reflector;
$this->info = $info;
public function __construct(
private ?Dibi\Reflector $reflector,
private array $info,
) {
}


Expand Down
Loading

0 comments on commit 3d13aff

Please sign in to comment.