Skip to content

Commit 9caa3f4

Browse files
committed
Resolved implicitly marking parameter as nullable deprecation
1 parent 4f920aa commit 9caa3f4

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

classes/question/question.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -653,9 +653,9 @@ public function update($questionrecord = null, $updatechoices = true) {
653653
* Add the question to the database from supplied arguments.
654654
* @param \stdClass $questionrecord The required data for adding the question.
655655
* @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.
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;

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/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)