part of #2011290: [meta] standards cleanup to get ready for getting into core

Problem/Motivation

Not always type hinting and doing hook standards from https://drupal.org/node/1354#drupal

Hook definition
The summary starts with an imperative verb that tells why a module would want to implement the hook. Example: "Respond to node deletion." Hook definitions are placed in a .api.php file, which is not directly loaded by Drupal. Each is a fake function whose name starts with "hook", and whose function body is a sample implementation. Parameters and return value that the implementer must use need to be documented.

Proposed resolution

update according to standards

Remaining tasks

patch

User interface changes

No.

API changes

No.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

YesCT’s picture

Title: config_translation.api.php standards cleanup to get ready for getting into core » config_translation.api.php hooks standards cleanup to get ready for getting into core
Status: Active » Needs review
FileSize
1.97 KB

add type hinting, @return,
https://drupal.org/node/1354#drupal
hook one line imperative verb tense,

also \ prefix to name spaces in comments.
https://drupal.org/node/1354#classes

If you use a namespace in documentation, always make sure it is a fully-qualified namespace (beginning with a backslash).

@return is probably the only core gate blocker here.

Gábor Hojtsy’s picture

Status: Needs review » Needs work

Thanks, great improvements. Just one nit:

+++ b/config_translation.api.phpundefined
@@ -11,14 +11,17 @@
+ *
+ * @return mixed
+ *   A mapping of configuration name groups to paths and other options,
+ *   encapsulated in ConfigGroupMapper instances from
+ *   \Drupal\config_translation\ConfigGroupMapper or ConfigEntityMapper
+ *   instances from \Drupal\config_translation\ConfigEntityMapper.

This should return an array with items either of type ConfigGroupMapper or ConfigEntityMapper. Its not mixed, its an array AFAIS.

YesCT’s picture

Status: Needs work » Needs review
FileSize
819 bytes
1.92 KB

this changes to array and simplifies the comment.

Gábor Hojtsy’s picture

Status: Needs review » Fixed

Superb, looks good now, committed.

Status: Fixed » Closed (fixed)

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