Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
documentation
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
12 Jan 2011 at 20:04 UTC
Updated:
29 Jul 2014 at 19:18 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
oriol_e9gThe pas by reference is deprecated in php 5.3, the & should be removed.
Comment #2
jhodgdonoriol_e9g: I think the & have been mostly removed from the functions themselves. The question is that there are some docblocks saying
and we need to remove those.
Comment #3
aspilicious commentedActually there are alot of functions still using &.
See function hook_node_access_records_alter(&$grants, $node) {
Or am I missing something...
Comment #4
jhodgdonYou still need & if the $foo is an array, integer, string, etc. You don't need & if $foo is an object.
Comment #5
Anonymous (not verified) commentedThis removes all occurrences of reference signs in the @param parts of doc blocks. I looked at the other places were reference signs were being used and they looked legit to me.
I noticed something else while making the changes. Files like update.authorize.inc include the type of variable—for instance,
* @param array $context—while other files don't. Is there a rule of thumb for when the type should be included in the @param statement? In the update.authorize.inc example, it's not like the parameter is explicitly typed in the function signature.If these should be changed, I'll make another issue.
Comment #6
jhodgdonRegarding @param types -- this section of the standards:
http://drupal.org/node/1354#functions
has a guideline:
"If the data type of a parameter or return value is not obvious or expected to be of a special class or interface, it is recommended to specify the data type in the @param or @return directive: [example follows]"
This standard hasn't been applied to all of Drupal by any means yet. Definitely a separate issue, but probably too big to actually tackle wholesale. So I would say leave it, at least for now.
Anyway, the patch in #5 looks good - thanks again linclark!
Comment #7
chx commented@oriol_e9g while call time pass-by-reference has been deprecated for a long time, that's not what's this patch is about.
Comment #8
dries commentedCommitted to 7.x and 8.x. Thanks.