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()
This commit is contained in:
raortegar
2023-08-24 23:23:17 +08:00
committed by Andrew Nicols
parent cccc00954d
commit d6b8dd892c
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -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);