-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Console] application/command as text/xml/whatever decoupling #7454
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
/** | ||
* Returns given object's representation. | ||
* | ||
* @param mixed $object |
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.
it should be @param object
if $object
can only be an object. And if it can be something else (a scalar or an array), the argument should be renamed)
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.
changed, thanks
This PR is massive. It should be broken down into smaller commits that can be reviewed more easily. If possible perhaps even into separate smaller PRs that can be applied atomically without breaking stuff. |
@igorw I just unsquashed my commits for you. |
{ | ||
$this | ||
->configure($options) | ||
->add(new Text\ApplicationTextDescriptor()) |
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.
Wouldn't it be a lot simpler if the application text descriptor itself were responsible for rendering its elements? I think it would simplify the design and lead to less implicit dependency on the order of the descriptors.
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'm not sure to understand, this class just acts as a "descriptor selector".
I'm not sure if introducing the |
@igorw do you think the markdown formatter is overkill? |
Possibly. I guess re-implementing pandoc inside of symfony seems like a bit much. |
* | ||
* @return string A string representing the InputDefinition | ||
*/ | ||
public function asText() |
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.
Removing the public method is a BC break. you should provide a BC layer
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 guess asXml()
methods should be present too and must be tagged as @deprecated
.
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.
right
@igorw I think your right, I'll simplify the markdown descriptor. |
|
||
// reads native definition | ||
$method = new \ReflectionMethod($this->command, 'getNativeDefinition'); | ||
$method->setAccessible(true); |
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.
Relying on reflection to get the definition looks like a hack
I don't like the hard coupling of descriptors, where each descriptor creates new instances of other descriptors. I leads to several issues:
You should retrieve the needed descriptor from the selector IMO |
@fabpot absolutely. Should I do the same with |
Let's do that in the same PR (and indeed the router debug command should also be updated). |
Can you also removed the |
{ | ||
/** | ||
* @param InputArgument $argument | ||
* |
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.
Can you remove the blank lines between @param lines?
…fsimon) This PR was squashed before being merged into the master branch (closes #7887). Discussion ---------- [FrameworkBundle] adds routing/container descriptors The goal of this PR is to add descriptors (as in #7454) for routing and container. This will permit add a `--format` option to `router:debug` and `container:debug` commands (with `txt`, `json`, `xml` and `md` formats). Commits ------- 22f9bc8 [FrameworkBundle] adds routing/container descriptors
This PR removes description generation from
Command
,Application
andInputDefinition
classes and delegate it to specialized descriptor classes, making it dead simple to add new output formats.Maybe this could include other commands, like
router:debug
orcontainer:debug
(see #5740)?DescriptorProvider
which usesDescriptorInterface
objects to describe things.txt
descriptors.xml
descriptors.json
descriptors.md
descriptors.