Skip to content

Commit 0eae081

Browse files
committed
used promoted properties
1 parent 1767c8e commit 0eae081

File tree

3 files changed

+12
-28
lines changed

3 files changed

+12
-28
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

+5-10
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

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

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

6561

6662
public function __construct(
67-
UserStorage $storage,
68-
?Authenticator $authenticator = null,
69-
?Authorizator $authorizator = null,
63+
private UserStorage $storage,
64+
private ?Authenticator $authenticator = null,
65+
private ?Authorizator $authorizator = null,
7066
) {
71-
$this->storage = $storage;
72-
$this->authenticator = $authenticator;
73-
$this->authorizator = $authorizator;
7467
}
7568

7669

0 commit comments

Comments
 (0)