Fix: Run 'php-cs-fixer fix'

This commit is contained in:
Andreas Möller 2021-02-14 15:05:11 +01:00
parent 702a3ee82f
commit 2102170e43
No known key found for this signature in database
GPG Key ID: 9FB20A0BAF60E11F
11 changed files with 17 additions and 20 deletions

View File

@ -11,7 +11,6 @@
namespace Symfony\Component\PasswordHasher\Command; namespace Symfony\Component\PasswordHasher\Command;
use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Exception\InvalidArgumentException; use Symfony\Component\Console\Exception\InvalidArgumentException;
use Symfony\Component\Console\Exception\RuntimeException; use Symfony\Component\Console\Exception\RuntimeException;
@ -36,7 +35,7 @@ use Symfony\Component\PasswordHasher\LegacyPasswordHasherInterface;
class UserPasswordHashCommand extends Command class UserPasswordHashCommand extends Command
{ {
protected static $defaultName = 'security:hash-password'; protected static $defaultName = 'security:hash-password';
protected static $defaultDescription = "Hashes a user password"; protected static $defaultDescription = 'Hashes a user password';
private $hasherFactory; private $hasherFactory;
private $userClasses; private $userClasses;

View File

@ -13,7 +13,7 @@ namespace Symfony\Component\PasswordHasher\Exception;
/** /**
* @author Robin Chalas <robin.chalas@gmail.com> * @author Robin Chalas <robin.chalas@gmail.com>
*/ */
class InvalidPasswordException extends \RuntimeException implements ExceptionInterface class InvalidPasswordException extends \RuntimeException implements ExceptionInterface
{ {
public function __construct(string $message = 'Invalid password.', int $code = 0, ?\Throwable $previous = null) public function __construct(string $message = 'Invalid password.', int $code = 0, ?\Throwable $previous = null)

View File

@ -13,7 +13,7 @@ namespace Symfony\Component\PasswordHasher\Exception;
/** /**
* @author Robin Chalas <robin.chalas@gmail.com> * @author Robin Chalas <robin.chalas@gmail.com>
*/ */
class LogicException extends \LogicException implements ExceptionInterface class LogicException extends \LogicException implements ExceptionInterface
{ {
} }

View File

@ -12,7 +12,6 @@
namespace Symfony\Component\PasswordHasher\Hasher; namespace Symfony\Component\PasswordHasher\Hasher;
use Symfony\Component\PasswordHasher\PasswordHasherInterface; use Symfony\Component\PasswordHasher\PasswordHasherInterface;
use Symfony\Component\PasswordHasher\LegacyPasswordHasherInterface;
/** /**
* Hashes passwords using the best available hasher. * Hashes passwords using the best available hasher.

View File

@ -11,8 +11,8 @@
namespace Symfony\Component\PasswordHasher\Hasher; namespace Symfony\Component\PasswordHasher\Hasher;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\PasswordHasher\PasswordHasherInterface; use Symfony\Component\PasswordHasher\PasswordHasherInterface;
use Symfony\Component\Security\Core\User\UserInterface;
/** /**
* PasswordHasherFactoryInterface to support different password hashers for different user accounts. * PasswordHasherFactoryInterface to support different password hashers for different user accounts.

View File

@ -11,8 +11,8 @@
namespace Symfony\Component\PasswordHasher\Hasher; namespace Symfony\Component\PasswordHasher\Hasher;
use Symfony\Component\PasswordHasher\Exception\LogicException;
use Symfony\Component\PasswordHasher\Exception\InvalidPasswordException; use Symfony\Component\PasswordHasher\Exception\InvalidPasswordException;
use Symfony\Component\PasswordHasher\Exception\LogicException;
use Symfony\Component\PasswordHasher\PasswordHasherInterface; use Symfony\Component\PasswordHasher\PasswordHasherInterface;
/** /**

View File

@ -12,15 +12,14 @@
namespace Symfony\Component\PasswordHasher\Tests\Command; namespace Symfony\Component\PasswordHasher\Tests\Command;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Symfony\Bundle\SecurityBundle\Command\UserPasswordHasherCommand;
use Symfony\Component\Console\Tester\CommandTester; use Symfony\Component\Console\Tester\CommandTester;
use Symfony\Component\Security\Core\User\User;
use Symfony\Component\PasswordHasher\Command\UserPasswordHashCommand; use Symfony\Component\PasswordHasher\Command\UserPasswordHashCommand;
use Symfony\Component\PasswordHasher\Hasher\NativePasswordHasher;
use Symfony\Component\PasswordHasher\Hasher\PasswordHasherFactory; use Symfony\Component\PasswordHasher\Hasher\PasswordHasherFactory;
use Symfony\Component\PasswordHasher\Hasher\PasswordHasherFactoryInterface; use Symfony\Component\PasswordHasher\Hasher\PasswordHasherFactoryInterface;
use Symfony\Component\PasswordHasher\Hasher\NativePasswordHasher;
use Symfony\Component\PasswordHasher\Hasher\Pbkdf2PasswordHasher; use Symfony\Component\PasswordHasher\Hasher\Pbkdf2PasswordHasher;
use Symfony\Component\PasswordHasher\Hasher\SodiumPasswordHasher; use Symfony\Component\PasswordHasher\Hasher\SodiumPasswordHasher;
use Symfony\Component\Security\Core\User\User;
class UserPasswordHashCommandTest extends TestCase class UserPasswordHashCommandTest extends TestCase
{ {
@ -240,7 +239,7 @@ class UserPasswordHashCommandTest extends TestCase
public function testEncodePasswordNoConfigForGivenUserClass() public function testEncodePasswordNoConfigForGivenUserClass()
{ {
$this->expectException('\RuntimeException'); $this->expectException(\RuntimeException::class);
$this->expectExceptionMessage('No password hasher has been configured for account "Foo\Bar\User".'); $this->expectExceptionMessage('No password hasher has been configured for account "Foo\Bar\User".');
$this->passwordHasherCommandTester->execute([ $this->passwordHasherCommandTester->execute([
@ -277,7 +276,7 @@ EOTXT
public function testThrowsExceptionOnNoConfiguredHashers() public function testThrowsExceptionOnNoConfiguredHashers()
{ {
$this->expectException('RuntimeException'); $this->expectException(\RuntimeException::class);
$this->expectExceptionMessage('There are no configured password hashers for the "security" extension.'); $this->expectExceptionMessage('There are no configured password hashers for the "security" extension.');
$tester = new CommandTester(new UserPasswordHashCommand($this->getMockBuilder(PasswordHasherFactoryInterface::class)->getMock(), [])); $tester = new CommandTester(new UserPasswordHashCommand($this->getMockBuilder(PasswordHasherFactoryInterface::class)->getMock(), []));

View File

@ -38,7 +38,7 @@ class MessageDigestPasswordHasherTest extends TestCase
public function testHashAlgorithmDoesNotExist() public function testHashAlgorithmDoesNotExist()
{ {
$this->expectException('LogicException'); $this->expectException(\LogicException::class);
$hasher = new MessageDigestPasswordHasher('foobar'); $hasher = new MessageDigestPasswordHasher('foobar');
$hasher->hash('password', ''); $hasher->hash('password', '');
} }

View File

@ -12,11 +12,11 @@
namespace Symfony\Component\PasswordHasher\Tests\Hasher; namespace Symfony\Component\PasswordHasher\Tests\Hasher;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Symfony\Component\PasswordHasher\Hasher\PasswordHasherAwareInterface;
use Symfony\Component\PasswordHasher\Hasher\PasswordHasherFactory;
use Symfony\Component\PasswordHasher\Hasher\MessageDigestPasswordHasher; use Symfony\Component\PasswordHasher\Hasher\MessageDigestPasswordHasher;
use Symfony\Component\PasswordHasher\Hasher\MigratingPasswordHasher; use Symfony\Component\PasswordHasher\Hasher\MigratingPasswordHasher;
use Symfony\Component\PasswordHasher\Hasher\NativePasswordHasher; use Symfony\Component\PasswordHasher\Hasher\NativePasswordHasher;
use Symfony\Component\PasswordHasher\Hasher\PasswordHasherAwareInterface;
use Symfony\Component\PasswordHasher\Hasher\PasswordHasherFactory;
use Symfony\Component\PasswordHasher\Hasher\SodiumPasswordHasher; use Symfony\Component\PasswordHasher\Hasher\SodiumPasswordHasher;
use Symfony\Component\Security\Core\User\User; use Symfony\Component\Security\Core\User\User;
use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Component\Security\Core\User\UserInterface;
@ -112,7 +112,7 @@ class PasswordHasherFactoryTest extends TestCase
public function testGetInvalidNamedHasherForHasherAware() public function testGetInvalidNamedHasherForHasherAware()
{ {
$this->expectException('RuntimeException'); $this->expectException(\RuntimeException::class);
$factory = new PasswordHasherFactory([ $factory = new PasswordHasherFactory([
HasherAwareUser::class => new MessageDigestPasswordHasher('sha1'), HasherAwareUser::class => new MessageDigestPasswordHasher('sha1'),
'hasher_name' => new MessageDigestPasswordHasher('sha256'), 'hasher_name' => new MessageDigestPasswordHasher('sha256'),

View File

@ -38,7 +38,7 @@ class Pbkdf2PasswordHasherTest extends TestCase
public function testHashAlgorithmDoesNotExist() public function testHashAlgorithmDoesNotExist()
{ {
$this->expectException('LogicException'); $this->expectException(\LogicException::class);
$hasher = new Pbkdf2PasswordHasher('foobar'); $hasher = new Pbkdf2PasswordHasher('foobar');
$hasher->hash('password', ''); $hasher->hash('password', '');
} }

View File

@ -12,12 +12,12 @@
namespace Symfony\Component\PasswordHasher\Tests\Hasher; namespace Symfony\Component\PasswordHasher\Tests\Hasher;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\PasswordHasher\Hasher\PasswordHasherFactoryInterface;
use Symfony\Component\PasswordHasher\Hasher\NativePasswordHasher; use Symfony\Component\PasswordHasher\Hasher\NativePasswordHasher;
use Symfony\Component\PasswordHasher\Hasher\PasswordHasherFactoryInterface;
use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasher; use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasher;
use Symfony\Component\Security\Core\User\User;
use Symfony\Component\PasswordHasher\PasswordHasherInterface; use Symfony\Component\PasswordHasher\PasswordHasherInterface;
use Symfony\Component\Security\Core\User\User;
use Symfony\Component\Security\Core\User\UserInterface;
class UserPasswordHasherTest extends TestCase class UserPasswordHasherTest extends TestCase
{ {