Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[console] 7.3: default to kabob-case for options #60358

Copy link
Copy link
Closed
@tacman

Description

@tacman
Issue body actions

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.