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 9705308 commit a577d80
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 44 deletions.
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
11 changes: 4 additions & 7 deletions src/Dibi/Reflection/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,14 @@
*/
class Database
{
private Dibi\Reflector $reflector;
private ?string $name;

/** @var Table[] */
private array $tables;


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


Expand Down
14 changes: 4 additions & 10 deletions src/Dibi/Reflection/ForeignKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,10 @@
*/
class ForeignKey
{
private string $name;

/** @var array of [local, foreign, onDelete, onUpdate] */
private array $references;


public function __construct(string $name, array $references)
{
$this->name = $name;
$this->references = $references;
public function __construct(
private string $name,
private array $references,
) {
}


Expand Down
10 changes: 3 additions & 7 deletions src/Dibi/Reflection/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,9 @@
*/
class Index
{
/** @var array (name, columns, [unique], [primary]) */
private array $info;


public function __construct(array $info)
{
$this->info = $info;
public function __construct(
private array $info,
) {
}


Expand Down
8 changes: 3 additions & 5 deletions src/Dibi/Reflection/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,16 @@
*/
class Result
{
private Dibi\ResultDriver $driver;

/** @var Column[]|null */
private ?array $columns;

/** @var Column[]|null */
private ?array $names;


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


Expand Down
7 changes: 3 additions & 4 deletions src/Dibi/ResultIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,13 @@
*/
class ResultIterator implements \Iterator, \Countable
{
private Result $result;
private mixed $row;
private int $pointer = 0;


public function __construct(Result $result)
{
$this->result = $result;
public function __construct(
private Result $result,
) {
}


Expand Down

0 comments on commit a577d80

Please sign in to comment.