Skip to content
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

[Console] [Command] Fix Closure code binding when it is a static anonymous function #39932

Merged

Conversation

fancyweb
Copy link
Contributor

Q A
Branch? 4.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets -
License MIT
Doc PR -

I'm building a single command application and I did:

->setCode(static function (InputInterface $input, OutputInterface $output): void {
    // my code
})

and it results in a warning Cannot bind an instance to a static closure + an exception You must override the execute() method in the concrete command class. I guess we should silently fail here if the Closure is not bindable.

@carsonbot carsonbot added this to the 4.4 milestone Jan 22, 2021
@carsonbot carsonbot changed the title [Console][Command] Fix Closure code binding when it is a static anonymous function [Console] [Command] Fix Closure code binding when it is a static anonymous function Jan 22, 2021
@chalasr
Copy link
Member

chalasr commented Jan 22, 2021

Thank you Thomas.

@chalasr chalasr merged commit c6f5e2a into symfony:4.4 Jan 22, 2021
@fancyweb fancyweb deleted the console/set-command-code-static-closure branch January 22, 2021 12:44
This was referenced Jan 27, 2021
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.

5 participants