Skip to content

Commit ec7a696

Browse files
Fix code checker and PHPDoc checker issues
1 parent c9088b7 commit ec7a696

29 files changed

+796
-375
lines changed

blocks/example.php

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,8 @@
2525
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2626
*/
2727

28-
defined('MOODLE_INTERNAL') || die;
29-
30-
3128
/**
32-
* Example {@link report_editdates_block_date_extractor} subclass.
29+
* Example {@see report_editdates_block_date_extractor} subclass.
3330
*
3431
* @copyright 2011 The Open University
3532
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
@@ -45,20 +42,24 @@ public function __construct($course) {
4542
parent::load_data();
4643
}
4744

45+
#[\Override]
4846
public function get_settings(block_base $block) {
4947
// Check if title text is a valid date then return the array.
5048
$title = $block->title;
5149
if ((string) (int) $title === $title) {
52-
return array('title' => new report_editdates_date_setting
53-
(get_string('availabledate', 'assignment'),
54-
$block->title,
55-
self::DATETIME, false, 5)
56-
);
50+
return [
51+
'title' => new report_editdates_date_setting(
52+
get_string('availabledate', 'assignment'),
53+
$block->title,
54+
self::DATETIME, false, 5
55+
),
56+
];
5757
}
5858
}
5959

60+
#[\Override]
6061
public function validate_dates(block_base $block, array $dates) {
61-
$errors = array();
62+
$errors = [];
6263
if ($dates['title'] == 0 ) {
6364
$errors['title'] = get_string('datemustnotzero', 'report_editdates');
6465
}

classes/event/report_viewed.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323

2424
namespace report_editdates\event;
2525

26-
defined('MOODLE_INTERNAL') || die();
27-
2826
/**
2927
*
3028
* @package report_editdates
@@ -72,7 +70,7 @@ public static function get_name() {
7270
* @return \moodle_url
7371
*/
7472
public function get_url() {
75-
$params = array('id' => $this->courseid);
73+
$params = ['id' => $this->courseid];
7674
if ($this->other['activitytype']) {
7775
$params['activitytype'] = $this->other['activitytype'];
7876
}

classes/privacy/provider.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
//
1414
// You should have received a copy of the GNU General Public License
1515
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
16+
1617
/**
1718
* Privacy Subsystem implementation for report_editdates.
1819
*
@@ -21,7 +22,7 @@
2122
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2223
*/
2324
namespace report_editdates\privacy;
24-
defined('MOODLE_INTERNAL') || die();
25+
2526
/**
2627
* Privacy Subsystem for report_editdates implementing null_provider.
2728
*
@@ -33,9 +34,9 @@ class provider implements \core_privacy\local\metadata\null_provider {
3334
* Get the language string identifier with the component's language
3435
* file to explain why this plugin stores no data.
3536
*
36-
* @return string
37+
* @return string
3738
*/
38-
public static function get_reason() : string {
39+
public static function get_reason(): string {
3940
return 'privacy:metadata';
4041
}
4142
}

db/access.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@
2424

2525
defined('MOODLE_INTERNAL') || die;
2626

27-
$capabilities = array(
28-
'report/editdates:view' => array(
27+
$capabilities = [
28+
'report/editdates:view' => [
2929
'riskbitmask' => RISK_PERSONAL,
3030
'captype' => 'read',
3131
'contextlevel' => CONTEXT_COURSE,
32-
'archetypes' => array(
32+
'archetypes' => [
3333
'editingteacher' => CAP_ALLOW,
34-
'manager' => CAP_ALLOW
35-
),
34+
'manager' => CAP_ALLOW,
35+
],
3636
'clonepermissionsfrom' => 'moodle/site:viewreports',
37-
)
38-
);
37+
],
38+
];

db/install.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@
2121
* @copyright 2012 The Open University
2222
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2323
*/
24-
25-
defined('MOODLE_INTERNAL') || die;
26-
2724
function xmldb_report_editdates_install() {
2825
global $DB;
2926

@@ -32,10 +29,10 @@ function xmldb_report_editdates_install() {
3229
// and clone the permissions from moodle/site:viewreports, but if we are upgrading
3330
// a Moodle that had the old course report plugin installed, then we get rid of the
3431
// new cloned capabilities, and transfer the old permissions.
35-
if ($DB->record_exists('role_capabilities', array('capability' => 'coursereport/editdates:view'))) {
36-
$DB->delete_records('role_capabilities', array('capability' => 'report/editdates:view'));
32+
if ($DB->record_exists('role_capabilities', ['capability' => 'coursereport/editdates:view'])) {
33+
$DB->delete_records('role_capabilities', ['capability' => 'report/editdates:view']);
3734
$DB->set_field('role_capabilities', 'capability', 'report/editdates:view',
38-
array('capability' => 'coursereport/editdates:view'));
35+
['capability' => 'coursereport/editdates:view']);
3936
}
4037

4138
// This is a hack which is needed for cleanup of original coursereport_completion stuff.
@@ -44,6 +41,6 @@ function xmldb_report_editdates_install() {
4441

4542
// Update existing block page patterns.
4643
$DB->set_field('block_instances', 'pagetypepattern', 'report-editdates-index',
47-
array('pagetypepattern' => 'course-report-editdates-index'));
44+
['pagetypepattern' => 'course-report-editdates-index']);
4845
}
4946

0 commit comments

Comments
 (0)