Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

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

Sign up
Appearance settings

[Console] Simplify using invokable commands when the component is used standalone#60394

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
HypeMC wants to merge1 commit intosymfony:7.4
base:7.4
Choose a base branch
Loading
fromHypeMC:simplify-invokable-commands-when-standalone

Conversation

HypeMC
Copy link
Member

QA
Branch?7.3
Bug fix?no
New feature?yes
Deprecations?no
Issues-
LicenseMIT

Inspired by#60389 (comment) .

This PR enables using invokable command when the component is used standalone:

#[AsCommand(name:'app:example')]class ExampleCommandimplements SignalableCommandInterface{publicfunction__invoke(InputInterface$input,OutputInterface$output):int    {// ...return Command::SUCCESS;    }publicfunctiongetSubscribedSignals():array    {return [\SIGINT, \SIGTERM];    }publicfunctionhandleSignal(int$signal,int|false$previousExitCode =0):int|false    {// handle signalreturn0;    }}$application =newApplication();$application->addInvokable(newExampleCommand());$application->run();

@OskarStark
Copy link
Contributor

So we really need the extra method addInvokable() or could we handle this automatically?

@xabbuh
Copy link
Member

We cannot widen the argument type inadd() as that would be a BC break for child classes overriding the method.

HypeMC, OskarStark, and chalasr reacted with thumbs up emoji

@HypeMCHypeMCforce-pushed thesimplify-invokable-commands-when-standalone branch frome07ce18 to5cf2a0dCompareMay 10, 2025 08:33
@OskarStark
Copy link
Contributor

We could remove it and handle it internally, couldn't we?

Do we need to adjust addCommands() method as well?

@chalasr
Copy link
Member

Cool, thanks for working on this.

We could remove it and handle it internally, couldn't we?

@OskarStark If you mean removing the type declaration then it's a BC break too unfortunately, seehttps://3v4l.org/5dhmc.

I'd prefer the invokable concept not to leak into public API though. What about addingApplication::addCommand(callable|Command $command): Command instead? It would be great if that new method could provide a way to make the command lazy also.

HypeMC and mtarld reacted with thumbs up emoji

@HypeMCHypeMCforce-pushed thesimplify-invokable-commands-when-standalone branch from5cf2a0d to758b85eCompareMay 13, 2025 22:48
@HypeMCHypeMCforce-pushed thesimplify-invokable-commands-when-standalone branch from758b85e to2a19b9bCompareMay 13, 2025 23:18
@HypeMC
Copy link
MemberAuthor

I'd prefer the invokable concept not to leak into public API though. What about addingApplication::addCommand(callable|Command $command): Command instead? It would be great if that new method could provide a way to make the command lazy also.

@chalasr I've made the changes you requested, please let me know what you think.

@fabpotfabpot modified the milestones:7.3,7.4May 26, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas left review comments

@chalasrchalasrAwaiting requested review from chalasrchalasr is a code owner

Assignees
No one assigned
Projects
None yet
Milestone
7.4
Development

Successfully merging this pull request may close these issues.

7 participants
@HypeMC@OskarStark@xabbuh@chalasr@nicolas-grekas@fabpot@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp