8000 [Console] `InputInterface` extends `Stringable` · Issue #42042 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content 8000
[Console] InputInterface extends Stringable #42042
Closed
@boesing

Description

@boesing

Description
Hey there,

I want to create a file containing informations via symfony/console.
I'd like to pass the executed command to that file so it can be easily re-created later on (e.g. due to changes which have to be applied).

I've seen that ArgvInput as well as ArrayInput both already implement __toString method and thus, extending the InputInterface with the Stringable interface might be a solution.

Example

interface InputOption extends Stringable
{}
final class MyCommand extends Command
{
    public function execute(InputInterface $input, OutputInterface $output): int
    {
        $output->writeln(sprintf('You executed the following command: %s', (string) $input));
        return self::SUCCESS;
    }
}

Any feedback is appreciated.

5151

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0