Closed
Description
Description
#[AsCommand('app:load', 'Demo camelCase option')]
class LoadCommand
{
public function __invoke(
SymfonyStyle $io,
#[Option(description: 'Fetch the data from a remote URL instead of the local file')]
?string $remoteUrl = null,
): int
{
if ($remoteUrl) {
$io->writeln("Option remoteUrl: $remoteUrl");
}
return Command::SUCCESS;
}
}
bin/console app:load --help
Description:
Demo camelCase option
Usage:
app:load [options]
Options:
--remoteUrl[=REMOTEURL] Fetch the data from a remote URL instead of the local file
It seems to me that the option should be --remote-url (kabob-case), but that the PHP variable name should be camel-case. This is consistent with how the serializer and doctrine entities work, where the PHP name is mapped via a NamingStrategy.
That is, I would like to see
Demo camelCase option
Usage:
app:load [options]
Options:
--remote-url[=REMOTE-URL] Fetch the data from a remote URL instead of the local file
Without having to explictly set the name:
#[Option(name: 'remote-url', description: 'Fetch the data from a remote URL instead of the local file')]
zenstuck/console-extra had the same issue, but changed the behavior for 2.0 (thus a BC). Any chance this could be added before 7.3 is released?
Example
No response