Skip to content

Commit

Permalink
MDL-76034 mod_data: Add type definitions and return values
Browse files Browse the repository at this point in the history
Type definitions and return values for methods get_field_class_name() and data_get_field()
  • Loading branch information
raortegar authored and andrewnicols committed Aug 24, 2023
1 parent cccc009 commit d6b8dd8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion mod/data/classes/search/entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ protected function get_fields_for_entries($entry) {
* @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);
Expand Down
2 changes: 1 addition & 1 deletion mod/data/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit d6b8dd8

Please sign in to comment.