From d6b8dd892c021daf8c365acc70c4f889723e8083 Mon Sep 17 00:00:00 2001 From: raortegar Date: Mon, 24 Oct 2022 11:41:25 +0200 Subject: [PATCH] MDL-76034 mod_data: Add type definitions and return values Type definitions and return values for methods get_field_class_name() and data_get_field() --- mod/data/classes/search/entry.php | 2 +- mod/data/lib.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mod/data/classes/search/entry.php b/mod/data/classes/search/entry.php index 35b5ec89d9a..47ae9d9f895 100644 --- a/mod/data/classes/search/entry.php +++ b/mod/data/classes/search/entry.php @@ -373,7 +373,7 @@ class entry extends \core_search\base_mod { * @param string $fieldtype * @return string|null It will return the class name or null if the field type is not available. */ - protected function get_field_class_name($fieldtype) { + protected function get_field_class_name(string $fieldtype) : ?string { global $CFG; $fieldtype = trim($fieldtype); diff --git a/mod/data/lib.php b/mod/data/lib.php index 3dd07890cea..ae6bdd2b4f2 100644 --- a/mod/data/lib.php +++ b/mod/data/lib.php @@ -1027,7 +1027,7 @@ function data_get_field_new($type, $data) { * @param stdClass|null $cm optional course module data * @return data_field_base the field object instance or data_field_base if unkown type */ -function data_get_field($field, $data, $cm=null) { +function data_get_field(stdClass $field, stdClass $data, ?stdClass $cm=null): data_field_base { global $CFG; if (!isset($field->type)) { return new data_field_base($field);