diff --git a/flag.api.php b/flag.api.php index 9b8cbfe..65db942 100644 --- a/flag.api.php +++ b/flag.api.php @@ -15,7 +15,7 @@ * * This hook may be placed in a $module.flag.inc file. * - * @return + * @return array * An array whose keys are flag type names and whose values are properties of * the flag type. * When a flag type is for an entity, the flag type name must match the entity @@ -46,7 +46,7 @@ function hook_flag_type_info() { * * This hook may be placed in a $module.flag.inc file. * - * @param $definitions + * @param array $definitions * An array of flag definitions returned by hook_flag_type_info(). */ function hook_flag_type_info_alter(&$definitions) { @@ -118,10 +118,10 @@ function hook_flag_alter(&$flag) { * them here so that their additions to the flag admin form are saved into the * flag object. * - * @param $options + * @param array $options * The array of default options for the flag type, with the options for the * flag's link type merged in. - * @param $flag + * @param flag_flag $flag * The flag object. * * @see flag_flag::options() @@ -133,9 +133,9 @@ function hook_flag_options_alter(&$options, $flag) { /** * Act on an object being flagged. * - * @param $flag + * @param flag_flag $flag * The flag object. - * @param $entity_id + * @param int $entity_id * The id of the entity the flag is on. * @param $account * The user account performing the action. @@ -154,7 +154,7 @@ function hook_flag_flag($flag, $entity_id, $account, $flagging) { * * @param $flag * The flag object. - * @param $entity_id + * @param int $entity_id * The id of the entity the flag is on. * @param $account * The user account performing the action. @@ -168,18 +168,18 @@ function hook_flag_unflag($flag, $entity_id, $account, $flagging) { /** * Perform custom validation on a flag before flagging/unflagging. * - * @param $action + * @param string $action * The action about to be carried out. Either 'flag' or 'unflag'. - * @param $flag + * @param flag_flag $flag * The flag object. - * @param $entity_id + * @param int $entity_id * The id of the entity the user is trying to flag or unflag. * @param $account * The user account performing the action. * @param $flagging * The flagging entity. * - * @return + * @return array|NULL * Optional array: textual error with the error-name as the key. * If the error name is 'access-denied' and javascript is disabled, * drupal_access_denied will be called and a 403 will be returned. @@ -207,11 +207,11 @@ function hook_flag_validate($action, $flag, $entity_id, $account, $skip_permissi * Called when displaying a single entity view or edit page. For flag access * checks from within Views, implement hook_flag_access_multiple(). * - * @param $flag + * @param flag_flag $flag * The flag object. * @param $entity_id * The id of the entity in question. - * @param $action + * @param string $action * The action to test. Either 'flag' or 'unflag'. * @param $account * The user on whose behalf to test the flagging action. @@ -238,14 +238,14 @@ function hook_flag_access($flag, $entity_id, $action, $account) { * Called when preparing a View or list of multiple flaggable entities. * For flag access checks for individual entities, see hook_flag_access(). * - * @param $flag + * @param flag_flag $flag * The flag object. - * @param $entity_ids + * @param array $entity_ids * An array of object ids to check access. * @param $account * The user on whose behalf to test the flagging action. * - * @return + * @return array * An array whose keys are the object IDs and values are booleans indicating * access. * @@ -291,7 +291,7 @@ function hook_flag_link_type_info() { * * This hook may be placed in a $module.flag.inc file. * - * @param $link_types + * @param array $link_types * An array of the link types defined by all modules. * * @see flag_get_link_types() @@ -311,11 +311,11 @@ function hook_flag_link_type_info_alter(&$link_types) { * attributes, using the same structure as hook_link(). Note that "title" is * provided by the Flag configuration if not specified here. * - * @param $flag + * @param flag_flag $flag * The full flag object for the flag link being generated. - * @param $action + * @param string $action * The action this link should perform. Either 'flag' or 'unflag'. - * @param $entity_id + * @param int $entity_id * The ID of the node, comment, user, or other object being flagged. The type * of the object can be deduced from the flag type. * @@ -335,7 +335,7 @@ function hook_flag_link() { * This is invoked after all the flag database tables have had their relevant * entries deleted. * - * @param $flag + * @param flag_flag $flag * The flag object that has been deleted. */ function hook_flag_delete($flag) { @@ -345,9 +345,9 @@ function hook_flag_delete($flag) { /** * Act when a flag is reset. * - * @param $flag + * @param flag_flag $flag * The flag object. - * @param $entity_id + * @param int $entity_id * The entity ID on which all flaggings are to be removed. May be NULL, in * which case all of this flag's entities are to be unflagged. * @param $rows @@ -362,9 +362,9 @@ function hook_flag_reset($flag, $entity_id, $rows) { /** * Alter the javascript structure that describes the flag operation. * - * @param $info + * @param array $info * The info array before it is returned from flag_build_javascript_info(). - * @param $flag + * @param flag_flag $flag * The full flag object. * * @see flag_build_javascript_info() @@ -384,7 +384,7 @@ function hook_flag_javascript_info_alter(&$info, $flag) { /** * Alter a flag object that is being prepared for exporting. * - * @param $flag + * @param flag_flag $flag * The flag object. * * @see flag_export_flags() diff --git a/flag.flag.inc b/flag.flag.inc index 242ab77..a063452 100644 --- a/flag.flag.inc +++ b/flag.flag.inc @@ -10,7 +10,7 @@ * * Defines the flag types this module implements. * - * @return + * @return array * An "array of arrays", keyed by object type. The 'handler' slot * should point to the PHP class implementing this flag. */ diff --git a/flag.module b/flag.module index 76f9e5f..c1a74bf 100644 --- a/flag.module +++ b/flag.module @@ -59,12 +59,12 @@ function flag_entity_info() { /** * Loads a flagging entity. * - * @param $flagging_id + * @param int $flagging_id * The 'flagging_id' database serial column. - * @param $reset + * @param bool $reset * Whether to reset the DrupalDefaultEntityController cache. * - * @return + * @return stdClass * The entity object, or FALSE if it can't be found. */ function flagging_load($flagging_id, $reset = FALSE) { @@ -78,7 +78,7 @@ function flagging_load($flagging_id, $reset = FALSE) { * * Creates an unsaved flagging object for use with $flag->flag(). * - * @param $values + * @param array $values * An array of values as described by the entity's property info. Only * 'flag_name' or 'fid' must be specified, since $flag->flag() does the rest. * @@ -374,9 +374,9 @@ function flag_admin_menu_map() { /** * Menu loader for '%flag' arguments. * - * @param $flag_name + * @param string $flag_name * The machine name of the flag. - * @param $include_disabled + * @param bool $include_disabled * (optional) Whether to return a disabled flag too. Normally only enabled * flags are returned. Some menu items operate on disabled flags and in this * case you need to turn on this switch by doing: @@ -515,7 +515,7 @@ function flag_hook_info() { /** * Get a flag type definition. * - * @param $entity_type + * @param string $entity_type * (optional) The entity type to get the definition for, or NULL to return * all flag types. * diff --git a/flag.tokens.inc b/flag.tokens.inc index 77a06c5..4f4e099 100644 --- a/flag.tokens.inc +++ b/flag.tokens.inc @@ -201,7 +201,7 @@ function flag_tokens($type, $tokens, array $data = array(), array $options = arr /** * Returns HTML for a tokens browser. * - * @param $variables + * @param array $variables * An associative array containing: * - types: An array naming the types of tokens to show. * - global_types: Whether to show global tokens. diff --git a/flag_actions.module b/flag_actions.module index 4870e61..49f11fc 100644 --- a/flag_actions.module +++ b/flag_actions.module @@ -136,17 +136,17 @@ function flag_actions_get_actions($flag_name = NULL, $reset = FALSE) { /** * Insert a new flag action. * - * @param $fid + * @param int $fid * The flag object ID. - * @param $event + * @param string $event * The flag event, such as "flag" or "unflag". - * @param $threshold + * @param int $threshold * The flagging threshold at which this action will be executed. - * @param $repeat_threshold + * @param int $repeat_threshold * The number of additional flaggings after which the action will be repeated. - * @param $callback + * @param string $callback * The action callback to be executed. - * @param $parameters + * @param array $parameters * The action parameters. */ function flag_actions_insert_action($fid, $event, $threshold, $repeat_threshold, $callback, $parameters) { @@ -165,15 +165,15 @@ function flag_actions_insert_action($fid, $event, $threshold, $repeat_threshold, /** * Update an existing flag action. * - * @param $aid + * @param int $aid * The flag action ID to update. - * @param $event + * @param string $event * The flag event, such as "flag" or "unflag". - * @param $threshold + * @param int $threshold * The flagging threshold at which this action will be executed. - * @param $repeat_threshold + * @param int $repeat_threshold * The number of additional flaggings after which the action will be repeated. - * @param $parameters + * @param array $parameters * The action parameters. */ function flag_actions_update_action($aid, $event, $threshold, $repeat_threshold, $parameters) { @@ -191,7 +191,7 @@ function flag_actions_update_action($aid, $event, $threshold, $repeat_threshold, /** * Delete a flag action. * - * @param $aid + * @param int $aid * The flag action ID to delete. */ function flag_actions_delete_action($aid) { @@ -393,9 +393,9 @@ function theme_flag_actions_add_form($variables) { * * @param $form_state * The form state. - * @param $aid + * @param int|NULL $aid * If editing an action, an action ID must be passed in. - * @param $flag_name + * @param string|NULL $flag_name * If adding a new action to a flag, a flag name must be specified. */ function flag_actions_form($form, &$form_state, $aid = NULL, $flag_name = NULL) { diff --git a/includes/flag.actions.inc b/includes/flag.actions.inc index c920971..58dc541 100644 --- a/includes/flag.actions.inc +++ b/includes/flag.actions.inc @@ -179,7 +179,7 @@ function flag_user_action_submit($form, $form_state) { * * @param $context * The current action context. - * @param $entity_type + * @param string $entity_type * The entity type applicable to this action, such as "node" or "comment". */ function flag_action_form($context, $entity_type) { diff --git a/includes/flag.admin.inc b/includes/flag.admin.inc index 3ed0e26..af13335 100644 --- a/includes/flag.admin.inc +++ b/includes/flag.admin.inc @@ -232,7 +232,7 @@ function theme_flag_admin_page($variables) { /** * Menu callback for adding a new flag. * - * @param $entity_type + * @param string|NULL $entity_type * The entity type for the new flag, taken from the path argument. If not * present (i.e., '/add'), a form showing all possible flag types is shown. * Otherwise, this shows a form for adding af flag the given type. @@ -796,9 +796,9 @@ function flag_check_link_types($element) { /** * Clears various caches when one or more flags are modified. * - * @param $entity_types + * @param string|array $entity_types * The entity types for the flags. May be a single value or an array. - * @param $is_insert_or_delete + * @param bool $is_insert_or_delete * Whether the modified flag is being inserted (saved for the first time) or * deleted. This results in a more vigorous clearing of caches. In * particular, when no flags exist yet, no Field admin UI paths exist and these diff --git a/includes/flag.export.inc b/includes/flag.export.inc index 64f7f46..7bc9d71 100644 --- a/includes/flag.export.inc +++ b/includes/flag.export.inc @@ -8,9 +8,9 @@ /** * Export a flag to code. * - * @param $flags + * @param array $flags * An array of flag objects, or flag name. - * @param $module + * @param string $module * Optional. The name of the module that will be created if exporting to use * in hook_flag_default_flags(). */ @@ -247,7 +247,7 @@ function flag_update_page($flag) { /** * Update a flag before export. * - * @param $flag + * @param flag_flag $flag * The flag object passed by reference. */ function flag_update_export(&$flag) { diff --git a/includes/flag.features.inc b/includes/flag.features.inc index 9374930..292059b 100644 --- a/includes/flag.features.inc +++ b/includes/flag.features.inc @@ -71,7 +71,7 @@ function flag_features_export_render($module, $data) { /** * Implements hook_features_revert(). * - * @param $module + * @param string $module * The name of module for which to revert content. */ function flag_features_revert($module = NULL) { diff --git a/includes/flag.pages.inc b/includes/flag.pages.inc index 611f441..d54317a 100644 --- a/includes/flag.pages.inc +++ b/includes/flag.pages.inc @@ -10,7 +10,7 @@ * * Used both for the regular callback as well as the JS version. * - * @param $action + * @param string $action * Either 'flag' or 'unflag'. */ function flag_page($action, $flag, $entity_id) { @@ -71,11 +71,11 @@ function flag_page($action, $flag, $entity_id) { /** * Form for confirming the (un)flagging of an entity. * - * @param $action + * @param string $action * Either 'flag' or 'unflag'. - * @param $flag + * @param flag_flag $flag * A loaded flag object. - * @param $entity_id + * @param int $entity_id * The id of the entity to operate on. The type is implicit in the flag. * * @see flag_confirm_submit() diff --git a/includes/flag/flag_flag.inc b/includes/flag/flag_flag.inc index ae59b23..300f92f 100644 --- a/includes/flag/flag_flag.inc +++ b/includes/flag/flag_flag.inc @@ -370,9 +370,9 @@ class flag_flag { * an object that hasn't yet been saved to the database. Subsequent calls to * fetch_entity() return the remembered object. * - * @param $entity_id + * @param int $entity_id * The ID of the object to cache. - * @param $object + * @param stdClass $object * The object to cache. */ function remember_entity($entity_id, $object) { @@ -430,13 +430,13 @@ class flag_flag { /** * Determines whether the user has the permission to use this flag. * - * @param $action + * @param string $action * (optional) The action to test, either "flag" or "unflag". If none given, * "flag" will be tested, which is the minimum permission to use a flag. * @param $account * (optional) The user object. If none given, the current user will be used. * - * @return + * @return bool * Boolean TRUE if the user is allowed to flag/unflag. FALSE otherwise. * * @see flag_permission() @@ -461,16 +461,16 @@ class flag_flag { * This method typically should not be overridden by child classes. Instead * they should implement type_access(), which is called by this method. * - * @param $entity_id + * @param int $entity_id * The entity ID to flag/unflag. - * @param $action + * @param string|NULL $action * The action to test. Either 'flag' or 'unflag'. Leave NULL to determine * by flag status. - * @param $account + * @param stdClass $account * The user on whose behalf to test the flagging action. Leave NULL for the * current user. * - * @return + * @return bool * Boolean TRUE if the user is allowed to flag/unflag the given entity. * FALSE otherwise. */ @@ -530,14 +530,14 @@ class flag_flag { * they should implement type_access_multiple(), which is called by this * method. * - * @param $entity_ids + * @param array $entity_ids * The array of entity IDs to check. The keys are the entity IDs, the * values are the actions to test: either 'flag' or 'unflag'. - * @param $account + * @param stdClass $account * (optional) The account for which the actions will be compared against. * If left empty, the current user will be used. * - * @return + * @return array * An array whose keys are the object IDs and values are booleans indicating * access. * @@ -621,9 +621,9 @@ class flag_flag { * Utility function: Checks whether a flag applies to a certain type, and * possibly subtype, of entity. * - * @param $entity_type + * @param string $entity_type * The type of entity being checked, such as "node". - * @param $content_subtype + * @param string|NULL $content_subtype * The subtype being checked. For entities this will be the bundle name (the * node type in the case of nodes). * @@ -671,13 +671,13 @@ class flag_flag { /** * Flags, or unflags, an item. * - * @param $action + * @param string $action * Either 'flag' or 'unflag'. - * @param $entity_id + * @param int $entity_id * The ID of the item to flag or unflag. - * @param $account + * @param string|NULL $account * The user on whose behalf to flag. Leave empty for the current user. - * @param $skip_permission_check + * @param bool $skip_permission_check * Flag the item even if the $account user don't have permission to do so. * @param $flagging * (optional) This method works in tandem with Drupal's Field subsystem. @@ -695,7 +695,7 @@ class flag_flag { * to take care of Field API validation, using either * field_attach_form_validate() or field_attach_validate(). * - * @return + * @return bool * FALSE if some error occured (e.g., user has no permission, flag isn't * applicable to the item, etc.), TRUE otherwise. */ @@ -980,11 +980,11 @@ class flag_flag { * Thanks to using a cache, inquiring several different flags about the same * item results in only one SQL query. * - * @param $uid + * @param int $uid * (optional) The user ID whose flags we're checking. If none given, the * current user will be used. * - * @return + * @return bool * TRUE if the object is flagged, FALSE otherwise. */ function is_flagged($entity_id, $uid = NULL, $sid = NULL) { @@ -1052,9 +1052,9 @@ class flag_flag { /** * Increases the flag count for an object and clears the static counts cache. * - * @param $entity_id + * @param int $entity_id * For which item should the count be increased. - * @param $number + * @param int $number * The amount of counts to increasing. Defaults to 1. * * @private @@ -1085,9 +1085,9 @@ class flag_flag { /** * Decreases the flag count for an object and clears the static counts cache. * - * @param $entity_id + * @param int $entity_id * For which item should the count be descreased. - * @param $number + * @param int $number * The amount of counts to decrease. Defaults to 1. * * @private @@ -1174,13 +1174,13 @@ class flag_flag { * E.g., do `print $flag->get_label('title')` instead of `print * $flag->title`. * - * @param $label + * @param string $label * The label to get, e.g. 'title', 'flag_short', 'unflag_short', etc. - * @param $entity_id + * @param int $entity_id * The ID in whose context to interpret tokens. If not given, only global * tokens will be substituted. * - * @return + * @return string * The processed label. */ function get_label($label, $entity_id = NULL) { @@ -1520,18 +1520,18 @@ class flag_flag { * This is a wrapper around theme('flag') that channels the call to the right * template file. * - * @param $action + * @param string $action * The action the link is about to carry out, either "flag" or "unflag". - * @param $entity_id + * @param int $entity_id * The ID of the object to flag. - * @param $variables = array() + * @param array $variables * An array of further variables to pass to theme('flag'). For the full list * of parameters, see flag.tpl.php. Of particular interest: * - after_flagging: Set to TRUE if this flag link is being displayed as the * result of a flagging action. * - errors: An array of error messages. * - * @return + * @return string * The HTML for the flag link. */ function theme($action, $entity_id, $variables = array()) { diff --git a/includes/flag/flag_node.inc b/includes/flag/flag_node.inc index 005c756..9e1a7a2 100644 --- a/includes/flag/flag_node.inc +++ b/includes/flag/flag_node.inc @@ -87,10 +87,10 @@ class flag_node extends flag_entity { /** * Adjust the Content ID to find the translation parent if i18n-enabled. * - * @param $entity_id + * @param int $entity_id * The nid for the content. * - * @return + * @return int * The tnid if available, the nid otherwise. */ function get_translation_id($entity_id) { diff --git a/tests/flag.test b/tests/flag.test index 3f8ac33..27408ee 100644 --- a/tests/flag.test +++ b/tests/flag.test @@ -13,10 +13,10 @@ abstract class FlagTestCaseBase extends DrupalWebTestCase { /** * Helper to create a flag from an array of data and clear caches etc. * - * @param $flag_data + * @param array $flag_data * An array of flag data. * - * @return + * @return flag_flag * The flag object. */ function createFlag($flag_data) { diff --git a/tests/flag_hook_test/flag_hook_test.module b/tests/flag_hook_test/flag_hook_test.module index 732af51..169b8f0 100644 --- a/tests/flag_hook_test/flag_hook_test.module +++ b/tests/flag_hook_test/flag_hook_test.module @@ -10,9 +10,9 @@ * * Hook implementations should call this with their hook name and parameters. * - * @param $hook_name + * @param string $hook_name * The name of the hook invoked. - * @param $function_parameters + * @param array $function_parameters * The array of parameters the hook received. * @param $flagging * (optional) The flagging entity that the hook received. If this is given,