/** * Checks that all define statement have constant name in phpdoc block * * @param local_moodlecheck_file $file * @return array of found errors */ function local_moodlecheck_definedoccorrect(local_moodlecheck_file $file) { $errors = array(); foreach ($file->get_defines() as $object) { if ($object->phpdocs !== false) { if (!preg_match('/^\\s*' . $object->name . '\\s+-\\s+(.*)/', $object->phpdocs->get_description(), $matches) || !strlen(trim($matches[1]))) { $errors[] = array('line' => $object->phpdocs->get_line_number($file), 'object' => $object->fullname); } } } return $errors; }