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

[6.x] Extract CallOtherCommands feature from Illuminate\Console\Command #31026

Merged
merged 1 commit into from Jan 6, 2020

Conversation

@crynobone
Copy link
Contributor

crynobone commented Jan 4, 2020

At the moment Illuminate\Console\Command is tightly couple with Laravel
via $this->laravel->make() usage, this changes make it possible to reuse
CallOtherCommands feature available for Laravel commands to standalone
Symfony commands.

<?php
namespace Foo\Commands;

use Illuminate\Console\Concerns\CallOtherCommands;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

abstract class Command extends \Symfony\Component\Console\Command\Command
{
    use CallOtherCommands;

    /**
     * Resolve the console command instance for the given command.
     *
     * @param  string  $command
     * @return \Symfony\Component\Console\Command\Command
     */
    protected function resolveCommand($command)
    {
        return $this->getApplication()->find($command);
    }
}

Signed-off-by: Mior Muhammad Zaki crynobone@gmail.com

At the moment Illuminate\Console\Command is tightly couple with Laravel
via $this->laravel->make() usage, this changes make it possible to reuse
CallOtherCommands feature available for Laravel Command to standalone
Symfony command.

Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
@taylorotwell taylorotwell merged commit 6a79556 into laravel:6.x Jan 6, 2020
2 checks passed
2 checks passed
continuous-integration/styleci/pr The analysis has passed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.