Skip to content

Commit b9998c0

Browse files
committed
Add #[AsCommand] attribute for discovery and future-proofness
1 parent d2ca305 commit b9998c0

File tree

5 files changed

+11
-1
lines changed

5 files changed

+11
-1
lines changed

src/Command/ClearExpiredTokensCommand.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@
77
use League\Bundle\OAuth2ServerBundle\Manager\AccessTokenManagerInterface;
88
use League\Bundle\OAuth2ServerBundle\Manager\AuthorizationCodeManagerInterface;
99
use League\Bundle\OAuth2ServerBundle\Manager\RefreshTokenManagerInterface;
10+
use Symfony\Component\Console\Attribute\AsCommand;
1011
use Symfony\Component\Console\Command\Command;
1112
use Symfony\Component\Console\Input\InputInterface;
1213
use Symfony\Component\Console\Input\InputOption;
1314
use Symfony\Component\Console\Output\OutputInterface;
1415
use Symfony\Component\Console\Style\SymfonyStyle;
1516

17+
#[AsCommand(name: 'league:oauth2-server:clear-expired-tokens', description: 'Clears all expired access and/or refresh tokens and/or auth codes')]
1618
final class ClearExpiredTokensCommand extends Command
1719
{
1820
/**

src/Command/CreateClientCommand.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@
99
use League\Bundle\OAuth2ServerBundle\ValueObject\Grant;
1010
use League\Bundle\OAuth2ServerBundle\ValueObject\RedirectUri;
1111
use League\Bundle\OAuth2ServerBundle\ValueObject\Scope;
12+
use Symfony\Component\Console\Attribute\AsCommand;
1213
use Symfony\Component\Console\Command\Command;
1314
use Symfony\Component\Console\Input\InputArgument;
1415
use Symfony\Component\Console\Input\InputInterface;
1516
use Symfony\Component\Console\Input\InputOption;
1617
use Symfony\Component\Console\Output\OutputInterface;
1718
use Symfony\Component\Console\Style\SymfonyStyle;
1819

20+
#[AsCommand(name: 'league:oauth2-server:create-client', description: 'Creates a new OAuth2 client')]
1921
final class CreateClientCommand extends Command
2022
{
2123
/**

src/Command/DeleteClientCommand.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@
55
namespace League\Bundle\OAuth2ServerBundle\Command;
66

77
use League\Bundle\OAuth2ServerBundle\Manager\ClientManagerInterface;
8+
use Symfony\Component\Console\Attribute\AsCommand;
89
use Symfony\Component\Console\Command\Command;
910
use Symfony\Component\Console\Input\InputArgument;
1011
use Symfony\Component\Console\Input\InputInterface;
1112
use Symfony\Component\Console\Output\OutputInterface;
1213
use Symfony\Component\Console\Style\SymfonyStyle;
1314

15+
#[AsCommand(name: 'league:oauth2-server:delete-client', description: 'Deletes an OAuth2 client')]
1416
final class DeleteClientCommand extends Command
1517
{
1618
/**

src/Command/ListClientsCommand.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,14 @@
1010
use League\Bundle\OAuth2ServerBundle\ValueObject\Grant;
1111
use League\Bundle\OAuth2ServerBundle\ValueObject\RedirectUri;
1212
use League\Bundle\OAuth2ServerBundle\ValueObject\Scope;
13+
use Symfony\Component\Console\Attribute\AsCommand;
1314
use Symfony\Component\Console\Command\Command;
1415
use Symfony\Component\Console\Input\InputInterface;
1516
use Symfony\Component\Console\Input\InputOption;
1617
use Symfony\Component\Console\Output\OutputInterface;
1718
use Symfony\Component\Console\Style\SymfonyStyle;
1819

20+
#[AsCommand(name: 'league:oauth2-server:list-clients', description: 'Lists existing OAuth2 clients')]
1921
final class ListClientsCommand extends Command
2022
{
2123
private const ALLOWED_COLUMNS = ['name', 'identifier', 'secret', 'scope', 'redirect uri', 'grant type'];
@@ -35,7 +37,7 @@ public function __construct(ClientManagerInterface $clientManager)
3537
protected function configure(): void
3638
{
3739
$this
38-
->setDescription('Lists existing oAuth2 clients')
40+
->setDescription('Lists existing OAuth2 clients')
3941
->addOption(
4042
'columns',
4143
null,

src/Command/UpdateClientCommand.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@
88
use League\Bundle\OAuth2ServerBundle\ValueObject\Grant;
99
use League\Bundle\OAuth2ServerBundle\ValueObject\RedirectUri;
1010
use League\Bundle\OAuth2ServerBundle\ValueObject\Scope;
11+
use Symfony\Component\Console\Attribute\AsCommand;
1112
use Symfony\Component\Console\Command\Command;
1213
use Symfony\Component\Console\Input\InputArgument;
1314
use Symfony\Component\Console\Input\InputInterface;
1415
use Symfony\Component\Console\Input\InputOption;
1516
use Symfony\Component\Console\Output\OutputInterface;
1617
use Symfony\Component\Console\Style\SymfonyStyle;
1718

19+
#[AsCommand(name: 'league:oauth2-server:update-client', description: 'Updates an OAuth2 client')]
1820
final class UpdateClientCommand extends Command
1921
{
2022
/**

0 commit comments

Comments
 (0)