Skip to content

Commit

Permalink
MDL-75548 misc: final Required parameter follows optional notices
Browse files Browse the repository at this point in the history
  • Loading branch information
timhunt committed Aug 22, 2022
1 parent 17ee072 commit 797b9fb
Show file tree
Hide file tree
Showing 18 changed files with 48 additions and 48 deletions.
4 changes: 2 additions & 2 deletions admin/tool/brickfield/classes/accessibility.php
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ public static function run_check(string $html, int $contentid, int &$processingt
/**
* This function runs one specified check on the html item
*
* @param string $html The html string to be analysed; might be NULL.
* @param string|null $html The html string to be analysed; might be NULL.
* @param int $contentid The content area ID
* @param int $errid The error ID
* @param string $check The check name to run
Expand All @@ -333,7 +333,7 @@ public static function run_check(string $html, int $contentid, int &$processingt
* @throws \dml_exception
*/
public static function run_one_check(
string $html = null,
?string $html,
int $contentid,
int $errid,
string $check,
Expand Down
4 changes: 2 additions & 2 deletions availability/classes/tree.php
Original file line number Diff line number Diff line change
Expand Up @@ -482,13 +482,13 @@ public function get_result_information(info $info, result $result) {
*
* @param bool $not True if there is a NOT in effect
* @param info $info Information about location of condition tree
* @param result $result Result object if this is a student display, else null
* @param result|null $result Result object if this is a student display, else null
* @param bool $root True if this is the root item
* @param bool $hidden Staff display; true if this tree has show=false (from parent)
* @return string|renderable Information to render
*/
protected function get_full_information_recursive(
$not, info $info, result $result = null, $root, $hidden = false) {
$not, info $info, ?result $result, $root, $hidden = false) {
// Get list of children - either full list, or those which are shown.
$children = $this->children;
$staff = true;
Expand Down
26 changes: 13 additions & 13 deletions calendar/classes/local/event/entities/event.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,29 +118,29 @@ class event implements event_interface {
* @param int $id The event's ID in the database.
* @param string $name The event's name.
* @param description_interface $description The event's description.
* @param proxy_interface $category The category associated with the event.
* @param proxy_interface $course The course associated with the event.
* @param proxy_interface $group The group associated with the event.
* @param proxy_interface $user The user associated with the event.
* @param event_collection_interface $repeats Collection of repeat events.
* @param proxy_interface $coursemodule The course module that created the event.
* @param proxy_interface|null $category The category associated with the event.
* @param proxy_interface|null $course The course associated with the event.
* @param proxy_interface|null $group The group associated with the event.
* @param proxy_interface|null $user The user associated with the event.
* @param event_collection_interface|null $repeats Collection of repeat events.
* @param proxy_interface|null $coursemodule The course module that created the event.
* @param string $type The event's type.
* @param times_interface $times The times associated with the event.
* @param bool $visible The event's visibility. True for visible, false for invisible.
* @param proxy_interface $subscription The event's subscription.
* @param proxy_interface|null $subscription The event's subscription.
* @param string $location The event's location.
* @param string $component The event's component.
*/
public function __construct(
$id,
$name,
description_interface $description,
proxy_interface $category = null,
proxy_interface $course = null,
proxy_interface $group = null,
proxy_interface $user = null,
event_collection_interface $repeats = null,
proxy_interface $coursemodule = null,
?proxy_interface $category,
?proxy_interface $course,
?proxy_interface $group,
?proxy_interface $user,
?event_collection_interface $repeats,
?proxy_interface $coursemodule,
$type,
times_interface $times,
$visible,
Expand Down
4 changes: 2 additions & 2 deletions contentbank/classes/output/bankcontent.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ class bankcontent implements renderable, templatable {
*
* @param \core_contentbank\content[] $contents Array of content bank contents.
* @param array $toolbar List of content bank toolbar options.
* @param \context $context Optional context to check (default null)
* @param \context|null $context Optional context to check (default null)
* @param contentbank $cb Contenbank object.
*/
public function __construct(array $contents, array $toolbar, \context $context = null, contentbank $cb) {
public function __construct(array $contents, array $toolbar, ?\context $context, contentbank $cb) {
$this->contents = $contents;
$this->toolbar = $toolbar;
$this->context = $context;
Expand Down
4 changes: 2 additions & 2 deletions lib/dml/moodle_database.php
Original file line number Diff line number Diff line change
Expand Up @@ -415,12 +415,12 @@ public function dispose() {
/**
* This should be called before each db query.
* @param string $sql The query string.
* @param array $params An array of parameters.
* @param array|null $params An array of parameters.
* @param int $type The type of query. ( SQL_QUERY_SELECT | SQL_QUERY_AUX | SQL_QUERY_INSERT | SQL_QUERY_UPDATE | SQL_QUERY_STRUCTURE )
* @param mixed $extrainfo This is here for any driver specific extra information.
* @return void
*/
protected function query_start($sql, array $params=null, $type, $extrainfo=null) {
protected function query_start($sql, ?array $params, $type, $extrainfo=null) {
if ($this->loggingquery) {
return;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/dml/moodle_read_slave_trait.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,12 +262,12 @@ public function start_delegated_transaction() {
/**
* Called before each db query.
* @param string $sql
* @param array $params array of parameters
* @param array|null $params An array of parameters.
* @param int $type type of query
* @param mixed $extrainfo driver specific extra information
* @return void
*/
protected function query_start($sql, array $params = null, $type, $extrainfo = null) {
protected function query_start($sql, ?array $params, $type, $extrainfo = null) {
parent::query_start($sql, $params, $type, $extrainfo);
$this->select_db_handle($type, $sql);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/dml/oci_native_moodle_database.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,12 +245,12 @@ public function dispose() {
/**
* Called before each db query.
* @param string $sql
* @param array array of parameters
* @param array|null $params An array of parameters.
* @param int $type type of query
* @param mixed $extrainfo driver specific extra information
* @return void
*/
protected function query_start($sql, array $params=null, $type, $extrainfo=null) {
protected function query_start($sql, ?array $params, $type, $extrainfo=null) {
parent::query_start($sql, $params, $type, $extrainfo);
// oci driver tents to send debug to output, we do not need that ;-)
$this->last_error_reporting = error_reporting(0);
Expand Down
4 changes: 2 additions & 2 deletions lib/dml/pdo_moodle_database.php
Original file line number Diff line number Diff line change
Expand Up @@ -614,12 +614,12 @@ public function import_record($table, $dataobject) {
* Overridden to ensure $this->lastErorr is reset each query
*
* @param string $sql
* @param array array of parameters
* @param array|null $params An array of parameters.
* @param int $type type of query
* @param mixed $extrainfo driver specific extra information
* @return void
*/
protected function query_start($sql, array $params=null, $type, $extrainfo=null) {
protected function query_start($sql, ?array $params, $type, $extrainfo=null) {
$this->lastError = null;
parent::query_start($sql, $params, $type, $extrainfo);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/dml/pgsql_native_moodle_database.php
Original file line number Diff line number Diff line change
Expand Up @@ -315,12 +315,12 @@ protected function can_use_readonly(int $type, string $sql): bool {
/**
* Called before each db query.
* @param string $sql
* @param array array of parameters
* @param array|null $params An array of parameters.
* @param int $type type of query
* @param mixed $extrainfo driver specific extra information
* @return void
*/
protected function query_start($sql, array $params=null, $type, $extrainfo=null) {
protected function query_start($sql, ?array $params, $type, $extrainfo=null) {
$this->read_slave_query_start($sql, $params, $type, $extrainfo);
// pgsql driver tends to send debug to output, we do not need that.
$this->last_error_reporting = error_reporting(0);
Expand Down
4 changes: 2 additions & 2 deletions lib/dml/sqlsrv_native_moodle_database.php
Original file line number Diff line number Diff line change
Expand Up @@ -306,12 +306,12 @@ public function dispose() {
/**
* Called before each db query.
* @param string $sql
* @param array $params array of parameters
* @param array|null $params An array of parameters.
* @param int $type type of query
* @param mixed $extrainfo driver specific extra information
* @return void
*/
protected function query_start($sql, array $params = null, $type, $extrainfo = null) {
protected function query_start($sql, ?array $params, $type, $extrainfo = null) {
parent::query_start($sql, $params, $type, $extrainfo);
}

Expand Down
4 changes: 2 additions & 2 deletions lib/dml/tests/fixtures/read_slave_moodle_database.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ protected function rollback_transaction() {
/**
* Query wrapper that calls query_start() and query_end()
* @param string $sql
* @param array $params
* @param array|null $params
* @param int $querytype
* @param ?callable $callback
* @return string $handle handle property
*/
public function with_query_start_end($sql, array $params = null, $querytype, $callback = null) {
public function with_query_start_end($sql, ?array $params, $querytype, $callback = null) {
$this->query_start($sql, $params, $querytype);
$ret = $this->handle;
if ($callback) {
Expand Down
4 changes: 2 additions & 2 deletions lib/dml/tests/fixtures/test_moodle_read_slave_trait.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@ public function get_db_handle() {
/**
* Upgrade to public
* @param string $sql
* @param array $params
* @param array|null $params
* @param int $type
* @param array $extrainfo
*/
public function query_start($sql, array $params = null, $type, $extrainfo = null) {
public function query_start($sql, ?array $params, $type, $extrainfo = null) {
return parent::query_start($sql, $params, $type);
}

Expand Down
4 changes: 2 additions & 2 deletions lib/filestorage/tgz_packer.php
Original file line number Diff line number Diff line change
Expand Up @@ -544,12 +544,12 @@ protected static function calculate_checksum($str) {
* @param array $expandedfiles List of all files to archive (output)
* @param string $archivepath Current path within archive
* @param string $path OS path on disk
* @param file_progress $progress Progress indicator or null if none
* @param file_progress|null $progress Progress indicator or null if none
* @param int $done Value for progress indicator
* @return bool True if successful
*/
protected function list_files_path(array &$expandedfiles, $archivepath, $path,
file_progress $progress = null, $done) {
?file_progress $progress , $done) {
if (is_dir($path)) {
// Unless we're using this directory as archive root, add a
// directory entry.
Expand Down
4 changes: 2 additions & 2 deletions lib/moodlelib.php
Original file line number Diff line number Diff line change
Expand Up @@ -786,13 +786,13 @@ function validate_param($param, $type, $allownull=NULL_NOT_ALLOWED, $debuginfo='
* $options = clean_param($options, PARAM_INT);
* </code>
*
* @param array $param the variable array we are cleaning
* @param array|null $param the variable array we are cleaning
* @param string $type expected format of param after cleaning.
* @param bool $recursive clean recursive arrays
* @return array
* @throws coding_exception
*/
function clean_param_array(array $param = null, $type, $recursive = false) {
function clean_param_array(?array $param, $type, $recursive = false) {
// Convert null to empty array.
$param = (array)$param;
foreach ($param as $key => $value) {
Expand Down
12 changes: 6 additions & 6 deletions lib/outputcomponents.php
Original file line number Diff line number Diff line change
Expand Up @@ -4742,12 +4742,12 @@ class action_menu_link extends action_link implements renderable {
* Constructs the object.
*
* @param moodle_url $url The URL for the action.
* @param pix_icon $icon The icon to represent the action.
* @param pix_icon|null $icon The icon to represent the action.
* @param string $text The text to represent the action.
* @param bool $primary Whether this is a primary action or not.
* @param array $attributes Any attribtues associated with the action.
*/
public function __construct(moodle_url $url, pix_icon $icon = null, $text, $primary = true, array $attributes = array()) {
public function __construct(moodle_url $url, ?pix_icon $icon, $text, $primary = true, array $attributes = array()) {
parent::__construct($url, $text, null, $attributes, $icon);
$this->primary = (bool)$primary;
$this->add_class('menu-action');
Expand Down Expand Up @@ -4813,11 +4813,11 @@ class action_menu_link_primary extends action_menu_link {
* Constructs the object.
*
* @param moodle_url $url
* @param pix_icon $icon
* @param pix_icon|null $icon
* @param string $text
* @param array $attributes
*/
public function __construct(moodle_url $url, pix_icon $icon = null, $text, array $attributes = array()) {
public function __construct(moodle_url $url, ?pix_icon $icon, $text, array $attributes = array()) {
parent::__construct($url, $icon, $text, true, $attributes);
}
}
Expand All @@ -4835,11 +4835,11 @@ class action_menu_link_secondary extends action_menu_link {
* Constructs the object.
*
* @param moodle_url $url
* @param pix_icon $icon
* @param pix_icon|null $icon
* @param string $text
* @param array $attributes
*/
public function __construct(moodle_url $url, pix_icon $icon = null, $text, array $attributes = array()) {
public function __construct(moodle_url $url, ?pix_icon $icon, $text, array $attributes = array()) {
parent::__construct($url, $icon, $text, false, $attributes);
}
}
Expand Down
2 changes: 1 addition & 1 deletion message/classes/search/base_message.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ protected function get_current_other_users($doc) {
* @return \moodle_recordset|null Recordset or null if no results possible
* @throws \coding_exception If context invalid
*/
protected function get_document_recordset_helper($modifiedfrom, \context $context = null,
protected function get_document_recordset_helper($modifiedfrom, ?\context $context,
$userfield) {
global $DB;

Expand Down
2 changes: 1 addition & 1 deletion search/classes/base.php
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ abstract public function get_context_url(\core_search\document $doc);
* @return array Array with SQL and parameters; both null if no need to query
* @throws \coding_exception If called with invalid params
*/
protected function get_course_level_context_restriction_sql(\context $context = null,
protected function get_course_level_context_restriction_sql(?\context $context,
$coursetable, $paramtype = SQL_PARAMS_QM) {
global $DB;

Expand Down
2 changes: 1 addition & 1 deletion search/classes/base_mod.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ protected function get_cm($modulename, $instanceid, $courseid) {
* @return array Array with SQL and parameters; both null if no need to query
* @throws \coding_exception If called with invalid params
*/
protected function get_context_restriction_sql(\context $context = null, $modname, $modtable,
protected function get_context_restriction_sql(?\context $context, $modname, $modtable,
$paramtype = SQL_PARAMS_QM) {
global $DB;

Expand Down

0 comments on commit 797b9fb

Please sign in to comment.