MDL-65292 style: Fix all function declarations white space
This has been generated running the following Sniffs, all them part of the Moodle's CodeSniffer standard: - PSR12.Functions.ReturnTypeDeclaration - PSR12.Functions.NullableTypeDeclaration - moodle.Methods.MethodDeclarationSpacing - Squiz.Whitespace.ScopeKeywordSpacing All them are, exclusively, about correct spacing, so the changes are, all them, only white space changes. Only exceptions to the above are 3 changes what were setting the return type in a new line, and, when that happens, the closing parenthesis (bracket) has to go to the same line than the colon.
This commit is contained in:
@@ -79,7 +79,7 @@ abstract class calculable {
|
||||
*
|
||||
* @return \lang_string
|
||||
*/
|
||||
public static abstract function get_name() : \lang_string;
|
||||
public static abstract function get_name(): \lang_string;
|
||||
|
||||
/**
|
||||
* The class id is the calculable class full qualified class name.
|
||||
|
||||
@@ -77,7 +77,7 @@ abstract class base {
|
||||
*
|
||||
* @return \lang_string
|
||||
*/
|
||||
public static abstract function get_name() : \lang_string;
|
||||
public static abstract function get_name(): \lang_string;
|
||||
|
||||
/**
|
||||
* Returns the time splitting method id.
|
||||
|
||||
@@ -357,7 +357,7 @@ class manager {
|
||||
*
|
||||
* @return \core_analytics\local\target\base[]
|
||||
*/
|
||||
public static function get_all_targets() : array {
|
||||
public static function get_all_targets(): array {
|
||||
if (self::$alltargets !== null) {
|
||||
return self::$alltargets;
|
||||
}
|
||||
@@ -909,7 +909,7 @@ class manager {
|
||||
* @param array $model Model declaration
|
||||
* @return string complying with PARAM_ALPHANUM rules and starting with an 'id' prefix
|
||||
*/
|
||||
public static function model_declaration_identifier(array $model) : string {
|
||||
public static function model_declaration_identifier(array $model): string {
|
||||
return 'id'.sha1(serialize($model));
|
||||
}
|
||||
|
||||
|
||||
@@ -1597,7 +1597,7 @@ class model {
|
||||
* @param bool $includeweights Include the model weights if available
|
||||
* @return string Zip file path
|
||||
*/
|
||||
public function export_model(string $zipfilename, bool $includeweights = true) : string {
|
||||
public function export_model(string $zipfilename, bool $includeweights = true): string {
|
||||
|
||||
\core_analytics\manager::check_can_manage_models();
|
||||
|
||||
@@ -1614,7 +1614,7 @@ class model {
|
||||
* @param string $zipfilepath Zip file path
|
||||
* @return \core_analytics\model
|
||||
*/
|
||||
public static function import_model(string $zipfilepath) : \core_analytics\model {
|
||||
public static function import_model(string $zipfilepath): \core_analytics\model {
|
||||
|
||||
\core_analytics\manager::check_can_manage_models();
|
||||
|
||||
@@ -1627,7 +1627,7 @@ class model {
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function can_export_configuration() : bool {
|
||||
public function can_export_configuration(): bool {
|
||||
|
||||
if (empty($this->model->timesplitting)) {
|
||||
return false;
|
||||
@@ -1680,7 +1680,7 @@ class model {
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function trained_locally() : bool {
|
||||
public function trained_locally(): bool {
|
||||
global $DB;
|
||||
|
||||
if (!$this->is_trained() || $this->is_static()) {
|
||||
|
||||
@@ -61,7 +61,7 @@ class model_config {
|
||||
* @param bool $includeweights Include the model weights if available
|
||||
* @return string
|
||||
*/
|
||||
public function export(string $zipfilename, bool $includeweights = true) : string {
|
||||
public function export(string $zipfilename, bool $includeweights = true): string {
|
||||
|
||||
if (!$this->model) {
|
||||
throw new \coding_exception('No model object provided.');
|
||||
@@ -111,7 +111,7 @@ class model_config {
|
||||
* @param string $zipfilepath Path to the zip file to import
|
||||
* @return \core_analytics\model
|
||||
*/
|
||||
public function import(string $zipfilepath) : \core_analytics\model {
|
||||
public function import(string $zipfilepath): \core_analytics\model {
|
||||
|
||||
list($modeldata, $mlbackenddir) = $this->extract_import_contents($zipfilepath);
|
||||
|
||||
@@ -144,7 +144,7 @@ class model_config {
|
||||
* @param bool $ignoreversionmismatches
|
||||
* @return string|null Error string or null if all good.
|
||||
*/
|
||||
public function check_dependencies(\stdClass $modeldata, bool $ignoreversionmismatches) : ?string {
|
||||
public function check_dependencies(\stdClass $modeldata, bool $ignoreversionmismatches): ?string {
|
||||
|
||||
$siteversions = \core_component::get_all_versions();
|
||||
|
||||
@@ -228,7 +228,7 @@ class model_config {
|
||||
* @param string $fullclassname Qualified name including the namespace.
|
||||
* @return string|null Frankenstyle component
|
||||
*/
|
||||
public static function get_class_component(string $fullclassname) : ?string {
|
||||
public static function get_class_component(string $fullclassname): ?string {
|
||||
|
||||
// Strip out leading backslash.
|
||||
$fullclassname = ltrim($fullclassname, '\\');
|
||||
@@ -254,7 +254,7 @@ class model_config {
|
||||
* @param string $zipfilepath Zip file path
|
||||
* @return array [0] => \stdClass, [1] => string
|
||||
*/
|
||||
public function extract_import_contents(string $zipfilepath) : array {
|
||||
public function extract_import_contents(string $zipfilepath): array {
|
||||
|
||||
$importtempdir = make_request_directory();
|
||||
|
||||
@@ -287,7 +287,7 @@ class model_config {
|
||||
* Exports the configuration of the model.
|
||||
* @return \stdClass
|
||||
*/
|
||||
protected function export_model_data() : \stdClass {
|
||||
protected function export_model_data(): \stdClass {
|
||||
|
||||
$versions = \core_component::get_all_versions();
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ interface packable {
|
||||
* @param string $modeldir The directory that contains the trained model.
|
||||
* @return string The path to the directory that contains the exported model.
|
||||
*/
|
||||
public function export(string $uniqueid, string $modeldir) : string;
|
||||
public function export(string $uniqueid, string $modeldir): string;
|
||||
|
||||
/**
|
||||
* Imports the provided machine learning model.
|
||||
@@ -53,5 +53,5 @@ interface packable {
|
||||
* @param string $importdir The directory that contains the files to import.
|
||||
* @return bool Success
|
||||
*/
|
||||
public function import(string $uniqueid, string $modeldir, string $importdir) : bool;
|
||||
public function import(string $uniqueid, string $modeldir, string $importdir): bool;
|
||||
}
|
||||
|
||||
@@ -52,7 +52,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_database_table(
|
||||
'analytics_indicator_calc',
|
||||
[
|
||||
@@ -125,7 +125,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 {
|
||||
global $DB;
|
||||
|
||||
$contextlist = new \core_privacy\local\request\contextlist();
|
||||
|
||||
@@ -39,7 +39,7 @@ class stats {
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public static function enabled_models() : int {
|
||||
public static function enabled_models(): int {
|
||||
return count(manager::get_all_models(true));
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ class stats {
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public static function predictions() : int {
|
||||
public static function predictions(): int {
|
||||
global $DB;
|
||||
|
||||
return $DB->count_records('analytics_predictions');
|
||||
@@ -59,7 +59,7 @@ class stats {
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public static function actions() : int {
|
||||
public static function actions(): int {
|
||||
global $DB;
|
||||
|
||||
return $DB->count_records('analytics_prediction_actions');
|
||||
@@ -70,7 +70,7 @@ class stats {
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public static function actions_not_useful() : int {
|
||||
public static function actions_not_useful(): int {
|
||||
global $DB;
|
||||
|
||||
// Simple version using core's TYPE_NEGATIVE actions.
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ class test_indicator_discrete extends \core_analytics\local\indicator\discrete {
|
||||
*
|
||||
* @return \lang_string
|
||||
*/
|
||||
public static function get_name() : \lang_string {
|
||||
public static function get_name(): \lang_string {
|
||||
// Using a string that exists and contains a corresponding '_help' string.
|
||||
return new \lang_string('allowstealthmodules');
|
||||
}
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ class test_indicator_fullname extends \core_analytics\local\indicator\linear {
|
||||
*
|
||||
* @return \lang_string
|
||||
*/
|
||||
public static function get_name() : \lang_string {
|
||||
public static function get_name(): \lang_string {
|
||||
// Using a string that exists and contains a corresponding '_help' string.
|
||||
return new \lang_string('allowstealthmodules');
|
||||
}
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ class test_indicator_max extends \core_analytics\local\indicator\binary {
|
||||
*
|
||||
* @return \lang_string
|
||||
*/
|
||||
public static function get_name() : \lang_string {
|
||||
public static function get_name(): \lang_string {
|
||||
// Using a string that exists and contains a corresponding '_help' string.
|
||||
return new \lang_string('allowstealthmodules');
|
||||
}
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ class test_indicator_min extends \core_analytics\local\indicator\binary {
|
||||
*
|
||||
* @return \lang_string
|
||||
*/
|
||||
public static function get_name() : \lang_string {
|
||||
public static function get_name(): \lang_string {
|
||||
// Using a string that exists and contains a corresponding '_help' string.
|
||||
return new \lang_string('allowstealthmodules');
|
||||
}
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ class test_indicator_multiclass extends \core_analytics\local\indicator\linear {
|
||||
*
|
||||
* @return \lang_string
|
||||
*/
|
||||
public static function get_name() : \lang_string {
|
||||
public static function get_name(): \lang_string {
|
||||
// Using a string that exists and contains a corresponding '_help' string.
|
||||
return new \lang_string('allowstealthmodules');
|
||||
}
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ class test_indicator_null extends \core_analytics\local\indicator\binary {
|
||||
*
|
||||
* @return \lang_string
|
||||
*/
|
||||
public static function get_name() : \lang_string {
|
||||
public static function get_name(): \lang_string {
|
||||
// Using a string that exists and contains a corresponding '_help' string.
|
||||
return new \lang_string('allowstealthmodules');
|
||||
}
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ class test_indicator_random extends \core_analytics\local\indicator\linear {
|
||||
*
|
||||
* @return \lang_string
|
||||
*/
|
||||
public static function get_name() : \lang_string {
|
||||
public static function get_name(): \lang_string {
|
||||
// Using a string that exists and contains a corresponding '_help' string.
|
||||
return new \lang_string('allowstealthmodules');
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ class test_static_target_shortname extends test_target_shortname {
|
||||
*
|
||||
* @return \lang_string
|
||||
*/
|
||||
public static function get_name() : \lang_string {
|
||||
public static function get_name(): \lang_string {
|
||||
// Using a string that exists and contains a corresponding '_help' string.
|
||||
return new \lang_string('allowstealthmodules');
|
||||
}
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ class test_target_course_users extends test_target_site_users {
|
||||
*
|
||||
* @return \lang_string
|
||||
*/
|
||||
public static function get_name() : \lang_string {
|
||||
public static function get_name(): \lang_string {
|
||||
// Using a string that exists and contains a corresponding '_help' string.
|
||||
return new \lang_string('adminhelpedituser');
|
||||
}
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ class test_target_shortname extends \core_analytics\local\target\binary {
|
||||
*
|
||||
* @return \lang_string
|
||||
*/
|
||||
public static function get_name() : \lang_string {
|
||||
public static function get_name(): \lang_string {
|
||||
// Using a string that exists and contains a corresponding '_help' string.
|
||||
return new \lang_string('allowstealthmodules');
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ class test_target_shortname_multiclass extends \core_analytics\local\target\disc
|
||||
*
|
||||
* @return \lang_string
|
||||
*/
|
||||
public static function get_name() : \lang_string {
|
||||
public static function get_name(): \lang_string {
|
||||
// Using a string that exists and contains a corresponding '_help' string.
|
||||
return new \lang_string('allowstealthmodules');
|
||||
}
|
||||
@@ -205,7 +205,7 @@ class test_target_shortname_multiclass extends \core_analytics\local\target\disc
|
||||
* @param \core_analytics\local\time_splitting\base $timesplitting
|
||||
* @return bool
|
||||
*/
|
||||
public function can_use_timesplitting(\core_analytics\local\time_splitting\base $timesplitting):bool {
|
||||
public function can_use_timesplitting(\core_analytics\local\time_splitting\base $timesplitting): bool {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ class test_target_site_users extends \core_analytics\local\target\binary {
|
||||
*
|
||||
* @return \lang_string
|
||||
*/
|
||||
public static function get_name() : \lang_string {
|
||||
public static function get_name(): \lang_string {
|
||||
// Using a string that exists and contains a corresponding '_help' string.
|
||||
return new \lang_string('adminhelplogs');
|
||||
}
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ class test_timesplitting_seconds extends \core_analytics\local\time_splitting\pa
|
||||
*
|
||||
* @return \lang_string
|
||||
*/
|
||||
public static function get_name() : \lang_string {
|
||||
public static function get_name(): \lang_string {
|
||||
return new \lang_string('error');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ class test_timesplitting_upcoming_seconds extends \core_analytics\local\time_spl
|
||||
*
|
||||
* @return \lang_string
|
||||
*/
|
||||
public static function get_name() : \lang_string {
|
||||
public static function get_name(): \lang_string {
|
||||
return new \lang_string('error');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user