Skip to content

Commit

Permalink
Fix deprecation of implicit nullable parameter declarations.
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaboesch committed Jun 12, 2024
1 parent d5c9cd3 commit 500b0f5
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 6 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/moodle-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@ jobs:
fail-fast: false
matrix:
include:
- php: '8.2'
- php: '8.3'
moodle-branch: 'main'
database: 'mariadb'
- php: '8.3'
moodle-branch: 'MOODLE_404_STABLE'
database: 'pgsql'
- php: '8.2'
moodle-branch: 'MOODLE_403_STABLE'
Expand Down
2 changes: 1 addition & 1 deletion classes/local/checklist_check.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class checklist_check extends data_object {
* @param bool $fetch
* @throws \coding_exception
*/
public function __construct(array $params = null, $fetch = true) {
public function __construct(?array $params = null, $fetch = true) {
// Really ugly hack to stop travis complaining about $required_fields.
$this->{'required_fields'} = $this->requiredfields;
parent::__construct($params, $fetch);
Expand Down
2 changes: 1 addition & 1 deletion classes/local/checklist_comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class checklist_comment extends data_object {
* @param bool $fetch
* @throws \coding_exception
*/
public function __construct(array $params = null, $fetch = true) {
public function __construct(?array $params = null, $fetch = true) {
// Really ugly hack to stop travis complaining about $required_fields.
$this->{'required_fields'} = $this->requiredfields;
parent::__construct($params, $fetch);
Expand Down
2 changes: 1 addition & 1 deletion classes/local/checklist_comment_student.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public static function add_student_names(array $studentcomments) {
public static function update_or_create_student_comment(
int $checklistitemid,
string $commenttext,
checklist_comment_student $existingcomment = null
?checklist_comment_student $existingcomment = null
): bool {
if (!$existingcomment) {
$newcomment = new checklist_comment_student();
Expand Down
2 changes: 1 addition & 1 deletion classes/local/checklist_item.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class checklist_item extends data_object {
* @param bool $fetch
* @throws \coding_exception
*/
public function __construct(array $params = null, $fetch = true) {
public function __construct(?array $params = null, $fetch = true) {
// Really ugly hack to stop travis complaining about $required_fields.
$this->{'required_fields'} = $this->requiredfields;
parent::__construct($params, $fetch);
Expand Down
1 change: 1 addition & 0 deletions tests/dates_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ final class dates_test extends \advanced_testcase {
* Set up steps
*/
public function setUp(): void {
parent::setUp();
$this->resetAfterTest();
}

Expand Down
2 changes: 1 addition & 1 deletion tests/generator/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class mod_checklist_generator extends testing_module_generator {
* @return stdClass
* @throws coding_exception
*/
public function create_instance($record = null, array $options = null) {
public function create_instance($record = null, ?array $options = null) {
$record = (object)(array)$record;

$defaultsettings = [
Expand Down
2 changes: 2 additions & 0 deletions tests/group_completion_email_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ final class group_completion_email_test extends \advanced_testcase {
*/
public function setUp(): void {
global $DB;
parent::setUp();

$this->resetAfterTest();
unset_config('noemailever');
Expand Down Expand Up @@ -139,6 +140,7 @@ public function tearDown(): void {
$this->mailsink->close();
unset($this->mailsink);
previous_completions::override_time(null);
parent::tearDown();
}

/**
Expand Down
1 change: 1 addition & 0 deletions tests/privacy_provider_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ final class privacy_provider_test extends \core_privacy\tests\provider_testcase
* {@inheritdoc}
*/
protected function setUp(): void {
parent::setUp();
$this->resetAfterTest();

global $DB;
Expand Down
2 changes: 2 additions & 0 deletions tests/student_comment_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ final class student_comment_test extends \advanced_testcase {
*/
public function setUp(): void {
global $USER, $DB;
parent::setUp();

$this->resetAfterTest();
// Create test checklist with a couple items.
$gen = self::getDataGenerator();
Expand Down

0 comments on commit 500b0f5

Please sign in to comment.