Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[FrameworkBundle] decouple debug:autowiring from phpdocumentor/reflection-docblock#29569
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
[FrameworkBundle] decouple debug:autowiring from phpdocumentor/reflection-docblock#29569
Uh oh!
There was an error while loading.Please reload this page.
Conversation
nicolas-grekas commentedDec 11, 2018 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Thanks for submitting! During the SymfonyCon hackday last Saturday, someone worked exactly on this - except that they opened no PR so the code might be lost :) Here are my suggestions:
|
SerkanYildiz commentedDec 11, 2018
It was me during the SymfonyCon who started with this patch. Will apply your comments and update this PR. Thanks for your review! |
| $summary =str_replace( | ||
| array('/','*',"\t","\r\n","\n","\r",''), | ||
| '', | ||
| substr($docComment,0,strpos($docComment,'@')) |
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 seems very fragile (perhaps* @ works better). But tend to prefer an explicit regex to capture the short description as a sentence.
This captures both short+long description and removes newlines in between.
SerkanYildizDec 12, 2018 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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.
@ro0NL Can you help me with a regex to get the description? Would be great!
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.
@SerkanYildiz something likehttps://regex101.com/r/Sqcmmf/1/
It matches the first sentence perhttps://github.com/php-fig/fig-standards/blob/master/proposed/phpdoc.md#51-summary
A Summary MUST end with two sequential line breaks, unless it is the only content in the PHPDoc.
The current regex does not include single new lines, e.g.short line 1\nshort line 2 would only matchshort line 1. AFAIK it's OK.
| ->getSummary(); | ||
| } | ||
| }catch (\ReflectionException |\InvalidArgumentException$e) { | ||
| $docComment =$r->getDocComment(); |
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.
if ($docComment = $r->getDocComment()) { should be kept imho
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.
re-added the if statement thanks@nicolas-grekas
SerkanYildiz commentedDec 12, 2018
@ro0NL Your regex worked and made the tests pass (at least locally.) Thank You! |
src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
nicolas-grekas left a comment
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 you please add tests with several variants of class descriptions (or missing ones)?
src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
SerkanYildiz commentedDec 13, 2018
@nicolas-grekas I don't now if it's necessary to add more tests. There were existing tests for theold implementation. We just changed the logic and IMO we just had to ensure that the tests should still pass |
ro0NL commentedDec 13, 2018
we should add a test for resulting in and resulting in |
SerkanYildiz commentedDec 13, 2018
@nicolas-grekas failing test is not related to this PR |
src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/AbstractDescriptorTest.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
ro0NL left a comment
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 we're there :) last minor comments from me.
src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/ObjectsProvider.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/Descriptor.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/ObjectsProvider.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
SerkanYildiz commentedDec 17, 2018
ping@nicolas-grekas , failing AppVeyor seems unrelated. Can we retrigger AppVeyor build? |
nicolas-grekas commentedDec 17, 2018
Thank you@SerkanYildiz. |
…ntor/reflection-docblock (SerkanYildiz)This PR was merged into the 4.2 branch.Discussion----------[FrameworkBundle] decouple debug:autowiring from phpdocumentor/reflection-docblock| Q | A| ------------- | ---| Branch? | 4.2| Bug fix? | yesNew feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets | /| License | MITWhen phpDocumentor isn't installed the *debug:autowiring* returns an empty string for class description. With this fallback the end user will get a description even phpDocumentor isn't installed.**Edit:** Usage of phpDocumentor is completely removed from debug:autowiring command.Commits-------485ed4d [FrameworkBundle] decouple debug:autowiring from phpdocumentor/reflection-docblock
Uh oh!
There was an error while loading.Please reload this page.
When phpDocumentor isn't installed thedebug:autowiring returns an empty string for class description. With this fallback the end user will get a description even phpDocumentor isn't installed.
Edit: Usage of phpDocumentor is completely removed from debug:autowiring command.