This commit is contained in:
Jun Pataleta 2024-03-08 08:00:41 +08:00
commit 3278ce7aba
No known key found for this signature in database
GPG key ID: F83510526D99E2C7
1147 changed files with 2621 additions and 2617 deletions

View file

@ -44,7 +44,7 @@ class activities_due extends \core_analytics\local\indicator\binary {
*
* @return \lang_string
*/
public static function get_name() : \lang_string {
public static function get_name(): \lang_string {
return new \lang_string('indicator:activitiesdue');
}

View file

@ -42,7 +42,7 @@ class completion_enabled extends \core_analytics\local\indicator\binary {
*
* @return new \lang_string
*/
public static function get_name() : \lang_string {
public static function get_name(): \lang_string {
return new \lang_string('indicator:completionenabled', 'moodle');
}

View file

@ -49,7 +49,7 @@ class no_student extends \core_analytics\local\indicator\binary {
*
* @return \lang_string
*/
public static function get_name() : \lang_string {
public static function get_name(): \lang_string {
return new \lang_string('indicator:nostudent', 'moodle');
}

View file

@ -49,7 +49,7 @@ class no_teacher extends \core_analytics\local\indicator\binary {
*
* @return \lang_string
*/
public static function get_name() : \lang_string {
public static function get_name(): \lang_string {
return new \lang_string('indicator:noteacher', 'moodle');
}

View file

@ -45,7 +45,7 @@ class potential_cognitive_depth extends \core_analytics\local\indicator\linear {
*
* @return \lang_string
*/
public static function get_name() : \lang_string {
public static function get_name(): \lang_string {
return new \lang_string('indicator:potentialcognitive', 'moodle');
}

View file

@ -45,7 +45,7 @@ class potential_social_breadth extends \core_analytics\local\indicator\linear {
*
* @return \lang_string
*/
public static function get_name() : \lang_string {
public static function get_name(): \lang_string {
return new \lang_string('indicator:potentialsocial', 'moodle');
}

View file

@ -49,7 +49,7 @@ class course_competencies extends course_enrolments {
* @param int $courseid The course id.
* @return int Number of competencies assigned to the course.
*/
protected function get_num_competencies_in_course ($courseid) {
protected function get_num_competencies_in_course($courseid) {
if (!isset($this->coursecompetencies[$courseid])) {
$ccs = \core_competency\api::count_competencies_in_course($courseid);
@ -68,7 +68,7 @@ class course_competencies extends course_enrolments {
*
* @return \lang_string
*/
public static function get_name() : \lang_string {
public static function get_name(): \lang_string {
return new \lang_string('target:coursecompetencies', 'course');
}

View file

@ -46,7 +46,7 @@ class course_completion extends course_enrolments {
*
* @return \lang_string
*/
public static function get_name() : \lang_string {
public static function get_name(): \lang_string {
return new \lang_string('target:coursecompletion', 'course');
}

View file

@ -47,7 +47,7 @@ class course_dropout extends course_enrolments {
*
* @return \lang_string
*/
public static function get_name() : \lang_string {
public static function get_name(): \lang_string {
return new \lang_string('target:coursedropout', 'course');
}

View file

@ -113,7 +113,7 @@ class course_gradetopass extends course_enrolments {
*
* @return \lang_string
*/
public static function get_name() : \lang_string {
public static function get_name(): \lang_string {
return new \lang_string('target:coursegradetopass', 'course');
}

View file

@ -52,7 +52,7 @@ class no_access_since_course_start extends no_recent_accesses {
*
* @return \lang_string
*/
public static function get_name() : \lang_string {
public static function get_name(): \lang_string {
return new \lang_string('target:noaccesssincecoursestart', 'course');
}

View file

@ -51,7 +51,7 @@ class no_recent_accesses extends course_enrolments {
*
* @return \lang_string
*/
public static function get_name() : \lang_string {
public static function get_name(): \lang_string {
return new \lang_string('target:norecentaccesses', 'course');
}

View file

@ -61,7 +61,7 @@ class no_teaching extends \core_analytics\local\target\binary {
*
* @return \lang_string
*/
public static function get_name() : \lang_string {
public static function get_name(): \lang_string {
return new \lang_string('target:noteachingactivity', 'course');
}

View file

@ -177,7 +177,7 @@ class core_course_category implements renderable, cacheable_object, IteratorAggr
* @param string $name Callback function name.
* @return [callable] $pluginfunctions
*/
public function get_plugins_callback_function(string $name) : array {
public function get_plugins_callback_function(string $name): array {
$pluginfunctions = [];
if ($pluginsfunction = get_plugins_with_function($name)) {
foreach ($pluginsfunction as $plugintype => $plugins) {
@ -766,7 +766,7 @@ class core_course_category implements renderable, cacheable_object, IteratorAggr
* @throws dml_exception
* @throws moodle_exception
*/
private static function get_cached_cat_tree() : ?array {
private static function get_cached_cat_tree(): ?array {
$coursecattreecache = cache::make('core', 'coursecattree');
$all = $coursecattreecache->get('all');
if ($all !== false) {
@ -804,7 +804,7 @@ class core_course_category implements renderable, cacheable_object, IteratorAggr
* @throws dml_exception
* @throws moodle_exception
*/
private static function rebuild_coursecattree_cache_contents() : array {
private static function rebuild_coursecattree_cache_contents(): array {
global $DB;
$sql = "SELECT cc.id, cc.parent, cc.visible
FROM {course_categories} cc

View file

@ -61,7 +61,7 @@ class course_handler extends \core_customfield\handler {
* @param int $itemid
* @return \core_course\customfield\course_handler
*/
public static function create(int $itemid = 0) : \core_customfield\handler {
public static function create(int $itemid = 0): \core_customfield\handler {
if (static::$singleton === null) {
self::$singleton = new static(0);
}
@ -84,7 +84,7 @@ class course_handler extends \core_customfield\handler {
*
* @return bool true if the current can configure custom fields, false otherwise
*/
public function can_configure() : bool {
public function can_configure(): bool {
return has_capability('moodle/course:configurecustomfields', $this->get_configuration_context());
}
@ -95,7 +95,7 @@ class course_handler extends \core_customfield\handler {
* @param int $instanceid id of the course to test edit permission
* @return bool true if the current can edit custom fields, false otherwise
*/
public function can_edit(field_controller $field, int $instanceid = 0) : bool {
public function can_edit(field_controller $field, int $instanceid = 0): bool {
if ($instanceid) {
$context = $this->get_instance_context($instanceid);
return (!$field->get_configdata_property('locked') ||
@ -119,7 +119,7 @@ class course_handler extends \core_customfield\handler {
* @param int $instanceid id of the course to test edit permission
* @return bool true if the current can edit custom fields, false otherwise
*/
public function can_view(field_controller $field, int $instanceid) : bool {
public function can_view(field_controller $field, int $instanceid): bool {
$visibility = $field->get_configdata_property('visibility');
if ($visibility == self::NOTVISIBLE) {
return false;
@ -146,7 +146,7 @@ class course_handler extends \core_customfield\handler {
*
* @return \context
*/
protected function get_parent_context() : \context {
protected function get_parent_context(): \context {
global $PAGE;
if ($this->parentcontext) {
return $this->parentcontext;
@ -161,7 +161,7 @@ class course_handler extends \core_customfield\handler {
*
* @return \context the context for configuration
*/
public function get_configuration_context() : \context {
public function get_configuration_context(): \context {
return \context_system::instance();
}
@ -170,7 +170,7 @@ class course_handler extends \core_customfield\handler {
*
* @return \moodle_url The URL to configure custom fields for this component
*/
public function get_configuration_url() : \moodle_url {
public function get_configuration_url(): \moodle_url {
return new \moodle_url('/course/customfield.php');
}
@ -180,7 +180,7 @@ class course_handler extends \core_customfield\handler {
* @param int $instanceid id of the record to get the context for
* @return \context the context for the given record
*/
public function get_instance_context(int $instanceid = 0) : \context {
public function get_instance_context(int $instanceid = 0): \context {
if ($instanceid > 0) {
return \context_course::instance($instanceid);
} else {

View file

@ -205,7 +205,7 @@ class core_course_list_element implements IteratorAggregate {
*
* @return \core_customfield\data_controller[]
*/
public function get_custom_fields() : array {
public function get_custom_fields(): array {
if (!isset($this->record->customfields)) {
$this->record->customfields = \core_course\customfield\course_handler::create()->get_instance_data($this->id);
}
@ -217,7 +217,7 @@ class core_course_list_element implements IteratorAggregate {
*
* @return bool
*/
public function has_custom_fields() : bool {
public function has_custom_fields(): bool {
$customfields = $this->get_custom_fields();
return !empty($customfields);
}

View file

@ -53,7 +53,7 @@ class provider implements
* @param collection $collection The initialised collection to add items to.
* @return collection A listing of user data stored through this system.
*/
public static function get_metadata(collection $collection) : collection {
public static function get_metadata(collection $collection): collection {
$collection->add_subsystem_link('core_completion', [], 'privacy:metadata:completionsummary');
$collection->add_subsystem_link('core_favourites', [], 'privacy:metadata:favouritessummary');
$collection->add_subsystem_link('core_favourites', [], 'privacy:metadata:activityfavouritessummary');
@ -67,7 +67,7 @@ class provider implements
* @param int $userid The user to search.
* @return contextlist $contextlist The contextlist containing the list of contexts used in this plugin.
*/
public static function get_contexts_for_userid(int $userid) : contextlist {
public static function get_contexts_for_userid(int $userid): contextlist {
list($join, $where, $params) = \core_completion\privacy\provider::get_course_completion_join_sql($userid, 'cc', 'c.id');
$sql = "SELECT ctx.id
FROM {context} ctx

View file

@ -183,7 +183,7 @@ class course extends \core_search\base {
* @param \core_search\document $doc
* @return \core_search\document_icon
*/
public function get_doc_icon(\core_search\document $doc) : \core_search\document_icon {
public function get_doc_icon(\core_search\document $doc): \core_search\document_icon {
return new \core_search\document_icon('i/course');
}

View file

@ -194,7 +194,7 @@ class customfield extends \core_search\base {
* @param \core_search\document $doc
* @return \core_search\document_icon
*/
public function get_doc_icon(\core_search\document $doc) : \core_search\document_icon {
public function get_doc_icon(\core_search\document $doc): \core_search\document_icon {
return new \core_search\document_icon('i/customfield');
}

View file

@ -202,7 +202,7 @@ class section extends \core_search\base {
* @param \core_search\document $doc
* @return \core_search\document_icon
*/
public function get_doc_icon(\core_search\document $doc) : \core_search\document_icon {
public function get_doc_icon(\core_search\document $doc): \core_search\document_icon {
return new \core_search\document_icon('i/section');
}