9292 * @param int|null $courseid
9393 * @param int|null $gradecatid
9494 * @return int|null
95+ * @throws dml_exception
9596 */
9697function moodleoverflow_validate_grade_category (?int $ courseid , ?int $ gradecatid ): ?int {
9798 global $ DB ;
@@ -114,27 +115,18 @@ function moodleoverflow_validate_grade_category(?int $courseid, ?int $gradecatid
114115 *
115116 * @return mixed true if the feature is supported, null if unknown
116117 */
117- function moodleoverflow_supports ($ feature ) {
118+ function moodleoverflow_supports (string $ feature ): mixed {
118119
119120 if (defined ('FEATURE_MOD_PURPOSE ' )) {
120121 if ($ feature == FEATURE_MOD_PURPOSE ) {
121122 return MOD_PURPOSE_COLLABORATION ;
122123 }
123124 }
124125
125- switch ($ feature ) {
126- case FEATURE_MOD_INTRO :
127- return true ;
128- case FEATURE_SHOW_DESCRIPTION :
129- return true ;
130- case FEATURE_BACKUP_MOODLE2 :
131- return true ;
132- case FEATURE_GRADE_HAS_GRADE :
133- return true ;
134-
135- default :
136- return null ;
137- }
126+ return match ($ feature ) {
127+ FEATURE_MOD_INTRO , FEATURE_SHOW_DESCRIPTION , FEATURE_BACKUP_MOODLE2 , FEATURE_GRADE_HAS_GRADE => true ,
128+ default => null ,
129+ };
138130}
139131
140132/**
@@ -150,7 +142,7 @@ function moodleoverflow_supports($feature) {
150142 *
151143 * @return int The id of the newly inserted moodleoverflow record
152144 */
153- function moodleoverflow_add_instance (stdClass $ moodleoverflow , ?mod_moodleoverflow_mod_form $ mform = null ) {
145+ function moodleoverflow_add_instance (stdClass $ moodleoverflow , ?mod_moodleoverflow_mod_form $ mform = null ): int {
154146 global $ DB ;
155147
156148 // Set the current time.
@@ -174,7 +166,7 @@ function moodleoverflow_add_instance(stdClass $moodleoverflow, ?mod_moodleoverfl
174166 * Handle changes following the creation of a moodleoverflow instance.
175167 * This function is typically called by the course_module_created observer.
176168 *
177- * @param object $context The context of the moodleoverflow
169+ * @param context_module $context The context of the moodleoverflow
178170 * @param stdClass $moodleoverflow The moodleoverflow object
179171 */
180172function moodleoverflow_instance_created (context_module $ context , $ moodleoverflow ) {
0 commit comments