Skip to content

[Console] Fix profile invokable command#62571

Merged
fabpot merged 1 commit intosymfony:7.4from
Jibbarth:fix/profile-invokable-command
Nov 29, 2025
Merged

[Console] Fix profile invokable command#62571
fabpot merged 1 commit intosymfony:7.4from
Jibbarth:fix/profile-invokable-command

Conversation

@Jibbarth
Copy link
Copy Markdown
Contributor

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

Hello,

I noticed that, when I try to profile an invokable command on 7.4, it raise the following exception :

[critical] Uncaught Error: ReflectionFunction::__construct(): Argument #1 ($function) must be of type Closure|string, App\Command\MyAwesomeCommand given
TypeError {#199
  #message: "ReflectionFunction::__construct(): Argument #1 ($function) must be of type Closure|string, App\Command\MyAwesomeCommand given"
  #code: 0
  #file: "./vendor/symfony/console/Command/TraceableCommand.php"
  #line: 172
  trace: {
    ./vendor/symfony/console/Command/TraceableCommand.php:172 { …}
    ./vendor/symfony/console/Command/TraceableCommand.php:71 { …}
    ./vendor/symfony/framework-bundle/Console/Application.php:115 { …}
    ./vendor/symfony/console/Application.php:356 { …}
    ./vendor/symfony/framework-bundle/Console/Application.php:77 { …}
    ./vendor/symfony/console/Application.php:195 { …}
    ./vendor/symfony/runtime/Runner/Symfony/ConsoleApplicationRunner.php:49 { …}
    ./vendor/autoload_runtime.php:32 { …}
    ./bin/console:15 {

The invokableCommand class changed, the code attribute doesn't longer contains the closure to code.
Let's use the $invokableCommand->invokable instead that contains the reflectionFunction needed.

@Jibbarth Jibbarth force-pushed the fix/profile-invokable-command branch from c873849 to 4643bf1 Compare November 29, 2025 12:04
Comment thread src/Symfony/Component/Console/Command/TraceableCommand.php
Comment thread src/Symfony/Component/Console/Command/TraceableCommand.php
@fabpot
Copy link
Copy Markdown
Member

fabpot commented Nov 29, 2025

Thank you @Jibbarth.

@fabpot fabpot merged commit cbe797f into symfony:7.4 Nov 29, 2025
3 of 12 checks passed
@Jibbarth Jibbarth deleted the fix/profile-invokable-command branch November 29, 2025 17:57
This was referenced Dec 7, 2025
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.

4 participants