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

feat: useContainerCommandLoader parameter #2060

Merged

Conversation

wslawski-printify
Copy link
Contributor

@wslawski-printify wslawski-printify commented Oct 8, 2024

  • Added or updated tests
  • Documented user facing changes

Changes

  • Adds option to use ContainerCommandLoader when resolving command options/arguments etc, so when using #[AsCommand] attribute on commands it will work as expected and resolve options/arguments properly

Breaking changes

No breaking changes, added new parameter with false value

@wslawski-printify wslawski-printify changed the title Add useContainerCommandLoader parameter feat: useContainerCommandLoader parameter Oct 8, 2024
@wslawski-printify
Copy link
Contributor Author

Changed definition to one line to fix phpcs @szepeviktor all other failing checks seems not that change related to me.

Comment on lines 38 to 40
if ($this->useContainerCommandLoader) {
$consoleApplication->setContainerCommandLoader();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we really need another config option? I think this can just be appended on the getApplication() method below:

        if ($this->application === null) {
            $this->application = (new Application(app(Container::class), app(Dispatcher::class), app()->version()))
                ->setContainerCommandLoader();
        }

This is essentially what the framework does, and I see no reason why anyone would want to disable this:

https://github.com/laravel/framework/blob/bc5bd660b0a3079e3fb7f392bfac06e41d80b64b/src/Illuminate/Foundation/Console/Kernel.php#L531-L541

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well probably it makes sense, wanted to keep it without it to make sure we don't break anything but I will change it.

extension.neon Outdated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure to clean up these changes as well (same as the laravel-test.sh file)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done :)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh sorry, othter github account :D

@wslawski-printify
Copy link
Contributor Author

Hey @szepeviktor @calebdw when it can be merged?

@szepeviktor
Copy link
Collaborator

Not by me!

@szepeviktor szepeviktor merged commit 7befdbd into larastan:2.x Oct 11, 2024
32 of 35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants