Closed (won't fix)
Project:
Drupal core
Version:
8.0.x-dev
Component:
documentation
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
30 Oct 2011 at 13:10 UTC
Updated:
7 Jan 2015 at 07:00 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
NROTC_Webmaster commentedSetting active since #1315886: Clean up API docs for includes directory, files starting with A-C is closed.
Comment #1.0
xjmUpdated issue summary.
Comment #1.1
xjmUpdated issue summary.
Comment #1.2
xjmUpdated issue summary.
Comment #1.3
xjm.
Comment #1.4
xjmUpdated issue summary.
Comment #1.5
xjmUpdated issue summary.
Comment #1.6
xjmUpdated issue summary.
Comment #1.7
xjmUpdated issue summary.
Comment #1.8
xjm.
Comment #1.9
xjmUpdated issue summary.
Comment #1.10
xjm.
Comment #2
xjmAttached adds parameter documentation for all functions in
bootstrap.incandcommon.incthat were missing it. Few notes:drupal_json_encode()is legitimatelymixed; it can accept any PHP datatype.$elementrather than the$elementsthat actually appears in the function signature and is used in the function.)Comment #3
xjmComment #4
NROTC_Webmaster commentedDid you leave the single quotes in intentionally? I'm just not sure how many incidental things you were trying to catch in this one.
Comment #5
xjmThe scope is only what is indicated in the summary and title. There's a separate issue for the list cleanups (#1333534: Further cleanup for documentation in core/includes files starting with A-G ), and it's very important to me to keep these tasks separate because these particular files are so large and so full of legacy stuff that they patches would be impossible to review otherwise. :)
Thanks for checking though!
Comment #6
xjmTo review this patch:
+or-in front of them, not the other lines which are provided for context.)function_name($foo_bar), the parameter should be listed as$foo_barin the docblock, not$foobar.NULLvalue for a string parameter, then it should be documented asstring|null.Comment #7
August1914 commentedReviewing
Comment #8
August1914 commentedReviewed for steps 1-9, and I think everything checks out.
Step 10 references I think hundreds of calls, so that is still pending.
Applied the patch to drupal-8.x-dev, and verified that all params are documented.
Apart from the unverified callers and string references, looks good.
Comment #9
tim.plunkettI'm checking step 10.
Comment #10
tim.plunkettThis should be
@param array $arraysMissing
@param array $matches, or maybearray|null? The data type in the function signature directly conflicts with the default, that's weird.Also missing $matches
Weird that this casts it to an array.
The rest looks fine.
Comment #11
xjmI don't think this is correct. See drupal_array_merge_deep(). It's not an array of arrays as one parameter; it's a non-fixed number of array parameters passed to the function and retrieved with
func_get_args(). E.g.:I omitted this because it's a preg_replace callback, which takes
$matchesas the first parameter without$matchesbeing passed by the actual calling code. (PHP creates and passes this parameter internally.) See http://us.php.net/preg_replace_callback under the description of the callback parameter, and also see how these are used in (e.g.) drupal_build_css_cache().When we originally set the callback standards, we talked about omitting parameter descriptions that were always the same like we do for hook implementations and Drupal-specific callbacks, although it looks like this didn't make it into 1354 explicitly. Do you think that's unclear here? Maybe it needs to be something like:
The matches found for the regular expression passed to preg_replace_callback() with this callback. See preg_match() for more information.Yeah, that seems... wrong. I checked and core only calls it once, in filter_process_format(), which is only used as the
#processcallback for filter_element_info(). Maybe we should remove the typecast in D8, as I don't see how an object should ever get passed there?Comment #12
xjmOh, regarding:
Yeah, I thought that was code smell too. I have it on a list of followup issues to file (summary under "miscellaneous").
Comment #13
tim.plunkettThat's true of drupal_array_merge_deep(), but this docblock is for drupal_array_merge_deep_array(), which actually does take an array of arrays.
It just looks like its for the other one because of dreditor's context.
About the callback stuff, that's fine. As long as it makes it into 1354.
Comment #14
tim.plunkettComment #15
lars toomre commentedAttached is an updated patch for this issue.
This patch includes what I understood from all of the intervening comments. In addition, only for those docblocks in which @xjm added a type hinting @param, I added type hinting to all other @param and @return directives in that docblock (as I thought appropriate).
My reasoning was that if reviewers and committers had to check one type hint, let's do that whole docblock in one go. It will ease the burden of getting type hinting committed. As a result, there were several missing @return directives that I added just to those docblocks @xjm had touched.
The instructions from #6 still apply in reviewing this patch.
Edit: Interdiff was same as patch. Not sure what to I did there.
Comment #16
lars toomre commentedHelps if I change the status!
Comment #17
jhodgdonThis patch is too substantial for me to want to review/commit all in one go with no other oversight. Can someone else please give it a thorough review for content/correctness? Thanks!
Comment #18
lars toomre commentedIt would be great if we could get someone (other than @jhodgdon) to review the patch in #15. I was reviewing bootstrap.inc in another issue and noticed a couple of missing @param directives that this patch adds. It would help both bootstrap.inc and common.inc to get this committed soon. Thanks.
Comment #19
cameron tod commentedAn issue which overlaps with this one came up in the core queue: #1816008: drupal_cron_run() @return parameter documentation incorrect, should specify returns TRUE or FALSE
I have posted a patch there, if it is RTBC I guess we should probably incorporate it here.
Comment #20
cameron tod commentedThis patch looks really great and clean! Very small things I noticed:
Looks like there are two spaces before "values."
The string|null notation confused me so I checked node/1354 - great to see this has been adopted for 8!
Typo on "emty".
Comment #21
lars toomre commentedAttached are the results of a self-review after letting this sit for several weeks. A patch is forthcoming that will incorporate this and all other comments back to #15.
Should be 'e.g.,'
Should be 'A Boolean'
Need to add 'Defaults to NULL.'
Needs to add 'Defaults to NULL.'
Needs to specify what the default value is.
Comment #22
lars toomre commentedThe attached patch is untested locally. An interdiff with the patch from #15 is also attached.
This patch includes all of the noted issues through #21. It also includes the fix from #1816008: drupal_cron_run() @return parameter documentation incorrect, should specify returns TRUE or FALSE.
While re-rolling the patch, I noticed a few docblocks were missing the '(optional)' explanation start string. Hence, I included that here too. Also, in correcting the first point from #21, I went through both bootstrap.inc and common.inc and corrected all other incorrect uses of 'e.g.' followed by a space. The correct use is 'e.g.,' as I understand.
Once this issue gets committed, I would recommend that we do a thorough review of both bootstrap.inc and common.inc probably as separate follow-up issues (since both are so big and have lots of legacy functions). There still is stuff to do in both to bring them up to D8 documentation standards.
Comment #22.0
lars toomre commented.
Comment #23
areke commentedArgh, it looks like this should be re-rolled again.
Comment #24
tim.plunkettIt's hard to keep this from needing rerolls when the issue is about adding missing @param, but instead the patch touches almost every docblock.
Comment #25
jhodgdonMost of the "cleanup" issues have been marked "won't fix" at this point, as they're so hard to get right, review, and commit, for little benefit.
I am inclined to do the same with this one.
If someone is passionate about adding just the missing @param statements and wants to roll a *small* patch that just does that, maybe we could get it in (go ahead and reopen if you want), but for now I'd say let's not bother.
Comment #26
donquixote commentedI am working on this, but I need to post a rant before I post yet another patch.
(after 2x of posting the wrong patch in the wrong issue, see [#8543447-21] and [#8543307-1])
@jhodgdon: I am happy to do this on IRC. Just don't see you online atm.
Producing the code changes mentioned above was really easy. But then jumping from one issue to the next to find the correct place, and then having to disect the patch to only commit those parts that fit into a specific issue is demotivating and time-consuming.
I suspect this is part of the reason why this is still not fixed after years, and that we are losing a lot of potentially valuable "casual" contributions from people who are angry at the code style in a specific file, want to fix it and move on.
This being said, i agree with tim.plunkett in #24 that we should focus on stuff that is straightforward and easy to review. Like just adding @param or @return. But slowing it down to match the exact scope of an issue that has been idle for years sounds like quite unproductive to me.
We don't need to close an issue once a piecemeal patch has landed. We can just leave it open, and the next person has less work to do.
(this is tim.plunkett's quote)
This was the rant, next comes a patch.
git add -pis awesome.Comment #27
donquixote commentedImportant questions, before I post the patch:
- Does @see go after the @param and @return, or before it?
- Does @throws go before @return or after? phpstorm puts it before.
https://drupal.org/coding-standards/docs#throws does not really address these questions of order for @see and @throws. And looking at existing code does not guarantee the right answers.
And another question:
Is this just about missing @param, or do we also add missing type declarations on existing @param tags?
And for those @param tags we add, do we add docblock text? Or just the empty tag?
Imo, it would be easier to commit the empty tags and then continue from there by leaving the issue open. This will be a lot easier to review in the first step, and means less rerolling.
Also, I am going to leave out anything where I don't know the exact type. This again should help to speed up the review process and reduce the number of rerolls.
Comment #28
donquixote commentedI found the answer about the order question :)
https://drupal.org/node/1354#order (don't know how I missed that)
Comment #29
donquixote commentedI talked with jhodgdon on IRC.
The conclusion:
This family of issues should remain closed, because it is an approach that failed. This does exactly confirm the concerns I expressed above.
Instead, issues like #2210565: Docblock and code style improvements in core/includes/bootstrap.inc are exactly the way to go. So I am going to re-open that!
Comment #30
jhodgdonOK then, closing this issue back up.
Comment #31
mile23