{"id":175,"date":"2016-08-12T14:47:03","date_gmt":"2016-08-12T13:47:03","guid":{"rendered":"http:\/\/beta.devon.gov.uk\/styleguide\/?page_id=175"},"modified":"2016-08-12T14:47:03","modified_gmt":"2016-08-12T13:47:03","slug":"comments-and-annotations","status":"publish","type":"page","link":"https:\/\/www.devon.gov.uk\/standards\/overview-coding-standards\/comments-and-annotations\/","title":{"rendered":"Comments and annotations"},"content":{"rendered":"<p>Each plugin and theme that is developed, regardless of language, must be noted. The following examples can be copied in to the relevant position and then altered, as needed.<\/p>\n<h2>Syntax<\/h2>\n<h3><strong>DocBlock (PHP and JavaScript only)<br \/>\n<\/strong><\/h3>\n<p>Used to give an overview of what is contained in the file, function, method or class. Whenever possible, <strong>all<\/strong> files, functions, methods and classes should contain a header DocBlock, regardless of the contents \u2013 this includes files containing only classes.<\/p>\n<pre class=\"EnlighterJSRAW\">\/**\n *\n *\n *\/<\/pre>\n<p><em>Note: the opening of the DocBlock comment starts with two asterisks leading on from opening forward slash. All remaining lines indentation needs to be increased by one <strong>space<\/strong>, not a tab, to make sure all the asterisks are in a single, vertical line.<\/em><\/p>\n<h3>Single line comment<\/h3>\n<p>For simple, additional descriptions, found throughout the code.<\/p>\n<pre class=\"EnlighterJSRAW\">PHP and JavaScript\n\/\/ Some\u00a0text\u00a0inserted\u00a0here<\/pre>\n<pre class=\"EnlighterJSRAW\">HTML \n&lt;!-- Some text inserted here --&gt;<\/pre>\n<h3>Multi-line comment<\/h3>\n<p>Used throughout the code where a single line extends, approximately, more than 75 characters<\/p>\n<pre class=\"EnlighterJSRAW\">PHP and JavaScript\n\/*\n * Some text inserted here\n * and some more\n * and some more!\n *\/<\/pre>\n<p><em>Note: In PHP and JavaScript, drop a line and add a space so the asterixs are all in a single, vertical line<\/em><\/p>\n<pre class=\"EnlighterJSRAW\">HTML\n&lt;!-- \n    Some text inserted here\n    And some more \n    And some more!\n--&gt;<\/pre>\n<p><em>Note: Tab in comments in HTML when a line is dropped.<\/em><\/p>\n<h2>File headers<\/h2>\n<p>Each file needs to have a DocBlock summarising what can be found in the file including: a summary, description, <code class=\"EnlighterJSRAW\">@package<\/code>, <code class=\"EnlighterJSRAW\">@subpackage<\/code>(if applicable) and <code class=\"EnlighterJSRAW\">@since<\/code> tags.<\/p>\n<pre class=\"EnlighterJSRAW\">\/**\n * Summary\n *\n * Description\n *\n * @package Plugin_name\n * @subpackage Plugin_name\/Folders\/Path\/File\/Is\/Located\/In\n * @since x.x.x (Version that the file was introduced in)\n *\/<\/pre>\n<h2>Classes<\/h2>\n<p>Whether it is a main class or a sub class, all classes need to contain a DocBlock, describing the classes function.<\/p>\n<h3>Main class<\/h3>\n<pre class=\"EnlighterJSRAW\">\/**\n * Summary\n *\n * Description.\n *\n * @since x.x.x\n *\/<\/pre>\n<h3>Sub Class<\/h3>\n<pre class=\"EnlighterJSRAW\">\/**\n * Summary\n *\n * Description.\n *\n * @since x.x.x\n *\n * @see Super_Class\n *\/<\/pre>\n<h2>Functions\/Methods<\/h2>\n<p>Above each function and method, the following annotation should be used to describe what is happening, the parameters passed in to the function and the global variables that are also used from within the applications scope.<\/p>\n<pre class=\"EnlighterJSRAW\">\/**\n * Summary\n *\n * Description.\n *\n * @since x.x.x \n * @access (If a method: only use if private)\n *\n * @param type  $var Description.\n * @param array $args {\n *     Optional. An array of arguments.\n *\n *     @type type $key Description. Default 'value'. Accepts 'value', 'value'.\n *                     (aligned with Description, if wraps to a new line)\n *     @type type $key Description.\n * }\n * @param type  $var Description.\n *\n * @global type $var Description.\n *\n * @return type Description.\n *\/<\/pre>\n<p>&nbsp;<\/p>\n<h2>Tag reference table<\/h2>\n<table>\n<tbody>\n<tr>\n<th style=\"width: 10%\">Tag<\/th>\n<th style=\"width: 20%\">Usage<\/th>\n<th style=\"width: 70%\">Description<\/th>\n<\/tr>\n<tr>\n<td><strong><span class=\"mentions-prefix\">@<\/span>access<\/strong><\/td>\n<td>public<br \/>\nprivate<br \/>\nprotected<\/td>\n<td>Indicates access control for a function\/method.<br \/>\n<strong><span class=\"mentions-prefix\">@<\/span>access private<\/strong> indicates the function should not be documented.<br \/>\nUsed directly below the <strong><span class=\"mentions-prefix\">@<\/span>since<\/strong> line in block.<\/td>\n<\/tr>\n<tr>\n<td><strong><span class=\"mentions-prefix\">@<\/span>global<\/strong><\/td>\n<td>type global<br \/>\n$varname<br \/>\ndescription<\/td>\n<td>Document global(s) used in the function\/method. For boolean and integer types, use <code>bool<\/code> and <code>int<\/code>, respectively.<\/td>\n<\/tr>\n<tr>\n<td><strong><span class=\"mentions-prefix\">@<\/span>internal<\/strong><\/td>\n<td>information string<\/td>\n<td>Typically used for adding notes for internal use only.<\/td>\n<\/tr>\n<tr>\n<td><strong><span class=\"mentions-prefix\">@<\/span>ignore<\/strong><\/td>\n<td>(standalone)<\/td>\n<td>Used to skip parsing of the entire element.<\/td>\n<\/tr>\n<tr>\n<td><strong><span class=\"mentions-prefix\">@<\/span>link<\/strong><\/td>\n<td>URL<\/td>\n<td>Link to additional information for the function\/method.<br \/>\nFor an external script\/library, links to source.<br \/>\nNot to be used for related functions\/methods; use <strong><span class=\"mentions-prefix\">@<\/span>see<\/strong> instead.<\/td>\n<\/tr>\n<tr>\n<td><strong><span class=\"mentions-prefix\">@<\/span>method<\/strong><\/td>\n<td>returntype<br \/>\ndescription<\/td>\n<td>Shows a \u201c<a href=\"http:\/\/php.net\/manual\/en\/language.oop5.magic.php\" target=\"_blank\" rel=\"noopener\">magic<\/a>\u201d method found inside the class.<\/td>\n<\/tr>\n<tr>\n<td><strong><span class=\"mentions-prefix\">@<\/span>param<\/strong><\/td>\n<td>datatype $variable<br \/>\ndescription<\/td>\n<td>Function\/method parameter of the format: parameter type, variable name, description, default behavior. For boolean and integer types, use <code>bool<\/code> and <code>int<\/code>, respectively.<\/td>\n<\/tr>\n<tr>\n<td><strong><span class=\"mentions-prefix\">@<\/span>return<\/strong><\/td>\n<td>datatype description<\/td>\n<td>Document the return value of functions or methods. <code>@return void<\/code> should not be used outside of the default bundled themes. For boolean and integer types, use <code>bool<\/code> and <code>int<\/code>, respectively.<\/td>\n<\/tr>\n<tr>\n<td><strong><span class=\"mentions-prefix\">@<\/span>see<\/strong><\/td>\n<td>elementname<\/td>\n<td>References another function\/method\/class the function\/method relies on. Should only be used inline for \u201clinking\u201d hooks.<\/td>\n<\/tr>\n<tr>\n<td><strong><span class=\"mentions-prefix\">@<\/span>since<\/strong><\/td>\n<td>version x.x.x<\/td>\n<td>Documents release version function\/method was added. Use 3-digit version number \u2013 this is to aid with version searches, and for use when comparing versions in code. Exception is <code>@since MU<\/code>.<\/td>\n<\/tr>\n<tr>\n<td><strong><span class=\"mentions-prefix\">@<\/span>subpackage<\/strong><\/td>\n<td>subpackagename<\/td>\n<td>For page-level DocBlock, specifies the Component that all functions and defines in file belong to. For class-level DocBlock, specifies the subpackage\/component the class belongs to.<\/td>\n<\/tr>\n<tr>\n<td><strong><span class=\"mentions-prefix\">@<\/span>todo<\/strong><\/td>\n<td>information string<\/td>\n<td>Documents planned changes to an element that have not been implemented.<\/td>\n<\/tr>\n<tr>\n<td><strong><span class=\"mentions-prefix\">@<\/span>type<\/strong><\/td>\n<td>datatype description for an argument array value<\/td>\n<td>Used to denote argument array value types. See the <strong>Hooks<\/strong> or <strong>Parameters That Are Arrays<\/strong> sections for example syntax.<\/td>\n<\/tr>\n<tr>\n<td><strong><span class=\"mentions-prefix\">@<\/span>var<\/strong><\/td>\n<td>datatype description<\/td>\n<td>Data type for a class variable and short description. Callbacks are marked <strong>callback<\/strong>.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Each plugin and theme that is developed, regardless of language, must be noted. The following examples can be copied in to the relevant position and then altered, as needed. Syntax DocBlock (PHP and JavaScript only) Used to give an overview of what is contained in the file, function, method or class. Whenever possible, all files, [&hellip;]<\/p>\n","protected":false},"author":945,"featured_media":0,"parent":171,"menu_order":2,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"footnotes":"","_links_to":"","_links_to_target":""},"class_list":["post-175","page","type-page","status-publish","hentry"],"acf":[],"publishpress_future_action":{"enabled":false,"date":"2026-06-01 09:09:18","action":"change-status","newStatus":"draft","terms":[],"taxonomy":"","extraData":[]},"publishpress_future_workflow_manual_trigger":{"enabledWorkflows":[]},"_links":{"self":[{"href":"https:\/\/www.devon.gov.uk\/standards\/wp-json\/wp\/v2\/pages\/175","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devon.gov.uk\/standards\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.devon.gov.uk\/standards\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.devon.gov.uk\/standards\/wp-json\/wp\/v2\/users\/945"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devon.gov.uk\/standards\/wp-json\/wp\/v2\/comments?post=175"}],"version-history":[{"count":0,"href":"https:\/\/www.devon.gov.uk\/standards\/wp-json\/wp\/v2\/pages\/175\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/www.devon.gov.uk\/standards\/wp-json\/wp\/v2\/pages\/171"}],"wp:attachment":[{"href":"https:\/\/www.devon.gov.uk\/standards\/wp-json\/wp\/v2\/media?parent=175"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}