Skip to content
This repository has been archived by the owner on Feb 28, 2024. It is now read-only.

Latest commit

 

History

History
41 lines (22 loc) · 1.38 KB

functions.md

File metadata and controls

41 lines (22 loc) · 1.38 KB

Functions

  • All functions MUST be namespaced with the full module or theme name as a

    prefix.

  • A leading underscore MUST be prefixed to the function name for 'private'

    functions.

  • Private functions SHOULD never be called from outside of the module in

    which they are declared.

  • Private functions SHOULD be declared at the bottom of a file.

  • Functions MUST be documented with one of two types of comments:

    • a one-liner comment (referred to as 'one-liners' in the rest of this

      document) that is literally a one line summary only

      OR

    • a full description comment (referred to as 'docblocks' in the rest of

      this document) with a summary, parameters and result returned where

      appropriate.

  • Function documentation comments, both one-liners and docblocks, MUST

    comply with the Drupal API documentation standards for functions.

  • All function parameters (@param) and returned values (@return) MUST be

    documented if using docblocks.

  • All parameters (@param) listed in docblocks SHOULD be type hinted

    to indicate the data types expected.

  • If values are returned as a result (@return) then docblocks MUST indicate the data types returned.