Skip to content

Commit d7430cb

Browse files
committed
used promoted properties
1 parent 9df43b9 commit d7430cb

File tree

3 files changed

+10
-29
lines changed

3 files changed

+10
-29
lines changed

src/Security/Passwords.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,14 @@
1717
*/
1818
class Passwords
1919
{
20-
private string $algo;
21-
private array $options;
22-
23-
2420
/**
2521
* Chooses which secure algorithm is used for hashing and how to configure it.
2622
* @see https://php.net/manual/en/password.constants.php
2723
*/
28-
public function __construct(string $algo = PASSWORD_DEFAULT, array $options = [])
29-
{
30-
$this->algo = $algo;
31-
$this->options = $options;
24+
public function __construct(
25+
private string $algo = PASSWORD_DEFAULT,
26+
private array $options = [],
27+
) {
3228
}
3329

3430

src/Security/SimpleAuthenticator.php

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,17 @@
1515
*/
1616
class SimpleAuthenticator implements Authenticator
1717
{
18-
private array $passwords;
19-
private array $roles;
20-
private array $data;
21-
22-
2318
/**
2419
* @param array $passwords list of pairs username => password
2520
* @param array $roles list of pairs username => role[]
2621
* @param array $data list of pairs username => mixed[]
2722
*/
2823
public function __construct(
2924
#[\SensitiveParameter]
30-
array $passwords,
31-
array $roles = [],
32-
array $data = [],
25+
private array $passwords,
26+
private array $roles = [],
27+
private array $data = [],
3328
) {
34-
$this->passwords = $passwords;
35-
$this->roles = $roles;
36-
$this->data = $data;
3729
}
3830

3931

src/Security/User.php

Lines changed: 3 additions & 10 deletions
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)