/**
 * Check that all the valid inline tags are properly enclosed with curly brackets
 * @param local_moodlecheck_file $file
 * @return array of found errors
 */
function local_moodlecheck_phpdocsuncurlyinlinetag(local_moodlecheck_file $file)
{
    $errors = array();
    foreach ($file->get_all_phpdocs() as $phpdocs) {
        if ($inlinetags = $phpdocs->get_inline_tags(false)) {
            $curlyinlinetags = $phpdocs->get_inline_tags(true);
            // The difference will tell us which ones are nor enclosed by curly brackets
            $diff = array_diff($inlinetags, $curlyinlinetags);
            foreach ($diff as $inlinetag) {
                if (in_array($inlinetag, local_moodlecheck_phpdocs::$inlinetags)) {
                    $errors[] = array('line' => $phpdocs->get_line_number($file, '@' . $inlinetag), 'tag' => '@' . $inlinetag);
                }
            }
        }
    }
    return $errors;
}