From 5b7ecd2d8e3b26d8c5b85fd02ca825da4077c5ad Mon Sep 17 00:00:00 2001 From: soyuka Date: Mon, 16 Feb 2026 11:00:32 +0100 Subject: [PATCH 1/2] fix(symfony): use AsCommand description parameter for console commands MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit | Q | A | ------------- | --- | Branch? | 4.2 | Tickets | Closes #7616 | License | MIT | Doc PR | ∅ Move command descriptions from configure() to AsCommand attribute to follow Symfony 6+ best practices and eliminate deprecation warnings in Symfony 8. Co-Authored-By: Claude Sonnet 4.5 --- src/Symfony/Bundle/Command/DebugResourceCommand.php | 6 ++++-- src/Symfony/Bundle/Command/GraphQlExportCommand.php | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Bundle/Command/DebugResourceCommand.php b/src/Symfony/Bundle/Command/DebugResourceCommand.php index f4a8ed8ffc4..7479de13829 100644 --- a/src/Symfony/Bundle/Command/DebugResourceCommand.php +++ b/src/Symfony/Bundle/Command/DebugResourceCommand.php @@ -24,7 +24,10 @@ use Symfony\Component\VarDumper\Cloner\ClonerInterface; use Symfony\Component\VarDumper\Dumper\DataDumperInterface; -#[AsCommand(name: 'debug:api-resource')] +#[AsCommand( + name: 'debug:api-resource', + description: 'Debug API Platform resources' +)] final class DebugResourceCommand extends Command { /** @@ -41,7 +44,6 @@ public function __construct(private readonly ResourceMetadataCollectionFactoryIn protected function configure(): void { $this - ->setDescription('Debug API Platform resources') ->addArgument('class', InputArgument::REQUIRED, 'The class you want to debug'); } diff --git a/src/Symfony/Bundle/Command/GraphQlExportCommand.php b/src/Symfony/Bundle/Command/GraphQlExportCommand.php index 334917dc1f0..a2383ff757a 100644 --- a/src/Symfony/Bundle/Command/GraphQlExportCommand.php +++ b/src/Symfony/Bundle/Command/GraphQlExportCommand.php @@ -27,7 +27,10 @@ * * @author Alan Poulain */ -#[AsCommand(name: 'api:graphql:export')] +#[AsCommand( + name: 'api:graphql:export', + description: 'Export the GraphQL schema in Schema Definition Language (SDL)' +)] class GraphQlExportCommand extends Command { public function __construct(private readonly SchemaBuilderInterface $schemaBuilder) @@ -41,7 +44,6 @@ public function __construct(private readonly SchemaBuilderInterface $schemaBuild protected function configure(): void { $this - ->setDescription('Export the GraphQL schema in Schema Definition Language (SDL)') ->addOption('comment-descriptions', null, InputOption::VALUE_NONE, 'Use preceding comments as the description (deprecated: graphql-php < 15)') ->addOption('sort-types', null, InputOption::VALUE_NONE, 'Order types alphabetically') ->addOption('output', 'o', InputOption::VALUE_REQUIRED, 'Write output to file'); From 4fc080557d1851d3ba320d0c4a2134f881d23904 Mon Sep 17 00:00:00 2001 From: soyuka Date: Wed, 18 Feb 2026 15:33:21 +0100 Subject: [PATCH 2/2] fix(tests): remove incorrect shortName from Recipe resource The shortName 'ItemRecipe' was causing @type to be incorrect in JSON-LD output. Removing it allows the class name 'Recipe' to be used correctly. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../ApiResource/ItemUriTemplateWithCollection/Recipe.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/Fixtures/TestBundle/ApiResource/ItemUriTemplateWithCollection/Recipe.php b/tests/Fixtures/TestBundle/ApiResource/ItemUriTemplateWithCollection/Recipe.php index 2830e6ef8ea..2fd29811908 100644 --- a/tests/Fixtures/TestBundle/ApiResource/ItemUriTemplateWithCollection/Recipe.php +++ b/tests/Fixtures/TestBundle/ApiResource/ItemUriTemplateWithCollection/Recipe.php @@ -20,14 +20,12 @@ #[Get( uriTemplate: '/item_uri_template_recipes/{id}{._format}', - shortName: 'ItemRecipe', uriVariables: ['id'], provider: [self::class, 'provide'], openapi: false )] #[Get( uriTemplate: '/item_uri_template_recipes_state_option/{id}{._format}', - shortName: 'ItemRecipe', uriVariables: ['id'], openapi: false, stateOptions: new Options(entityClass: EntityRecipe::class)