@@ -32,10 +32,6 @@ final class Pbkdf2PasswordHasher implements LegacyPasswordHasherInterface
3232{
3333 use CheckPasswordLengthTrait;
3434
35- private string $ algorithm ;
36- private bool $ encodeHashAsBase64 ;
37- private int $ iterations = 1 ;
38- private int $ length ;
3935 private int $ encodedLength = -1 ;
4036
4137 /**
@@ -44,19 +40,17 @@ final class Pbkdf2PasswordHasher implements LegacyPasswordHasherInterface
4440 * @param int $iterations The number of iterations to use to stretch the password hash
4541 * @param int $length Length of derived key to create
4642 */
47- public function __construct (string $ algorithm = ' sha512 ' , bool $ encodeHashAsBase64 = true , int $ iterations = 1000 , int $ length = 40 )
48- {
49- $ this -> algorithm = $ algorithm ;
50- $ this -> encodeHashAsBase64 = $ encodeHashAsBase64 ;
51- $ this -> length = $ length ;
52-
43+ public function __construct (
44+ private string $ algorithm = ' sha512 ' ,
45+ private bool $ encodeHashAsBase64 = true ,
46+ private int $ iterations = 1000 ,
47+ private int $ length = 40 ,
48+ ) {
5349 try {
5450 $ this ->encodedLength = \strlen ($ this ->hash ('' , 'salt ' ));
5551 } catch (\LogicException ) {
5652 // ignore unsupported algorithm
5753 }
58-
59- $ this ->iterations = $ iterations ;
6054 }
6155
6256 public function hash (#[\SensitiveParameter] string $ plainPassword , ?string $ salt = null ): string
0 commit comments