Skip to content

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.

@fancyweb fancyweb requested a review from chalasr as a code owner January 22, 2021 08:28
@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