Skip to content

Commit 00f96bb

Browse files
Use #[AsCommand] to describe commands
1 parent fa3ef22 commit 00f96bb

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

Command/UserPasswordHashCommand.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\PasswordHasher\Command;
1313

14+
use Symfony\Component\Console\Attribute\AsCommand;
1415
use Symfony\Component\Console\Command\Command;
1516
use Symfony\Component\Console\Exception\InvalidArgumentException;
1617
use Symfony\Component\Console\Exception\RuntimeException;
@@ -32,11 +33,9 @@
3233
*
3334
* @final
3435
*/
36+
#[AsCommand(name: 'security:hash-password', description: 'Hash a user password')]
3537
class UserPasswordHashCommand extends Command
3638
{
37-
protected static $defaultName = 'security:hash-password';
38-
protected static $defaultDescription = 'Hash a user password';
39-
4039
private PasswordHasherFactoryInterface $hasherFactory;
4140
private array $userClasses;
4241

@@ -54,7 +53,6 @@ public function __construct(PasswordHasherFactoryInterface $hasherFactory, array
5453
protected function configure()
5554
{
5655
$this
57-
->setDescription(self::$defaultDescription)
5856
->addArgument('password', InputArgument::OPTIONAL, 'The plain password to hash.')
5957
->addArgument('user-class', InputArgument::OPTIONAL, 'The User entity class path associated with the hasher used to hash the password.')
6058
->addOption('empty-salt', null, InputOption::VALUE_NONE, 'Do not generate a salt or let the hasher generate one.')

0 commit comments

Comments
 (0)