Skip to content

Commit 2aad234

Browse files
committed
Issue #157: Run PHPCBF
1 parent 8eba373 commit 2aad234

24 files changed

+105
-100
lines changed

classes/customfield/cmsuserlist_handler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function get_instance_context(int $instanceid = 0): \context {
6666
*
6767
* @return bool
6868
*/
69-
public function uses_categories() : bool {
69+
public function uses_categories(): bool {
7070
return false;
7171
}
7272

classes/form/cms_types_form.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public function add_action_buttons($cancel = true, $submitlabel=null) {
155155
if ($cancel) {
156156
$buttonarray[] = &$mform->createElement('cancel');
157157
}
158-
$mform->addGroup($buttonarray, 'buttonar', '', array(' '), false);
158+
$mform->addGroup($buttonarray, 'buttonar', '', [' '], false);
159159
$mform->closeHeaderBefore('buttonar');
160160
}
161161

classes/local/datasource/roles.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ public function config_backup_define_structure(\backup_nested_element $parent) {
343343
$cmstype = $this->cms->get_type();
344344
$config = $cmstype->get_custom_data('roles_config');
345345
$source = is_null($config) ? [] : [
346-
['list' => implode(',', $config->list), 'duplicates' => $config->duplicates]
346+
['list' => implode(',', $config->list), 'duplicates' => $config->duplicates],
347347
];
348348
$roles->set_source_array($source);
349349
}

classes/local/datasource/userlist.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,8 @@ public function instance_backup_define_structure(\backup_nested_element $parent)
525525

526526
$fields = new \backup_nested_element('userlistfields');
527527
if ($DB->get_manager()->field_exists('customfield_data', 'valuetrust')) {
528-
$field = new \backup_nested_element('userlistfield', ['id'], ['shortname', 'type', 'value', 'valueformat', 'valuetrust']);
528+
$field = new \backup_nested_element('userlistfield', ['id'],
529+
['shortname', 'type', 'value', 'valueformat', 'valuetrust']);
529530
} else {
530531
$field = new \backup_nested_element('userlistfield', ['id'], ['shortname', 'type', 'value', 'valueformat']);
531532
}
@@ -546,7 +547,7 @@ function ($arr) {
546547
},
547548
$fielddata
548549
)
549-
)
550+
),
550551
];
551552
$fieldsforbackup = array_merge($fieldsforbackup, $this->cfhandler->get_instance_data_for_backup($id));
552553
// Backup annotations. Check for function existence for the sake of backward compatibility.

classes/local/model/cms_types.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,23 +68,23 @@ protected static function define_properties(): array {
6868
],
6969
'description' => [
7070
'type' => PARAM_RAW,
71-
'default' => ''
71+
'default' => '',
7272
],
7373
'descriptionformat' => [
7474
'type' => PARAM_INT,
75-
'default' => 1
75+
'default' => 1,
7676
],
7777
'title_mustache' => [
7878
'type' => PARAM_TEXT,
79-
'default' => ''
79+
'default' => '',
8080
],
8181
'mustache' => [
8282
'type' => PARAM_RAW,
83-
'default' => '{{{debug}}}'
83+
'default' => '{{{debug}}}',
8484
],
8585
'datasources' => [
8686
'type' => PARAM_TEXT,
87-
'default' => ''
87+
'default' => '',
8888
],
8989
'customdata' => [
9090
'type' => PARAM_TEXT,

classes/search/activity.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616

1717
namespace mod_cms\search;
1818

19-
defined('MOODLE_INTERNAL') || die();
20-
2119
use mod_cms\local\model\cms;
2220
use mod_cms\local\renderer;
2321

index.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,13 @@
2222
* @copyright 2023, Catalyst IT
2323
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2424
*/
25+
2526
require_once('../../config.php');
2627

2728
// TODO: This is a stub.
2829

2930
$id = required_param('id', PARAM_INT); // Course id.
3031

31-
$course = $DB->get_record('course', array('id' => $id), '*', MUST_EXIST);
32+
$course = $DB->get_record('course', ['id' => $id], '*', MUST_EXIST);
3233

3334
require_login($course);

lang/en/cms.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,36 +26,36 @@
2626
defined('MOODLE_INTERNAL') || die();
2727

2828
$string['addnewtype'] = 'Add new content type';
29-
$string['chooser:show'] = 'Show in activity chooser';
3029
$string['chooser:hide'] = 'Hide in activity chooser';
30+
$string['chooser:show'] = 'Show in activity chooser';
31+
$string['customfield_manage_heading'] = 'Manage custom fields for content type "{$a}"';
32+
$string['datasources'] = 'Datasources';
33+
$string['datasources_desc'] = 'This is a performance measure. Select datasources to be included in this type. Only selected datasources will be configurable,
34+
or editable at the instance level, or be called upon to provide data. Some datasources are always included and do not appear in
35+
this list.';
3136
$string['editcontenttype'] = 'Edit content type';
3237
$string['export'] = 'Export';
33-
$string['import'] = 'Import';
3438
$string['idnumber'] = 'ID number';
35-
$string['idnumber_help'] = 'An identifier to uniquely label this CMS type. This will be used in backup and restoring. It must be unique within the system, and ideally, unique universally.';
3639
$string['idnumber_exists'] = 'Id number \'{$a}\' already exists in the system.';
40+
$string['idnumber_help'] = 'An identifier to uniquely label this CMS type. This will be used in backup and restoring. It must be unique within the system, and ideally, unique universally.';
41+
$string['import'] = 'Import';
42+
$string['import_cms_type'] = 'Import content type';
43+
$string['import_file'] = 'Import file';
44+
$string['manage_types_return'] = 'Return to manage types';
3745
$string['managetypes'] = 'Manage content types';
3846
$string['maxgrade'] = 'Default max grade';
3947
$string['maxgrade_desc'] = 'The default max grade when creating a new custom content type instance.';
4048
$string['modulename'] = 'CMS';
4149
$string['modulenameplural'] = 'CMS';
4250
$string['newcontenttype'] = 'Add new content type';
43-
$string['pluginname'] = 'CMS';
44-
$string['settings'] = 'Custom content type settings';
45-
$string['table:name'] = 'Custom content type';
46-
$string['table:numinstances'] = 'Number of instances';
4751
$string['pluginadministration'] = 'Plugin administration';
52+
$string['pluginname'] = 'CMS';
4853
$string['preview_with_hint'] = 'Preview (click "{$a}" to update)';
49-
$string['customfield_manage_heading'] = 'Manage custom fields for content type "{$a}"';
50-
$string['manage_types_return'] = 'Return to manage types';
5154
$string['sample_value'] = 'Sample value';
55+
$string['settings'] = 'Custom content type settings';
5256
$string['some_name'] = 'Some name';
53-
$string['import_file'] = 'Import file';
54-
$string['import_cms_type'] = 'Import content type';
55-
$string['datasources'] = 'Datasources';
56-
$string['datasources_desc'] = 'This is a performance measure. Select datasources to be included in this type. Only selected datasources will be configurable,
57-
or editable at the instance level, or be called upon to provide data. Some datasources are always included and do not appear in
58-
this list.';
57+
$string['table:name'] = 'Custom content type';
58+
$string['table:numinstances'] = 'Number of instances';
5959
$string['visibility_updated'] = 'Visibility updated';
6060

6161
// Cache defs.

tests/cms_instance_test.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* @copyright 2023, Catalyst IT
3232
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
3333
*/
34-
class cms_instance_test extends \advanced_testcase {
34+
final class cms_instance_test extends \advanced_testcase {
3535
use test_import1_trait;
3636

3737
/**
@@ -49,7 +49,7 @@ protected function setUp(): void {
4949
* @covers \mod_cms\local\lib::add_instance
5050
* @throws \coding_exception
5151
*/
52-
public function test_add_instance() {
52+
public function test_add_instance(): void {
5353
$cmstype = $this->import();
5454

5555
// Create a course.
@@ -80,7 +80,7 @@ public function test_add_instance() {
8080
* @covers \mod_cms\local\lib::add_instance
8181
* @throws \coding_exception
8282
*/
83-
public function test_update_instance() {
83+
public function test_update_instance(): void {
8484
$cmstype = $this->import();
8585

8686
// Create a course.
@@ -113,7 +113,7 @@ public function test_update_instance() {
113113
*
114114
* @covers \mod_cms\local\lib::delete_instance
115115
*/
116-
public function test_delete_instance() {
116+
public function test_delete_instance(): void {
117117
$cmstype = $this->import();
118118

119119
// Create a course.

tests/cms_types_test.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* @copyright 2023, Catalyst IT
3232
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
3333
*/
34-
class cms_types_test extends \advanced_testcase {
34+
final class cms_types_test extends \advanced_testcase {
3535
/** Test data for import/export. */
3636
public const IMPORT_DATAFILE = __DIR__ . '/fixtures/type_data.json';
3737

@@ -54,7 +54,7 @@ protected function setUp(): void {
5454
* @param string $mustache
5555
* @param bool $valid
5656
*/
57-
public function test_mustache_validity(string $field, string $mustache, bool $valid) {
57+
public function test_mustache_validity(string $field, string $mustache, bool $valid): void {
5858
$cmstype = new cms_types();
5959
$cmstype->set($field, $mustache);
6060

@@ -71,7 +71,7 @@ public function test_mustache_validity(string $field, string $mustache, bool $va
7171
*
7272
* @return array[]
7373
*/
74-
public function mustache_validity_datasource(): array {
74+
public static function mustache_validity_datasource(): array {
7575
return [
7676
['title_mustache', 'test', true],
7777
['title_mustache', '{{test}}', true],
@@ -92,7 +92,7 @@ public function mustache_validity_datasource(): array {
9292
* @param string|null $idnumber
9393
* @param bool $valid
9494
*/
95-
public function test_idnumber(?string $idnumber, bool $valid) {
95+
public function test_idnumber(?string $idnumber, bool $valid): void {
9696

9797
$cmstype = new cms_types();
9898
$cmstype->set('name', 'name');
@@ -115,7 +115,7 @@ public function test_idnumber(?string $idnumber, bool $valid) {
115115
*
116116
* @return array[]
117117
*/
118-
public function idnumber_validity_datasource(): array {
118+
public static function idnumber_validity_datasource(): array {
119119
return [
120120
[null, false],
121121
['', false],
@@ -133,7 +133,7 @@ public function idnumber_validity_datasource(): array {
133133
* @covers \mod_cms\local\model\cms_types::get_cache_key
134134
* @covers \mod_cms\local\model\cms_types::get_icon_metadata
135135
*/
136-
public function test_import() {
136+
public function test_import(): void {
137137
$importdata = json_decode(file_get_contents(self::IMPORT_DATAFILE));
138138
$cmstype = new cms_types();
139139
$cmstype->set_from_import($importdata);

0 commit comments

Comments
 (0)