Skip to content

Commit

Permalink
readonly properties
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Dec 13, 2023
1 parent 39b4b77 commit cfe720b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions src/Database/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ class Connection


public function __construct(
private string $dsn,
private readonly string $dsn,
#[\SensitiveParameter]
private ?string $user = null,
private readonly ?string $user = null,
#[\SensitiveParameter]
private ?string $password = null,
private array $options = [],
private readonly ?string $password = null,
private readonly array $options = [],
) {
if (empty($options['lazy'])) {
$this->connect();
Expand Down
8 changes: 4 additions & 4 deletions src/Database/Explorer.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
*/
class Explorer
{
private Conventions $conventions;
private readonly Conventions $conventions;


public function __construct(
private Connection $connection,
private IStructure $structure,
private readonly Connection $connection,
private readonly IStructure $structure,
?Conventions $conventions = null,
private ?Nette\Caching\Storage $cacheStorage = null,
private readonly ?Nette\Caching\Storage $cacheStorage = null,
) {
$this->conventions = $conventions ?: new StaticConventions;
}
Expand Down
6 changes: 3 additions & 3 deletions src/Database/ResultSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ class ResultSet implements \Iterator, IRowContainer


public function __construct(
private Connection $connection,
private string $queryString,
private array $params,
private readonly Connection $connection,
private readonly string $queryString,
private readonly array $params,
?callable $normalizer = null,
) {
$time = microtime(true);
Expand Down
4 changes: 2 additions & 2 deletions src/Database/SqlLiteral.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
class SqlLiteral
{
public function __construct(
private string $value,
private array $parameters = [],
private readonly string $value,
private readonly array $parameters = [],
) {
}

Expand Down

0 comments on commit cfe720b

Please sign in to comment.