Skip to content

Commit b92007a

Browse files
soyukaKDederichs
andauthored
fix: Remove $defaultCommand deprecation (#4795) (#4801)
* Overwrite getDefaultName to remove deprecation and preserve BC * Remove comment Co-authored-by: Kai Dederichs <[email protected]>
1 parent a0a3853 commit b92007a

File tree

4 files changed

+20
-8
lines changed

4 files changed

+20
-8
lines changed

src/Core/Bridge/Symfony/Bundle/Command/SwaggerCommand.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@
3333
*/
3434
final class SwaggerCommand extends Command
3535
{
36-
protected static $defaultName = 'api:swagger:export';
37-
3836
private $normalizer;
3937
private $resourceNameCollectionFactory;
4038
private $apiTitle;
@@ -115,4 +113,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
115113

116114
return 0;
117115
}
116+
117+
public static function getDefaultName(): string
118+
{
119+
return 'api:swagger:export';
120+
}
118121
}

src/JsonSchema/Command/JsonSchemaGenerateCommand.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@
3333
*/
3434
final class JsonSchemaGenerateCommand extends Command
3535
{
36-
protected static $defaultName = 'api:json-schema:generate';
37-
3836
/**
3937
* @var SchemaFactoryInterface|LegacySchemaFactoryInterface
4038
*/
@@ -123,6 +121,11 @@ protected function execute(InputInterface $input, OutputInterface $output): int
123121

124122
return 0;
125123
}
124+
125+
public static function getDefaultName(): string
126+
{
127+
return 'api:json-schema:generate';
128+
}
126129
}
127130

128131
class_alias(JsonSchemaGenerateCommand::class, \ApiPlatform\Core\JsonSchema\Command\JsonSchemaGenerateCommand::class);

src/Symfony/Bundle/Command/GraphQlExportCommand.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929
*/
3030
class GraphQlExportCommand extends Command
3131
{
32-
protected static $defaultName = 'api:graphql:export';
33-
3432
/** @var SchemaBuilderLegacyInterface|SchemaBuilderInterface */
3533
private $schemaBuilder;
3634

@@ -79,6 +77,11 @@ protected function execute(InputInterface $input, OutputInterface $output)
7977

8078
return 0;
8179
}
80+
81+
public static function getDefaultName(): string
82+
{
83+
return 'api:graphql:export';
84+
}
8285
}
8386

8487
class_alias(GraphQlExportCommand::class, \ApiPlatform\Core\Bridge\Symfony\Bundle\Command\GraphQlExportCommand::class);

src/Symfony/Bundle/Command/OpenApiCommand.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030
*/
3131
final class OpenApiCommand extends Command
3232
{
33-
protected static $defaultName = 'api:openapi:export';
34-
3533
private $openApiFactory;
3634
private $normalizer;
3735

@@ -95,6 +93,11 @@ protected function execute(InputInterface $input, OutputInterface $output): int
9593

9694
return 0;
9795
}
96+
97+
public static function getDefaultName(): string
98+
{
99+
return 'api:openapi:export';
100+
}
98101
}
99102

100103
class_alias(OpenApiCommand::class, \ApiPlatform\Core\Bridge\Symfony\Bundle\Command\OpenApiCommand::class);

0 commit comments

Comments
 (0)