-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Console] Add CommandDefinition to make list
lazy
#39860
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
Conversation
@@ -489,9 +489,6 @@ public function add(Command $command) | |||
return null; | |||
} | |||
|
|||
// Will throw if the command is not correctly initialized. | |||
$command->getDefinition(); |
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 break laziness (#39851 should also fix this issue).
I'm not sure why this check is performed here.
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.
Related to #9244 apparently
Apparently, we need to think twice before removing as that might hurt DX.
This looks very promising and less "magical" 👍🏻 |
with >=php8 we can argue attributes are superior either way, and thus we're targetting php7 only It's really fast to meet the convention from #39851 for the time being (eg. pre-php8 era): |
From a DX perspective, this requires ppl to implement a new static method to gain laziness, which is more code to write. #39851 provides a descriptive approach instead, that paves the way to configuring the same thing using attributes on PHP 8. Doing so would be a minor implementation change on top of #39851. What benefit are you expecting from this approach, vs #39851? As of now, the proposed |
Cleaner, extensible (ie. allows enabled), self explanatory (
I totally agree with this comment (and similar from @ro0NL), if we target php8 attributes, that would make sens to move with #39851 and make the migration smoother |
870b131
to
770cf8c
Compare
On my side, it looks like more code boilerplate for something that could be just plain descriptive. |
Closing in favor of #39851 and a path to php8 attributes |
This is an alternative to #39851, that use an
CommandDescription
to expose the command's metadata.This PR is WIP to get your point of view before moving spending too much time on it.
TODO:
isEnabled
,isHidden
, ... meaning