-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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] = [ |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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,
....
) {}
}
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
The beginning of something interesting