diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7fa8c53d..d09e13ea 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,15 +30,15 @@ jobs: fail-fast: false matrix: include: + - php: '8.4' + moodle-branch: 'MOODLE_500_STABLE' + database: 'pgsql' - php: '8.3' - moodle-branch: 'MOODLE_405_STABLE' + moodle-branch: 'MOODLE_500_STABLE' database: 'mariadb' - php: '8.2' - moodle-branch: 'MOODLE_405_STABLE' + moodle-branch: 'MOODLE_500_STABLE' database: 'pgsql' - - php: '8.1' - moodle-branch: 'MOODLE_404_STABLE' - database: 'mariadb' steps: - name: Checkout diff --git a/classes/question/question.php b/classes/question/question.php index ed191496..2c96a833 100644 --- a/classes/question/question.php +++ b/classes/question/question.php @@ -653,9 +653,9 @@ public function update($questionrecord = null, $updatechoices = true) { * Add the question to the database from supplied arguments. * @param \stdClass $questionrecord The required data for adding the question. * @param array $choicerecords An array of choice records with 'content' and 'value' properties. - * @param boolean $calcposition Whether or not to calculate the next available position in the survey. + * @param bool|null $calcposition Whether or not to calculate the next available position in the survey. */ - public function add($questionrecord, array $choicerecords = null, $calcposition = true) { + public function add($questionrecord, ?array $choicerecords = null, ?bool $calcposition = true) { global $DB; // Create new question. diff --git a/classes/question/rate.php b/classes/question/rate.php index 8e0117da..b21bfc55 100644 --- a/classes/question/rate.php +++ b/classes/question/rate.php @@ -1026,9 +1026,9 @@ public function insert_nameddegrees(array $nameddegrees) { * Helper function used to move existing named degree choices for the specified question from the "quest_choice" table to the * "question" table. * @param int $qid - * @param null|\stdClass $questionrec + * @param \stdClass|null $questionrec */ - public static function move_nameddegree_choices(int $qid = 0, \stdClass $questionrec = null) { + public static function move_nameddegree_choices(int $qid = 0, ?\stdClass $questionrec = null) { global $DB; if ($qid !== 0) { @@ -1079,7 +1079,7 @@ public static function move_nameddegree_choices(int $qid = 0, \stdClass $questio * questionnaire before '2018110103'. * @param int|null $surveyid */ - public static function move_all_nameddegree_choices(int $surveyid = null) { + public static function move_all_nameddegree_choices(?int $surveyid = null) { global $DB; // This operation might take a while. Cancel PHP timeouts for this. diff --git a/classes/responsetype/responsetype.php b/classes/responsetype/responsetype.php index aa9c5dd2..1e879781 100644 --- a/classes/responsetype/responsetype.php +++ b/classes/responsetype/responsetype.php @@ -45,9 +45,9 @@ abstract class responsetype { * responsetype constructor. * @param \mod_questionnaire\question\question $question * @param int|null $responseid - * @param array $choices + * @param array|null $choices */ - public function __construct(\mod_questionnaire\question\question $question, int $responseid = null, array $choices = []) { + public function __construct(\mod_questionnaire\question\question $question, ?int $responseid = null, ?array $choices = []) { $this->question = $question; $this->responseid = $responseid; $this->choices = $choices; diff --git a/tests/behat/behat_mod_questionnaire.php b/tests/behat/behat_mod_questionnaire.php index 57c97c58..39b47d51 100644 --- a/tests/behat/behat_mod_questionnaire.php +++ b/tests/behat/behat_mod_questionnaire.php @@ -418,7 +418,7 @@ private function add_response_data($qid, $sid) { * to replace with mapped values. * @return null */ - private function add_data(array $data, $datatable, $mapvar = '', array $replvars = null) { + private function add_data(array $data, $datatable, $mapvar = '', ?array $replvars = null) { global $DB; if ($replvars === null) { diff --git a/tests/custom_completion_test.php b/tests/custom_completion_test.php index e46ce656..c266b8a5 100644 --- a/tests/custom_completion_test.php +++ b/tests/custom_completion_test.php @@ -51,7 +51,7 @@ class custom_completion_test extends \advanced_testcase { * * @return array[] */ - public function get_state_provider(): array { + public static function get_state_provider(): array { return [ 'Undefined rule' => [ 'somenonexistentrule', COMPLETION_DISABLED, false, null, coding_exception::class @@ -178,7 +178,7 @@ public function test_is_defined() { * * @return array[] */ - public function get_available_custom_rules_provider(): array { + public static function get_available_custom_rules_provider(): array { return [ 'Completion submit available' => [ COMPLETION_ENABLED, ['completionsubmit'] diff --git a/tests/generator/lib.php b/tests/generator/lib.php index 447c5246..77b94a90 100644 --- a/tests/generator/lib.php +++ b/tests/generator/lib.php @@ -76,10 +76,10 @@ public function questionnaires() { /** * Create a questionnaire activity. * @param array $record Will be changed in this function. - * @param array $options + * @param array|null $options * @return questionnaire */ - public function create_instance($record = null, array $options = null) { + public function create_instance($record = null, ?array $options = null) { $record = (object)(array)$record; $defaultquestionnairesettings = array(