Skip to content

Commit d1d86cc

Browse files
committed
used promoted properties
1 parent 6eb42f8 commit d1d86cc

File tree

3 files changed

+10
-29
lines changed

3 files changed

+10
-29
lines changed

src/Security/Passwords.php

+4-8
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

+3-11
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,17 @@ 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
*/
3227
public function __construct(
3328
#[\SensitiveParameter]
34-
array $passwords,
35-
array $roles = [],
36-
array $data = []
29+
private array $passwords,
30+
private array $roles = [],
31+
private array $data = [],
3732
) {
38-
$this->passwords = $passwords;
39-
$this->roles = $roles;
40-
$this->data = $data;
4133
}
4234

4335

src/Security/User.php

+3-10
Original file line numberDiff line numberDiff line change
@@ -53,23 +53,16 @@ class User
5353
/** @var callable[] function (User $sender): void; Occurs when the user is logged out */
5454
public array $onLoggedOut = [];
5555

56-
/** Session storage for current user */
57-
private UserStorage $storage;
58-
private ?Authenticator $authenticator;
59-
private ?Authorizator $authorizator;
6056
private ?IIdentity $identity = null;
6157
private ?bool $authenticated = null;
6258
private ?int $logoutReason = null;
6359

6460

6561
public function __construct(
66-
UserStorage $storage,
67-
?Authenticator $authenticator = null,
68-
?Authorizator $authorizator = null,
62+
private UserStorage $storage,
63+
private ?Authenticator $authenticator = null,
64+
private ?Authorizator $authorizator = null,
6965
) {
70-
$this->storage = $storage;
71-
$this->authenticator = $authenticator;
72-
$this->authorizator = $authorizator;
7366
}
7467

7568

0 commit comments

Comments
 (0)