Add guideline about annotation using one-line #657
Conversation
Summoning some other core devs: @icewind1991 @schiesbn @butonic @georgehrke @blizzz @tomneedham @bantu @PVince81 @MorrisJobke @th3fallen (Hope I missed no-one that might be interested as well!) Reason for that is that currently some annotate the type using three-line comments, others one-liners and then again others don't do it at all. For the sake of Vertical Density I'd suggest that we use single line comments instead of bloating too much comments into it. |
Please notice that PHPStorm can generate such member variables annotations on it's own just by typing |
My preference goes out to the three line variant. Additionally a note about using the fully qualified name versus just the classname would be useful ( |
One line full qualified nane |
My vote is one line, class name only. The full qualified type is resolved via the PSR5 states that Method body comments for variables still use /**
* @param Node[] $nodes
* @param \OC_EventSource $eventSource
*/
public function doSth (array $nodes, \OC_EventSource $eventSource = null) {
foreach ($nodes as $node) {
$node->... // codehinting works
}
/* or */
if (isset($nodes[0])) {
/** @var File */
$file = $nodes[0];
$file->... // codehinting works
}
/* ... */
} |
/me votes for one-line and relative name |
My argument for FQN is that it provides the full information in one place, with relative names I need to look at both the current namespace and use statements before I know what class is being referenced |
1line, dont care about full/use as long as the use is present and therefor the methods are found |
Same opinion as @butonic |
I honestly don't care - as long as my IDE can handle it 🙈 Generally speaking: following PSR is desired. |
If there is a PSR for that -> use that |
* @param \OC_Defaults $defaults | ||
* @param \OCP\IRequest $request | ||
*/ | ||
public function __construct(\OC_Defaults $defaults, \OCP\IRequest $request) { |
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.
Probably bad idea to use a private namespace class
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.
woot? This is just to point out how doc blocks should look like
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 ;)
👍 |
@LukasReschke Is this ready to merge? |
@LukasReschke ping? |
@LukasReschke Any reason to keep this open? |
@LukasReschke Can we just merge it with the use-statement? |
From owncloud/core#12279 (comment)
Opinions:
1 full qualified1 use-statement - switch to @type as PSR51 full qualified1 use-statement - switch to @type as PSR5