Skip to content

Commit ff49d16

Browse files
committed
Merge branch '4.4' into 5.0
* 4.4: Fix CS Fix CS
2 parents c5e0664 + d145d94 commit ff49d16

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

Authentication/Token/AbstractToken.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ public function setAttribute(string $name, $value)
225225
*/
226226
public function __toString()
227227
{
228-
$class = \get_class($this);
228+
$class = static::class;
229229
$class = substr($class, strrpos($class, '\\') + 1);
230230

231231
$roles = [];

Encoder/NativePasswordEncoder.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ final class NativePasswordEncoder implements PasswordEncoderInterface, SelfSalti
3333
public function __construct(int $opsLimit = null, int $memLimit = null, int $cost = null, string $algo = null)
3434
{
3535
$cost = $cost ?? 13;
36-
$opsLimit = $opsLimit ?? max(4, \defined('SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE') ? \SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE : 4);
37-
$memLimit = $memLimit ?? max(64 * 1024 * 1024, \defined('SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE') ? \SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE : 64 * 1024 * 1024);
36+
$opsLimit = $opsLimit ?? max(4, \defined('SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE') ? SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE : 4);
37+
$memLimit = $memLimit ?? max(64 * 1024 * 1024, \defined('SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE') ? SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE : 64 * 1024 * 1024);
3838

3939
if (3 > $opsLimit) {
4040
throw new \InvalidArgumentException('$opsLimit must be 3 or greater.');
@@ -89,7 +89,7 @@ public function isPasswordValid(string $encoded, string $raw, ?string $salt): bo
8989
return (72 >= \strlen($raw) || 0 !== strpos($encoded, '$2')) && password_verify($raw, $encoded);
9090
}
9191

92-
if (\extension_loaded('sodium') && version_compare(\SODIUM_LIBRARY_VERSION, '1.0.14', '>=')) {
92+
if (\extension_loaded('sodium') && version_compare(SODIUM_LIBRARY_VERSION, '1.0.14', '>=')) {
9393
return sodium_crypto_pwhash_str_verify($encoded, $raw);
9494
}
9595

Encoder/SodiumPasswordEncoder.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ public function __construct(int $opsLimit = null, int $memLimit = null)
3434
throw new LogicException('Libsodium is not available. You should either install the sodium extension, upgrade to PHP 7.2+ or use a different encoder.');
3535
}
3636

37-
$this->opsLimit = $opsLimit ?? max(4, \defined('SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE') ? \SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE : 4);
38-
$this->memLimit = $memLimit ?? max(64 * 1024 * 1024, \defined('SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE') ? \SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE : 64 * 1024 * 2014);
37+
$this->opsLimit = $opsLimit ?? max(4, \defined('SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE') ? SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE : 4);
38+
$this->memLimit = $memLimit ?? max(64 * 1024 * 1024, \defined('SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE') ? SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE : 64 * 1024 * 2014);
3939

4040
if (3 > $this->opsLimit) {
4141
throw new \InvalidArgumentException('$opsLimit must be 3 or greater.');
@@ -48,7 +48,7 @@ public function __construct(int $opsLimit = null, int $memLimit = null)
4848

4949
public static function isSupported(): bool
5050
{
51-
return version_compare(\extension_loaded('sodium') ? \SODIUM_LIBRARY_VERSION : phpversion('libsodium'), '1.0.14', '>=');
51+
return version_compare(\extension_loaded('sodium') ? SODIUM_LIBRARY_VERSION : phpversion('libsodium'), '1.0.14', '>=');
5252
}
5353

5454
/**

Tests/Encoder/EncoderFactoryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public function testMigrateFrom()
150150
$this->assertInstanceOf(MigratingPasswordEncoder::class, $encoder);
151151

152152
$this->assertTrue($encoder->isPasswordValid((new SodiumPasswordEncoder())->encodePassword('foo', null), 'foo', null));
153-
$this->assertTrue($encoder->isPasswordValid((new NativePasswordEncoder(null, null, null, \PASSWORD_BCRYPT))->encodePassword('foo', null), 'foo', null));
153+
$this->assertTrue($encoder->isPasswordValid((new NativePasswordEncoder(null, null, null, PASSWORD_BCRYPT))->encodePassword('foo', null), 'foo', null));
154154
$this->assertTrue($encoder->isPasswordValid($digest->encodePassword('foo', null), 'foo', null));
155155
$this->assertStringStartsWith(SODIUM_CRYPTO_PWHASH_STRPREFIX, $encoder->encodePassword('foo', null));
156156
}

0 commit comments

Comments
 (0)