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 2022-10-24 11:41:25 +02:00 committed by Andrew Nicols
parent cccc00954d
commit d6b8dd892c
No known key found for this signature in database
GPG Key ID: 6D1E3157C8CFBF14
2 changed files with 2 additions and 2 deletions

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);

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);