Closed (won't fix)
Project:
Drupal core
Version:
8.0.x-dev
Component:
documentation
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
23 Apr 2012 at 02:04 UTC
Updated:
17 Jan 2016 at 03:22 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #0.0
xjmUpdated issue summary.
Comment #0.1
xjm.
Comment #0.2
xjmUpdated issue summary.
Comment #0.3
xjmUpdated issue summary.
Comment #0.4
xjmUpdated issue summary.
Comment #3
xjmComment #4
xjmNote that, as in #1326456: Add missing @param in includes A-C, plus other corrections to some docblocks, I added datatypes for the new parameters because it's necessary to look the function up anyway to see how the parameters are used.
Comment #5
xjmTo review this patch:
+or-in front of them, not the other lines which are provided for context.)function($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 #6
hosef commentedI have not looked to see if there are any other comment blocks that need to be modified, however I did find a few things that should be changed in the comment blocks that were modified by this patch.
In form.inc:
'form_process_checkboxes' only accepts '$elements', it does not accept '$form_state'
before 'form_process_autocomplete', it should say '@param array $element' instead of '@param $element'
In gettext.inc:
before '_locale_import_tokenize_formula', it should say '@param string $formula' instead of '@param $formula'
Everything else looks good so far, and the patch applied cleanly.
Comment #7
hosef commentedI also found a few places where variable references were made in some function when the accepted properties were defined. It seems to me that doing so may trip up novice programmers who don't expect it and are trying to figure out where the value of the variable is being changed, hence we should probably just update the values at the end of the functions to promote ease of debugging, even though it will make a few functions longer.
Comment #8
xjmCould you clarify this? Do you mean the chaos of random passing by reference versus not? I have that as a point for followup in the summary. Or something else?
Comment #9
xjmMarking NW for #6. Thanks @hosef for the review!
Comment #9.0
xjm.
Comment #12
xjmWeird... this is rather different from the FAPI element functions. I'll add this to the summary.
I was debating whether this was scope creep, but I agree it's a bad idea for the docblock to be inconsistent.
Attached patch corrects the issues identified in #6.
Comment #13
xjmSo, there is a case to be made that those do not need to be documented, since the parameters are always the same:
date_validate()andpassword_confirm_validate(). (The latter also has weird parameter names.)$elementparameter by reference and others don't. @jhodgdon and I weren't sure about this (and I think @hosef is also referring to this above).Comment #14
xjmdarn you dreditor
Comment #15
Niklas Fiekas commentedMhh ... I see no reason to repeat parameter docs for process and element validation functions. That basically increases the noise without adding any information. Whereas if the docs actually are specific to the element - like they are for the variables array on theme functions - that's really helpful (positive example: #1540174: Some attributes not allowed for the new HTML5 input elements).
Comment #16
xjmsun has filed: #1552308: Consistently make all form callbacks take $element by reference.
Though it looks like the range validation callback actually needs to be a value function.
I'll look for some more references on the documentation question.
Comment #17
hosef commentedOk, here are the functions that I think still need to be looked at
'function _db_create_keys_sql($spec)' on line 667 of database.inc
'function drupal_form_submit($form_id, &$form_state)' on line 691 of form.inc
'function form_type_checkbox_value($element, $input = FALSE)' on line 2285 of form.inc
'function form_process_checkboxes($element)' on line 3268 of form.inc
'function form_process_weight($element)' on line 4301 of form.inc
'function _form_set_class(&$element, $class = array())' on line 4547 of form.inc
This issue got a lot easier to review once I figured out what the 'D-G' in the issue title meant. :P
Comment #18
xjmComment #18.0
xjmUpdated issue summary.
Comment #19
jhodgdonI'm closing very old coding standards fixup issues. They are being addressed on other issues mostly.