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] Split specifyParameter() to external trait #31254

Merged
merged 2 commits into from Jan 30, 2020

Conversation

@crynobone
Copy link
Contributor

crynobone commented Jan 28, 2020

While building orchestra/canvas, I found out that while it would be nice
to use Illuminate\Console\Command the requirements to have Laravel (or
at least the Container) configure make it slightly harder to build PHP
CLI code based on symfony console with a little Laravel flavour.

    /**
     * Configure the command options.
     *
     * @return void
     */
    protected function configure()
    {
        $this->ignoreValidationErrors();

        $this->setName($this->name)
                ->setDescription($this->description)
                ->addArgument('name', InputArgument::REQUIRED, "The name of the {$this->fileType}");

        $this->specifyParameters();
    }

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

crynobone added 2 commits Jan 27, 2020
While building orchestra/canvas, I found out that while it would be nice
to use Illuminate\Console\Command the requirements to have Laravel (or
at least the Container) configure make it slightly harder to build PHP
CLI code based on symfony console with a little Laravel flavour.

Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
@GrahamCampbell GrahamCampbell changed the title [6.x] Split specifyParameter() to external trait. [6.x] Split specifyParameter() to external trait Jan 28, 2020
if ($arguments instanceof InputArgument) {
$this->getDefinition()->addArgument($arguments);
} else {
call_user_func_array([$this, 'addArgument'], $arguments);

This comment has been minimized.

Copy link
@GrahamCampbell

GrahamCampbell Jan 28, 2020

Member

The trait needs to have getDefinition, addArgument and addOption as abstract methods.

This comment has been minimized.

Copy link
@crynobone

crynobone Jan 28, 2020

Author Contributor

addArgument and addOption both will have scalar type-hint in 5.0. Does Laravel want to have this?

This comment has been minimized.

Copy link
@GrahamCampbell

GrahamCampbell Jan 28, 2020

Member

Laravel 6 requires Symfony console 4, so no typehints needed. For Laravel 7, yes, we'll need to match the symfony method signature, since that needs Symfony console 5.

This comment has been minimized.

Copy link
@GrahamCampbell

GrahamCampbell Jan 28, 2020

Member

The same as some of Laravel's internals has typehints to match phpunit's stuff.

@taylorotwell taylorotwell merged commit 0d81e50 into laravel:6.x Jan 30, 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
@crynobone crynobone deleted the crynobone:console-has-parameters branch Feb 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.