This issue isolates components of its parent issue #2259979: Docblock fixes in database system, part I, which had become too large to effectively manage.
Add/improve docblocks in the Query system files.
- core/lib/Drupal/Core/Database/Query/AlterableInterface.php
- core/lib/Drupal/Core/Database/Query/Condition.php
- core/lib/Drupal/Core/Database/Query/ConditionInterface.php
- core/lib/Drupal/Core/Database/Query/Delete.php
- core/lib/Drupal/Core/Database/Query/Insert.php
- core/lib/Drupal/Core/Database/Query/PagerSelectExtender.php
- core/lib/Drupal/Core/Database/Query/PlaceholderInterface.php
- core/lib/Drupal/Core/Database/Query/Query.php
- core/lib/Drupal/Core/Database/Query/Select.php
- core/lib/Drupal/Core/Database/Query/SelectExtender.php
- core/lib/Drupal/Core/Database/Query/SelectInterface.php
- core/lib/Drupal/Core/Database/Query/TableSortExtender.php
- core/lib/Drupal/Core/Database/Query/Truncate.php
- core/lib/Drupal/Core/Database/Query/Update.php
This does not necessarily restrict this issue to these files. Also note, {@inheritdoc} additions aren't necessarily in the scope of this issue. The attached, initial patch comes unaltered (after rebase) from donquixote's work in comment #23 of the parent issue.
To do:
Review the patch, improve where possible, and get this RTBC.
Compact beta evaluation: This is an unfrozen change (API docs only).
Comment | File | Size | Author |
---|---|---|---|
#24 | do-block-fix-2343127-23.patch | 2.79 KB | harshil.maradiya |
#22 | interdiff-18-21.txt | 1.03 KB | tadityar |
#22 | docblock-fix-2343127-21.patch | 2.78 KB | tadityar |
#18 | interdiff-14-18.txt | 2.68 KB | tadityar |
#18 | docblock-fix-2343127-18.patch | 2.86 KB | tadityar |
Comments
Comment #2
bburgThis one is rather long on it's own. We may want to consider splitting this into two issues.
Comment #4
Yaron Tal CreditAttribution: Yaron Tal commentedThis function can not return NULL. So the patch is correct, but the existing comment is not.
NULL should be lowercase
The existing comment does not mention returning the StatementInterface object, I think this should be added.
According to the comment this also accepts FALSE. So this should be int|false
Add a comment that this is the element id that is used to differentiate different pager queries.
Since this is also by reference should an "&" be appended (as is done in Query.php)?
Same for some other @return comments in SelectInterface.php
Comment #5
ashutoshmishra CreditAttribution: ashutoshmishra commentedComment #6
ashutoshmishra CreditAttribution: ashutoshmishra commentedPlease review my patch
Comment #7
aphickey CreditAttribution: aphickey commentedDoesn't look like we need this twice.
Redundant 'his' should be removed.
UPloaded new patch and interdiff
Comment #8
sivaramakrishnan CreditAttribution: sivaramakrishnan commentedpatch apply Condition.php,Insert.php,PagerSelectExtender.php only.others are comment lines included.
Comment #9
jhodgdonSorry, but this patch isn't quite right:
a)
This change needs a careful review. Can the function return NULL?
b)
There should only be one space beween @return and the type. Also, given the text below saying the return value is undefined, I don't really think we should be giving a return type here? Very odd to be specifying a return type and then saying it's undefined. ?!?
c)
The spacing is wrong ehre. One space between @param and $element, and the next line indented 2 spaces.
Also "id" should be "ID", and we don't normally say "This is...". And it needs to end in .
Comment #10
piyuesh23 CreditAttribution: piyuesh23 commentedComment #11
harshil.maradiya CreditAttribution: harshil.maradiya commentedComment #12
harshil.maradiya CreditAttribution: harshil.maradiya commentedComment #13
harshil.maradiya CreditAttribution: harshil.maradiya commentedComment #14
harshil.maradiya CreditAttribution: harshil.maradiya commentedApology , uploaded correct patch
Comment #17
jhodgdonThanks for the patch! It still needs some work.
a) Condition.php
I looked at the function code. It actually returns an empty array if there are no extra handling directives. The @return line should be "@return array" and the description should say this.
b) Insert.php -- After the patch, this says:
Read it. It doesn't make sense, and isn't wrapped as a paragraph. Also it lost the information that said "If the query was given multiple sets of values to insert, the return value is undefined", which is still correct and needs to be there. In which case, that "@return \Drupal\Core\Database\StatementInterface|int|null" is just wrong. Take out the type, we don't know what the return value is.
c) PagerSelectExtender
If we are going to fix up the docs, let's take out the extra space before "If" in the middle line here.
d) Same class
After @param, the next line should start with a capital letter and be indented two spaces, and end with ".".
Comment #18
tadityar CreditAttribution: tadityar commentedCorrected with suggestions from #17.
Comment #19
jhodgdonInsert::execute() still isn't formatted correctly:
See https://www.drupal.org/node/1354#param
And the return type still just needs to be omitted. It is not returning a StatementInterface necessarily.
The rest of the changes look good, thanks!
Comment #20
tadityar CreditAttribution: tadityar commented@jhodgdon So do I remove the "@return" altogether or just the "\Drupal\Core\Database\StatementInterface" and what do you mean as "isn't wrapped as a paragraph" in #17? I looked at other paragraph inside Insert.php and they're all no indented.. Thanks for the review btw!
Comment #21
jhodgdonNo, we need the @return, just not the class that follows it. Thanks for asking for clarification!
Regarding #17, I think you already fixed that in the latest patch, but what I meant about paragraph wrapping was from this example:
If a bunch of documentation lines are together in a paragraph, we want each line to extend to as close to 80 characters as possible without going over. That second line needs more words on it to comply with that standard.
Comment #22
tadityar CreditAttribution: tadityar commentedOkay, changed that! Thanks for the info :)
Comment #23
jhodgdonLooks good, missing the word "makes" on the last line of this though:
should be "That makes it safe..."
:)
Comment #24
harshil.maradiya CreditAttribution: harshil.maradiya commentedDone implemented
Comment #25
harshil.maradiya CreditAttribution: harshil.maradiya commentedComment #26
jhodgdonLooks good now, thanks!
Comment #27
alexpottCommitted 8723012 and pushed to 8.0.x. Thanks!
Comment #29
harshil.maradiya CreditAttribution: harshil.maradiya commentedComment #31
YesCT CreditAttribution: YesCT commentedI'm cleaning up some Novice tag duplicates. removing the combined "novice documentation" tag so I can delete it, since we should be able to make a search for the novice tag combined with the documentation tag https://www.drupal.org/project/issues/search?projects=&project_issue_fol... or maybe even better: the documentation component combined with the novice tag https://www.drupal.org/project/issues/search/drupal?project_issue_follow...