-
Notifications
You must be signed in to change notification settings - Fork 187
show anything from a doc comment block #315
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
src/DefinitionResolver.php
Outdated
| $docBlock = $node->getAttribute('docBlock'); | ||
| if ($docBlock !== null) { | ||
| return $docBlock->getSummary(); | ||
| return $docBlock->getSummary() . "\n" . $docBlock->getDescription(); |
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 this should be a double line break because it represents a paragraph in markdown and they are separated in the source through a double line break
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.
You're right, thanks. But why did the tests fail?
|
I found out why the tests fail. We should test first wether a description exists, and only then we should add the line breaks. |
|
Okey, looks good now. But we need to rewrite the tests. Can I do it for you? |
|
Of course you can |
src/DefinitionResolver.php
Outdated
| $docBlock = $node->getAttribute('docBlock'); | ||
| if ($docBlock !== null) { | ||
| return $docBlock->getSummary(); | ||
| if (empty($docBlock->getDescription()->render())) { |
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 have assumed getDescription() to return null, is that not the case?
the getter and render() should only be called once.
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.
No. I also wondered about it, but I've tested it:
<?php
require_once 'vendor/autoload.php';
$factory = \phpDocumentor\Reflection\DocBlockFactory::createInstance();
$docComment = <<<DOCCOMMENT
/**
* This is an example of a summary.
*/
DOCCOMMENT;
$docblock = $factory->create($docComment);
var_dump($docblock->getDescription()); // returns a Description class with `$bodyTemplate` => "" (string)
src/DefinitionResolver.php
Outdated
| // with the description | ||
| $description = $docBlock->getDescription()->render(); | ||
|
|
||
| if (empty(($description))) { |
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.
double parenthesis
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.
oops, ran over from a previous, inline version.
|
I'd fixed some tests, but there are three, where I don't know what to do. Could you point me to the good direction? Edit: The online Travis doesn't show that failures... anyway. |
Codecov Report
@@ Coverage Diff @@
## master #315 +/- ##
============================================
- Coverage 85.98% 84.18% -1.81%
- Complexity 717 812 +95
============================================
Files 53 59 +6
Lines 1463 1720 +257
============================================
+ Hits 1258 1448 +190
- Misses 205 272 +67
Continue to review full report at Codecov.
|
| laboris commodo ad commodo velit mollit qui non officia id. Nulla duis veniam | ||
| veniam officia deserunt et non dolore mollit ea quis eiusmod sit non. Occaecat | ||
| consequat sunt culpa exercitation pariatur id reprehenderit nisi incididunt Lorem | ||
| sint. Officia culpa pariatur laborum nostrud cupidatat consequat mollit.', |
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.
please don't do un-indented multi-line strings. They break code folding in editors
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.
so I should qoute any line and add a newline at the end?
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.
yep
|
any news on this? |
felixfbecker
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.
Sorry, thanks for the ping.
src/DefinitionResolver.php
Outdated
|
|
||
| if (empty($description)) { | ||
| return $docBlock->getSummary(); | ||
| } else { |
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.
Remove the else
| laboris commodo ad commodo velit mollit qui non officia id. Nulla duis veniam | ||
| veniam officia deserunt et non dolore mollit ea quis eiusmod sit non. Occaecat | ||
| consequat sunt culpa exercitation pariatur id reprehenderit nisi incididunt Lorem | ||
| sint. Officia culpa pariatur laborum nostrud cupidatat consequat mollit.' |
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.
Fix indendation (for code folding)
|
like this? |
fixes #312