On IRC there was a question about @return None. The coding standards say not to have a @return element for functions that don't return but we don't do that in core. This fixes it.

Comments

drewish’s picture

Specifically the bit that says:

After all the parameters, a @return directive should be used to document the return value if there is one.

Status: Needs review » Needs work

The last submitted patch failed testing.

drewish’s picture

Status: Needs work » Needs review
Issue tags: +Quick fix, +trivial
drewish’s picture

StatusFileSize
new11.48 KB

removing git's prefix.

dries’s picture

Status: Needs review » Reviewed & tested by the community

This looks good to me. Tagging to be committed.

dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD. Thanks.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

dave reid’s picture

Assigned: Unassigned » dave reid
Status: Closed (fixed) » Postponed
Issue tags: +code cleanup

Re-opening this to accomplish before the release of 7.0. There are lots of added function with @return None that are silly.

jhodgdon’s picture

Title: Remove @return PHPDocs where nothing is return » Remove @return PHPDocs where nothing is returned

I only see two incidents of @return None in Drupal 7 right now:
hook_cron() in modules/system/system.api.php
ajax_process_form() in includes/ajax.inc

These two should be fixed... But maybe my grep-fu is not as good as yours -- where else are you seeing them?

jhodgdon’s picture

Status: Postponed » Active
jhodgdon’s picture

Status: Active » Needs review
StatusFileSize
new2.3 KB

Actually, both of those function docs are terrible. The AJAX one, I'm not sure how to fix, and it may be on another issue...

Here's a patch for hook_cron() doc.

moshe weitzman’s picture

IMO, this is a bad standard. There is no way to distinguish missing docs from deliberate absence when using your IDE and so on.

jhodgdon’s picture

What are you saying is a bad standard -- not having a @return if there is no return value? How long has that been our standard? Also, I think it's fairly standard across the software industry... such as:

http://java.sun.com/j2se/javadoc/writingdoccomments/#@return

aspilicious’s picture

I agree with jhodgdon in this case...
I never saw any standard saying you need to add "@return none" when there isn't any return value....

aspilicious’s picture

Status: Needs review » Reviewed & tested by the community

#11 is rtbc

dries’s picture

To Moshe's defense, Java is different in that you have to explicitly declare the return type. So when you see 'void' in the method signature, you know there is no return value. There is no such equivalent in PHP of course.

jhodgdon’s picture

Issue tags: -Quick fix, -code cleanup, -trivial

#11: 516254hookcron.patch queued for re-testing.

jhodgdon’s picture

Issue tags: +Quick fix, +code cleanup, +trivial

#11: 516254hookcron.patch queued for re-testing.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

I see moshe's point, but the idea of going around to every hook function, form submit/validate handler, testX() function, etc. and adding @return none fills me with absolute dread. Consistency is much easier to keep if we drop the @return on functions that don't return anything. And jhodgdon cites precedent, albeit from a strongly typed language.

Committed to HEAD.

If this isn't already documented in the coding standards, please do so.

jhodgdon’s picture

It's in the standards already.

Status: Fixed » Closed (fixed)
Issue tags: -Quick fix, -code cleanup, -trivial

Automatically closed -- issue fixed for 2 weeks with no activity.