Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[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

Merged

Conversation

gimler
Copy link
Contributor

@gimler gimler commented Aug 2, 2018

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#...

Our developer finds it useful when the console debug:container <service> command print out the class description.

bildschirmfoto vom 2018-08-02 14-22-17

  • json
  • txt
  • xml
  • md

@gimler gimler force-pushed the debug_container_add_class_description branch 2 times, most recently from 713ec47 to 8f848e4 Compare August 2, 2018 12:41
Copy link
Member

@nicolas-grekas nicolas-grekas left a 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;
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@nicolas-grekas nicolas-grekas added this to the next milestone Aug 3, 2018
@gimler gimler force-pushed the debug_container_add_class_description branch 4 times, most recently from 0ab9f2c to ff14d22 Compare August 6, 2018 07:40
@gimler gimler changed the title [WIP][FrameworkBundle] add class description to debug:container command [FrameworkBundle] add class description to debug:container command Aug 6, 2018
@gimler gimler force-pushed the debug_container_add_class_description branch from ff14d22 to 3c334af Compare August 6, 2018 08:00
$classDescription = DocBlockFactory::createInstance()->create($reflectionProperty->getDocComment())->getSummary();

if (!empty($classDescription)) {
$output = '- Description: `'.$classDescription.'`'."\n";
Copy link
Contributor

@ro0NL ro0NL Aug 8, 2018

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 ....

Copy link
Contributor Author

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')
...

@gimler gimler force-pushed the debug_container_add_class_description branch 3 times, most recently from 6c4966d to 7003c2e Compare August 23, 2018 13:14
@gimler
Copy link
Contributor Author

gimler commented Aug 23, 2018

@nicolas-grekas @ro0NL can you please re-review the PR.

Copy link
Contributor

@ro0NL ro0NL left a 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')) {
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

totally agree. done

@weaverryan
Copy link
Member

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?

@gimler gimler force-pushed the debug_container_add_class_description branch from 7003c2e to ad50827 Compare August 27, 2018 19:16
@gimler gimler force-pushed the debug_container_add_class_description branch from ad50827 to 5fc6155 Compare August 27, 2018 19:17
@fabpot
Copy link
Member

fabpot commented Sep 4, 2018

Thank you @gimler.

@fabpot fabpot merged commit 5fc6155 into symfony:master Sep 4, 2018
fabpot added a commit that referenced this pull request Sep 4, 2018
…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.

![bildschirmfoto vom 2018-08-02 14-22-17](https://user-images.githubusercontent.com/200904/43583449-d4bf74e4-965f-11e8-8e88-0db8017c5a90.png)

* [x] json
* [x] txt
* [x] xml
* [x] md

Commits
-------

5fc6155 [FrameworkBundle] add class description to debug:container command
@gimler gimler deleted the debug_container_add_class_description branch September 4, 2018 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants