Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Console] Add support for Invokable Commands in CommandTester #60823

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: 7.4
Choose a base branch
from

Conversation

ruudk
Copy link
Contributor

@ruudk ruudk commented Jun 18, 2025

Q A
Branch? 7.4
Bug fix? no
New feature? yes
Deprecations? no
Issues
License MIT

I'm trying out the amazing new Invokable Commands introduced in Symfony 7.3 but I noticed that I could use it together with the CommandTester. It was also not possible to manually add these type of commands to the Application.

I'm not sure what the best approach is with this. As I'm changing the signature of the methods this might be considered a breaking change. Or it might not, as I'm widening the type from Command to object.

Please advise what the best approach would be to introduce something like this. Thanks 🙏

/cc @yceruto @chalasr

@ruudk ruudk requested a review from chalasr as a code owner June 18, 2025 12:45
@carsonbot carsonbot added this to the 7.3 milestone Jun 18, 2025
@ruudk ruudk changed the title [Console] Invokable commands [Console] Add support for Invokable Commands in CommandTester and Application Jun 18, 2025
@ruudk ruudk changed the title [Console] Add support for Invokable Commands in CommandTester and Application [Console] Add support for Invokable Commands in CommandTester and Application Jun 18, 2025
@ruudk
Copy link
Contributor Author

ruudk commented Jun 18, 2025

Sure I could wrap them manually in new Command()->setCode($theCommand) but that feels nasty from a user perspective.

@GromNaN GromNaN changed the base branch from 7.3 to 7.4 June 18, 2025 13:32
@GromNaN
Copy link
Member

GromNaN commented Jun 18, 2025

I updated the target branch to 7.4, this is a new feature that cannot be merged into 7.3

@ruudk ruudk force-pushed the invokable-commands branch 2 times, most recently from 2e104a7 to beea196 Compare June 18, 2025 13:42
@ruudk
Copy link
Contributor Author

ruudk commented Jun 18, 2025

Thanks, it seems that the Application was already fixed in 7.4 #60394

@ruudk ruudk changed the title [Console] Add support for Invokable Commands in CommandTester and Application [Console] Add support for Invokable Commands in CommandTester Jun 18, 2025
Copy link
Member

@GromNaN GromNaN left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's good, there are a few things to fix to clean up the PR.
Thanks for the new test.

@ruudk
Copy link
Contributor Author

ruudk commented Jun 18, 2025

@GromNaN Done, also updated the changelog!

@ruudk ruudk force-pushed the invokable-commands branch from 47ff4cc to e1d9dce Compare June 19, 2025 08:15
@GromNaN GromNaN self-requested a review June 19, 2025 08:54
Copy link
Member

@GromNaN GromNaN left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update! I found the source of the bug and added a new suggestion for the constructor.

Copy link
Member

@GromNaN GromNaN left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test needs to be modified, and then we're all good!

@ruudk
Copy link
Contributor Author

ruudk commented Jun 19, 2025

@GromNaN Done, I also added another commit with extra tests.

@ruudk
Copy link
Contributor Author

ruudk commented Jun 19, 2025

@GromNaN @yceruto Thanks for the thorough reviews and guidance on this 👏

Copy link
Member

@yceruto yceruto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ruudk for the improvement!

@ruudk ruudk force-pushed the invokable-commands branch from 40a5a5f to a10ae7f Compare June 20, 2025 07:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants