Skip to content

Commit 65daddb

Browse files
committed
used promoted properties
1 parent 2d88b17 commit 65daddb

File tree

3 files changed

+12
-28
lines changed

3 files changed

+12
-28
lines changed

src/Security/Passwords.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,14 @@ class Passwords
1919
{
2020
use Nette\SmartObject;
2121

22-
private string $algo;
23-
private array $options;
24-
25-
2622
/**
2723
* Chooses which secure algorithm is used for hashing and how to configure it.
2824
* @see https://php.net/manual/en/password.constants.php
2925
*/
30-
public function __construct(string $algo = PASSWORD_DEFAULT, array $options = [])
31-
{
32-
$this->algo = $algo;
33-
$this->options = $options;
26+
public function __construct(
27+
private string $algo = PASSWORD_DEFAULT,
28+
private array $options = [],
29+
) {
3430
}
3531

3632

src/Security/SimpleAuthenticator.php

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,16 @@ class SimpleAuthenticator implements Authenticator
1919
{
2020
use Nette\SmartObject;
2121

22-
private array $passwords;
23-
private array $roles;
24-
private array $data;
25-
26-
2722
/**
2823
* @param array $passwords list of pairs username => password
2924
* @param array $roles list of pairs username => role[]
3025
* @param array $data list of pairs username => mixed[]
3126
*/
32-
public function __construct(array $passwords, array $roles = [], array $data = [])
33-
{
34-
$this->passwords = $passwords;
35-
$this->roles = $roles;
36-
$this->data = $data;
27+
public function __construct(
28+
private array $passwords,
29+
private array $roles = [],
30+
private array $data = [],
31+
) {
3732
}
3833

3934

src/Security/User.php

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,23 +50,16 @@ class User
5050
/** @var callable[] function (User $sender): void; Occurs when the user is logged out */
5151
public iterable $onLoggedOut = [];
5252

53-
/** Session storage for current user */
54-
private UserStorage $storage;
55-
private ?Authenticator $authenticator;
56-
private ?Authorizator $authorizator;
5753
private ?IIdentity $identity = null;
5854
private ?bool $authenticated = null;
5955
private ?int $logoutReason = null;
6056

6157

6258
public function __construct(
63-
UserStorage $storage,
64-
?Authenticator $authenticator = null,
65-
?Authorizator $authorizator = null,
59+
private UserStorage $storage,
60+
private ?Authenticator $authenticator = null,
61+
private ?Authorizator $authorizator = null,
6662
) {
67-
$this->storage = $storage;
68-
$this->authenticator = $authenticator;
69-
$this->authorizator = $authorizator;
7063
}
7164

7265

0 commit comments

Comments
 (0)