Skip to content

Commit 18d7045

Browse files
authored
feature #295 [command] use AsCommand attribute
1 parent d7f61bc commit 18d7045

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ find a change that break's semver, please create an issue.*
1111

1212
- [#300](https://github.com/symfonycasts/reset-password-bundle/pull/300) - [interface] change `generateResetToken()` signature - *@jrushlow*
1313
- [#298](https://github.com/symfonycasts/reset-password-bundle/pull/298) - replace final annotation with final class keyword - *@jrushlow*
14+
- [#295](https://github.com/symfonycasts/reset-password-bundle/pull/295) - [command] use `AsCommand` attribute - *@jrushlow*
1415

1516
## [v1.18.0](https://github.com/symfonycasts/reset-password-bundle/releases/tag/v1.18.0)
1617

UPGRADING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,5 @@ replaced with the `final` class keyword. Extending this class is not allowed.
2121

2222
- Class became `@final` in `v1.22.0` and in `v2.0.0` the `@final` annotation was
2323
replaced with the `final` class keyword. Extending this class is not allowed.
24+
25+
- Command is now registered using the Symfony `#[AsCommand]` attribute

src/Command/ResetPasswordRemoveExpiredCommand.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
namespace SymfonyCasts\Bundle\ResetPassword\Command;
1111

12+
use Symfony\Component\Console\Attribute\AsCommand;
1213
use Symfony\Component\Console\Command\Command;
1314
use Symfony\Component\Console\Input\InputInterface;
1415
use Symfony\Component\Console\Output\OutputInterface;
@@ -18,17 +19,13 @@
1819
* @author Jesse Rushlow <jr@rushlow.dev>
1920
* @author Ryan Weaver <ryan@symfonycasts.com>
2021
*/
22+
#[AsCommand(name: 'reset-password:remove-expired', description: 'Remove expired reset password requests from persistence.')]
2123
final class ResetPasswordRemoveExpiredCommand extends Command
2224
{
2325
public function __construct(
2426
private ResetPasswordCleaner $cleaner
2527
) {
26-
parent::__construct('reset-password:remove-expired');
27-
}
28-
29-
protected function configure(): void
30-
{
31-
$this->setDescription('Remove expired reset password requests from persistence.');
28+
parent::__construct();
3229
}
3330

3431
protected function execute(InputInterface $input, OutputInterface $output): int

0 commit comments

Comments
 (0)