Skip to content

Commit c6df6ec

Browse files
PhpDoc Checker fixes for 500 (#641)
* Adopting Moodle Plugin CI for Moodle 5.0 * Resolved implicitly marking parameter as nullable deprecation * Resolved Data Provider method is not static * Resolved Moodle PHPDoc Checker issues --------- Co-authored-by: Mike Churchward <[email protected]>
1 parent fa88988 commit c6df6ec

File tree

9 files changed

+25
-25
lines changed

9 files changed

+25
-25
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ jobs:
3030
fail-fast: false
3131
matrix:
3232
include:
33+
- php: '8.4'
34+
moodle-branch: 'MOODLE_500_STABLE'
35+
database: 'pgsql'
3336
- php: '8.3'
34-
moodle-branch: 'MOODLE_405_STABLE'
37+
moodle-branch: 'MOODLE_500_STABLE'
3538
database: 'mariadb'
3639
- php: '8.2'
37-
moodle-branch: 'MOODLE_405_STABLE'
40+
moodle-branch: 'MOODLE_500_STABLE'
3841
database: 'pgsql'
39-
- php: '8.1'
40-
moodle-branch: 'MOODLE_404_STABLE'
41-
database: 'mariadb'
4242

4343
steps:
4444
- name: Checkout
@@ -88,7 +88,7 @@ jobs:
8888

8989
- name: Moodle PHPDoc Checker
9090
if: ${{ always() }}
91-
run: moodle-plugin-ci phpdoc || true
91+
run: moodle-plugin-ci phpdoc
9292

9393
- name: Validating
9494
if: ${{ always() }}

classes/output/renderer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -571,9 +571,9 @@ public function download_dataformat_selector($label, $base, $name = 'dataformat'
571571
}
572572

573573
/**
574-
* @param $urlroot
575-
* @param $options
576-
* @param $userview
574+
* @param moodle_url $urlroot
575+
* @param array $options
576+
* @param string $userview
577577
* @return string
578578
* @throws \coding_exception
579579
* @throws \moodle_exception

classes/question/question.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -652,10 +652,10 @@ public function update($questionrecord = null, $updatechoices = true) {
652652
/**
653653
* Add the question to the database from supplied arguments.
654654
* @param \stdClass $questionrecord The required data for adding the question.
655-
* @param array $choicerecords An array of choice records with 'content' and 'value' properties.
656-
* @param boolean $calcposition Whether or not to calculate the next available position in the survey.
655+
* @param array|null $choicerecords An array of choice records with 'content' and 'value' properties.
656+
* @param bool|null $calcposition Whether or not to calculate the next available position in the survey.
657657
*/
658-
public function add($questionrecord, array $choicerecords = null, $calcposition = true) {
658+
public function add($questionrecord, ?array $choicerecords = null, ?bool $calcposition = true) {
659659
global $DB;
660660

661661
// Create new question.

classes/question/rate.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,9 +1026,9 @@ public function insert_nameddegrees(array $nameddegrees) {
10261026
* Helper function used to move existing named degree choices for the specified question from the "quest_choice" table to the
10271027
* "question" table.
10281028
* @param int $qid
1029-
* @param null|\stdClass $questionrec
1029+
* @param \stdClass|null $questionrec
10301030
*/
1031-
public static function move_nameddegree_choices(int $qid = 0, \stdClass $questionrec = null) {
1031+
public static function move_nameddegree_choices(int $qid = 0, ?\stdClass $questionrec = null) {
10321032
global $DB;
10331033

10341034
if ($qid !== 0) {
@@ -1079,7 +1079,7 @@ public static function move_nameddegree_choices(int $qid = 0, \stdClass $questio
10791079
* questionnaire before '2018110103'.
10801080
* @param int|null $surveyid
10811081
*/
1082-
public static function move_all_nameddegree_choices(int $surveyid = null) {
1082+
public static function move_all_nameddegree_choices(?int $surveyid = null) {
10831083
global $DB;
10841084

10851085
// This operation might take a while. Cancel PHP timeouts for this.

classes/responsetype/responsetype.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ abstract class responsetype {
4545
* responsetype constructor.
4646
* @param \mod_questionnaire\question\question $question
4747
* @param int|null $responseid
48-
* @param array $choices
48+
* @param array|null $choices
4949
*/
50-
public function __construct(\mod_questionnaire\question\question $question, int $responseid = null, array $choices = []) {
50+
public function __construct(\mod_questionnaire\question\question $question, ?int $responseid = null, ?array $choices = []) {
5151
$this->question = $question;
5252
$this->responseid = $responseid;
5353
$this->choices = $choices;

questionnaire.class.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4216,9 +4216,9 @@ public static function get_user_identity_fields($context, $userid) {
42164216
}
42174217

42184218
/**
4219-
* Output the questionnair information.
4219+
* Output the questionnaire information.
42204220
*
4221-
* @param array $messages any access messages that should be described.
4221+
* @return string
42224222
*/
42234223
public function view_information() {
42244224
$messages = [];

tests/behat/behat_mod_questionnaire.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ private function add_response_data($qid, $sid) {
418418
* to replace with mapped values.
419419
* @return null
420420
*/
421-
private function add_data(array $data, $datatable, $mapvar = '', array $replvars = null) {
421+
private function add_data(array $data, $datatable, $mapvar = '', ?array $replvars = null) {
422422
global $DB;
423423

424424
if ($replvars === null) {

tests/custom_completion_test.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class custom_completion_test extends \advanced_testcase {
5151
*
5252
* @return array[]
5353
*/
54-
public function get_state_provider(): array {
54+
public static function get_state_provider(): array {
5555
return [
5656
'Undefined rule' => [
5757
'somenonexistentrule', COMPLETION_DISABLED, false, null, coding_exception::class
@@ -75,7 +75,7 @@ public function get_state_provider(): array {
7575
* @dataProvider get_state_provider
7676
* @param string $rule The custom completion rule.
7777
* @param int $available Whether this rule is available.
78-
* @param bool $submitted
78+
* @param bool|null $submitted
7979
* @param int|null $status Expected status.
8080
* @param string|null $exception Expected exception.
8181
* @throws coding_exception
@@ -178,7 +178,7 @@ public function test_is_defined() {
178178
*
179179
* @return array[]
180180
*/
181-
public function get_available_custom_rules_provider(): array {
181+
public static function get_available_custom_rules_provider(): array {
182182
return [
183183
'Completion submit available' => [
184184
COMPLETION_ENABLED, ['completionsubmit']

tests/generator/lib.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@ public function questionnaires() {
7676
/**
7777
* Create a questionnaire activity.
7878
* @param array $record Will be changed in this function.
79-
* @param array $options
79+
* @param array|null $options
8080
* @return questionnaire
8181
*/
82-
public function create_instance($record = null, array $options = null) {
82+
public function create_instance($record = null, ?array $options = null) {
8383
$record = (object)(array)$record;
8484

8585
$defaultquestionnairesettings = array(

0 commit comments

Comments
 (0)