-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[FrameworkBundle] add class description to debug:container command #28117
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
[FrameworkBundle] add class description to debug:container command #28117
Conversation
713ec47
to
8f848e4
Compare
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.
Could be a good idea :)
Somehow related to #26142, ping @weaverryan
@@ -11,6 +11,9 @@ | |||
|
|||
namespace Symfony\Bundle\FrameworkBundle\Console\Descriptor; | |||
|
|||
use phpDocumentor\Reflection\DocBlockFactory; | |||
use ReflectionClass; | |||
use ReflectionException; |
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.
we don't "use" root classes: they should prefixed with \
instead.
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.
done
src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php
Outdated
Show resolved
Hide resolved
src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php
Outdated
Show resolved
Hide resolved
0ab9f2c
to
ff14d22
Compare
ff14d22
to
3c334af
Compare
src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php
Outdated
Show resolved
Hide resolved
$classDescription = DocBlockFactory::createInstance()->create($reflectionProperty->getDocComment())->getSummary(); | ||
|
||
if (!empty($classDescription)) { | ||
$output = '- Description: `'.$classDescription.'`'."\n"; |
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 would put the description after the class entry, given it acts as a title sort of;
- Class: ShortValue
- Description: Much longer value ....
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.
Did not agree. I think the description is higher than class. The values are not sorted by alpha. I think they are sorted by prio.
...
$output .= '- Class: `'.$definition->getClass().'`'
."\n".'- Public: '.($definition->isPublic() && !$definition->isPrivate() ? 'yes' : 'no')
."\n".'- Synthetic: '.($definition->isSynthetic() ? 'yes' : 'no')
."\n".'- Lazy: '.($definition->isLazy() ? 'yes' : 'no')
."\n".'- Shared: '.($definition->isShared() ? 'yes' : 'no')
."\n".'- Abstract: '.($definition->isAbstract() ? 'yes' : 'no')
."\n".'- Autowired: '.($definition->isAutowired() ? 'yes' : 'no')
."\n".'- Autoconfigured: '.($definition->isAutoconfigured() ? 'yes' : 'no')
...
6c4966d
to
7003c2e
Compare
@nicolas-grekas @ro0NL can you please re-review the PR. |
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.
minor comment :)
*/ | ||
protected function getClassDescription($class) | ||
{ | ||
if (!interface_exists('phpDocumentor\Reflection\DocBlockFactoryInterface')) { |
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 can be DocBlockFactoryInterface::class
with a use
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.
totally agree. done
This is a really interesting idea - using the phpdoc as the service description. What if a class extends some base class? Like, the actual class is a Debug wrapper, and the real description is on the parent? |
7003c2e
to
ad50827
Compare
ad50827
to
5fc6155
Compare
Thank you @gimler. |
…iner command (gimler) This PR was merged into the 4.2-dev branch. Discussion ---------- [FrameworkBundle] add class description to debug:container command | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | License | MIT | Doc PR | symfony/symfony-docs#... <!-- required for new features --> Our developer finds it useful when the `console debug:container <service>` command print out the class description.  * [x] json * [x] txt * [x] xml * [x] md Commits ------- 5fc6155 [FrameworkBundle] add class description to debug:container command
Our developer finds it useful when the
console debug:container <service>
command print out the class description.