Problem/Motivation
The software does not report problems with comment tag ordering e.g. when a @throws tag occurs before a @return tag in the function comment block (see issue #2599524: Fixing order of documentation sections for /core/lib/Drupal for an example in D8 core).
Proposed resolution
The proposed resolution is to enhance DocCommentSniff.php to check the ordering of tags.
See also: Drupal API documentation standards for order of documentation sections
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | 2605986-4-add-check-for-order.patch | 2.32 KB | blackra |
Comments
Comment #2
blackra commentedI have updated the issue summary and uploaded a patch. The patch has been manually tested against some of the files affected by issue #2599524: Fixing order of documentation sections for /core/lib/Drupal before and after the fix for that issue.
Comment #3
blackra commentedI have found a problem with this patch. It does not pick up tags followed by punctuation.
Example:
@todo: Fix somethingI don't know what doxygen does in these circumstances either, but the ordering is independent of whether this is a permitted construction.
Comment #4
blackra commentedHere is a patch that deals with
@todo:Comment #5
klausiInline comments should end with a dot.
not sure @Plugin should be in here, since that is an annotation, not a doc tag. I think we should remove that for now.
we use PHPCS coding standards for our sniffs to be more in line with PHPCS upstream code so the else should be on the same line as }.
why array_key_exists()? Can we use isset() instead?
else here again.
Then we need test cases. We need to check if we have covered this well enough in good.php. And we need additional checks in the DocCoomentUnitTest* files.
Comment #6
jonathan1055 commentedThis is useful and worth working on.
Also #2909391: Drupal.Commenting.VariableComment.VarOrder - @var before @code which could be closed as duplicate of this issue?