/** * Checks that all variables have proper \var token in phpdoc block * * @param local_moodlecheck_file $file * @return array of found errors */ function local_moodlecheck_variableshasvar(local_moodlecheck_file $file) { $errors = array(); foreach ($file->get_variables() as $variable) { if ($variable->phpdocs !== false) { $documentedvars = $variable->phpdocs->get_params('var', 2); if (!count($documentedvars) || $documentedvars[0][0] == 'type') { $errors[] = array('line' => $variable->phpdocs->get_line_number($file, '@var'), 'variable' => $variable->fullname); } } } return $errors; }