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

Some refactors and command collector #4

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

JustSteveKing
Copy link
Collaborator

The beginning of something interesting

Copy link
Member

@WendellAdriel WendellAdriel left a comment

Choose a reason for hiding this comment

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

@JustSteveKing just made two small suggestions.

I have a PR to create but I'll wait for you to merge your work first because it's related to the input and it depends on how you're going to build this initial stuff

string $description,
string $instance,
): void {
$this->commands[$signature] = [
Copy link
Member

Choose a reason for hiding this comment

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

I think it's better to create a class to wrap these properties, so $commands can be an array of CommandWrapper or something like that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah this is something I wasn't sure on - I like the idea though! Something like:

final class StoredCommand
{
    public function __construct(
        private readonly string $signature,
        ....
    ) {}
}

Copy link
Member

Choose a reason for hiding this comment

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

I like it, if you think that could be a nice thing, go for it!!!

src/Minicli.php Outdated
}
protected readonly Config $config;

public readonly CommandCollector $commands;
Copy link
Member

Choose a reason for hiding this comment

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

This could be protected or private IMO

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah I agree. Typically I make things public while fleshing out the ideas, then test going through updating to private where possible

# Conflicts:
#	src/Commands/AbstractCommand.php
#	src/Commands/DefaultCommand.php
#	src/Minicli.php
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.

None yet

2 participants