Skip to content

Commit d93d580

Browse files
committed
fix: command name deprecation
1 parent b21959d commit d93d580

File tree

3 files changed

+6
-15
lines changed

3 files changed

+6
-15
lines changed

src/JsonSchema/Command/JsonSchemaGenerateCommand.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use ApiPlatform\JsonSchema\Schema;
1717
use ApiPlatform\JsonSchema\SchemaFactoryInterface;
1818
use ApiPlatform\Metadata\HttpOperation;
19+
use Symfony\Component\Console\Attribute\AsCommand;
1920
use Symfony\Component\Console\Command\Command;
2021
use Symfony\Component\Console\Exception\InvalidOptionException;
2122
use Symfony\Component\Console\Input\InputArgument;
@@ -29,6 +30,7 @@
2930
*
3031
* @author Jacques Lefebvre <[email protected]>
3132
*/
33+
#[AsCommand(name: 'api:json-schema:generate')]
3234
final class JsonSchemaGenerateCommand extends Command
3335
{
3436
private array $formats;
@@ -90,9 +92,4 @@ protected function execute(InputInterface $input, OutputInterface $output): int
9092

9193
return 0;
9294
}
93-
94-
public static function getDefaultName(): string
95-
{
96-
return 'api:json-schema:generate';
97-
}
9895
}

src/OpenApi/Command/OpenApiCommand.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
namespace ApiPlatform\OpenApi\Command;
1515

1616
use ApiPlatform\OpenApi\Factory\OpenApiFactoryInterface;
17+
use Symfony\Component\Console\Attribute\AsCommand;
1718
use Symfony\Component\Console\Command\Command;
1819
use Symfony\Component\Console\Input\InputInterface;
1920
use Symfony\Component\Console\Input\InputOption;
@@ -26,6 +27,7 @@
2627
/**
2728
* Dumps Open API documentation.
2829
*/
30+
#[AsCommand(name: 'api:openapi:export')]
2931
final class OpenApiCommand extends Command
3032
{
3133
public function __construct(private readonly OpenApiFactoryInterface $openApiFactory, private readonly NormalizerInterface $normalizer)
@@ -82,9 +84,4 @@ protected function execute(InputInterface $input, OutputInterface $output): int
8284

8385
return \defined(Command::class.'::SUCCESS') ? Command::SUCCESS : 0;
8486
}
85-
86-
public static function getDefaultName(): string
87-
{
88-
return 'api:openapi:export';
89-
}
9087
}

src/Symfony/Bundle/Command/DebugResourceCommand.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
namespace ApiPlatform\Symfony\Bundle\Command;
1515

1616
use ApiPlatform\Metadata\Resource\Factory\ResourceMetadataCollectionFactoryInterface;
17+
use Symfony\Component\Console\Attribute\AsCommand;
1718
use Symfony\Component\Console\Command\Command;
1819
use Symfony\Component\Console\Helper\QuestionHelper;
1920
use Symfony\Component\Console\Input\InputArgument;
@@ -22,6 +23,7 @@
2223
use Symfony\Component\Console\Question\ChoiceQuestion;
2324
use Symfony\Component\VarDumper\Cloner\ClonerInterface;
2425

26+
#[AsCommand(name: 'debug:api-resource')]
2527
final class DebugResourceCommand extends Command
2628
{
2729
public function __construct(private readonly ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory, private readonly ClonerInterface $cloner, private $dumper)
@@ -111,9 +113,4 @@ protected function execute(InputInterface $input, OutputInterface $output): int
111113

112114
return \defined(Command::class.'::SUCCESS') ? Command::SUCCESS : 0;
113115
}
114-
115-
public static function getDefaultName(): string
116-
{
117-
return 'debug:api-resource';
118-
}
119116
}

0 commit comments

Comments
 (0)