MDL-75548 misc: final Required parameter follows optional notices

This commit is contained in:
Tim Hunt 2022-08-22 15:01:02 +01:00
parent 17ee072693
commit 797b9fbd62
18 changed files with 48 additions and 48 deletions

View File

@ -323,7 +323,7 @@ class accessibility {
/** /**
* This function runs one specified check on the html item * 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 $contentid The content area ID
* @param int $errid The error ID * @param int $errid The error ID
* @param string $check The check name to run * @param string $check The check name to run
@ -333,7 +333,7 @@ class accessibility {
* @throws \dml_exception * @throws \dml_exception
*/ */
public static function run_one_check( public static function run_one_check(
string $html = null, ?string $html,
int $contentid, int $contentid,
int $errid, int $errid,
string $check, string $check,

View File

@ -482,13 +482,13 @@ class tree extends tree_node {
* *
* @param bool $not True if there is a NOT in effect * @param bool $not True if there is a NOT in effect
* @param info $info Information about location of condition tree * @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 $root True if this is the root item
* @param bool $hidden Staff display; true if this tree has show=false (from parent) * @param bool $hidden Staff display; true if this tree has show=false (from parent)
* @return string|renderable Information to render * @return string|renderable Information to render
*/ */
protected function get_full_information_recursive( 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. // Get list of children - either full list, or those which are shown.
$children = $this->children; $children = $this->children;
$staff = true; $staff = true;

View File

@ -118,16 +118,16 @@ class event implements event_interface {
* @param int $id The event's ID in the database. * @param int $id The event's ID in the database.
* @param string $name The event's name. * @param string $name The event's name.
* @param description_interface $description The event's description. * @param description_interface $description The event's description.
* @param proxy_interface $category The category associated with the event. * @param proxy_interface|null $category The category associated with the event.
* @param proxy_interface $course The course associated with the event. * @param proxy_interface|null $course The course associated with the event.
* @param proxy_interface $group The group associated with the event. * @param proxy_interface|null $group The group associated with the event.
* @param proxy_interface $user The user associated with the event. * @param proxy_interface|null $user The user associated with the event.
* @param event_collection_interface $repeats Collection of repeat events. * @param event_collection_interface|null $repeats Collection of repeat events.
* @param proxy_interface $coursemodule The course module that created the event. * @param proxy_interface|null $coursemodule The course module that created the event.
* @param string $type The event's type. * @param string $type The event's type.
* @param times_interface $times The times associated with the event. * @param times_interface $times The times associated with the event.
* @param bool $visible The event's visibility. True for visible, false for invisible. * @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 $location The event's location.
* @param string $component The event's component. * @param string $component The event's component.
*/ */
@ -135,12 +135,12 @@ class event implements event_interface {
$id, $id,
$name, $name,
description_interface $description, description_interface $description,
proxy_interface $category = null, ?proxy_interface $category,
proxy_interface $course = null, ?proxy_interface $course,
proxy_interface $group = null, ?proxy_interface $group,
proxy_interface $user = null, ?proxy_interface $user,
event_collection_interface $repeats = null, ?event_collection_interface $repeats,
proxy_interface $coursemodule = null, ?proxy_interface $coursemodule,
$type, $type,
times_interface $times, times_interface $times,
$visible, $visible,

View File

@ -69,10 +69,10 @@ class bankcontent implements renderable, templatable {
* *
* @param \core_contentbank\content[] $contents Array of content bank contents. * @param \core_contentbank\content[] $contents Array of content bank contents.
* @param array $toolbar List of content bank toolbar options. * @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. * @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->contents = $contents;
$this->toolbar = $toolbar; $this->toolbar = $toolbar;
$this->context = $context; $this->context = $context;

View File

@ -415,12 +415,12 @@ abstract class moodle_database {
/** /**
* This should be called before each db query. * This should be called before each db query.
* @param string $sql The query string. * @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 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. * @param mixed $extrainfo This is here for any driver specific extra information.
* @return void * @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) { if ($this->loggingquery) {
return; return;
} }

View File

@ -262,12 +262,12 @@ trait moodle_read_slave_trait {
/** /**
* Called before each db query. * Called before each db query.
* @param string $sql * @param string $sql
* @param array $params array of parameters * @param array|null $params An array of parameters.
* @param int $type type of query * @param int $type type of query
* @param mixed $extrainfo driver specific extra information * @param mixed $extrainfo driver specific extra information
* @return void * @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); parent::query_start($sql, $params, $type, $extrainfo);
$this->select_db_handle($type, $sql); $this->select_db_handle($type, $sql);
} }

View File

@ -245,12 +245,12 @@ class oci_native_moodle_database extends moodle_database {
/** /**
* Called before each db query. * Called before each db query.
* @param string $sql * @param string $sql
* @param array array of parameters * @param array|null $params An array of parameters.
* @param int $type type of query * @param int $type type of query
* @param mixed $extrainfo driver specific extra information * @param mixed $extrainfo driver specific extra information
* @return void * @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); parent::query_start($sql, $params, $type, $extrainfo);
// oci driver tents to send debug to output, we do not need that ;-) // oci driver tents to send debug to output, we do not need that ;-)
$this->last_error_reporting = error_reporting(0); $this->last_error_reporting = error_reporting(0);

View File

@ -614,12 +614,12 @@ abstract class pdo_moodle_database extends moodle_database {
* Overridden to ensure $this->lastErorr is reset each query * Overridden to ensure $this->lastErorr is reset each query
* *
* @param string $sql * @param string $sql
* @param array array of parameters * @param array|null $params An array of parameters.
* @param int $type type of query * @param int $type type of query
* @param mixed $extrainfo driver specific extra information * @param mixed $extrainfo driver specific extra information
* @return void * @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; $this->lastError = null;
parent::query_start($sql, $params, $type, $extrainfo); parent::query_start($sql, $params, $type, $extrainfo);
} }

View File

@ -315,12 +315,12 @@ class pgsql_native_moodle_database extends moodle_database {
/** /**
* Called before each db query. * Called before each db query.
* @param string $sql * @param string $sql
* @param array array of parameters * @param array|null $params An array of parameters.
* @param int $type type of query * @param int $type type of query
* @param mixed $extrainfo driver specific extra information * @param mixed $extrainfo driver specific extra information
* @return void * @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); $this->read_slave_query_start($sql, $params, $type, $extrainfo);
// pgsql driver tends to send debug to output, we do not need that. // pgsql driver tends to send debug to output, we do not need that.
$this->last_error_reporting = error_reporting(0); $this->last_error_reporting = error_reporting(0);

View File

@ -306,12 +306,12 @@ class sqlsrv_native_moodle_database extends moodle_database {
/** /**
* Called before each db query. * Called before each db query.
* @param string $sql * @param string $sql
* @param array $params array of parameters * @param array|null $params An array of parameters.
* @param int $type type of query * @param int $type type of query
* @param mixed $extrainfo driver specific extra information * @param mixed $extrainfo driver specific extra information
* @return void * @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); parent::query_start($sql, $params, $type, $extrainfo);
} }

View File

@ -91,12 +91,12 @@ class read_slave_moodle_database extends test_moodle_database {
/** /**
* Query wrapper that calls query_start() and query_end() * Query wrapper that calls query_start() and query_end()
* @param string $sql * @param string $sql
* @param array $params * @param array|null $params
* @param int $querytype * @param int $querytype
* @param ?callable $callback * @param ?callable $callback
* @return string $handle handle property * @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); $this->query_start($sql, $params, $querytype);
$ret = $this->handle; $ret = $this->handle;
if ($callback) { if ($callback) {

View File

@ -95,11 +95,11 @@ trait test_moodle_read_slave_trait {
/** /**
* Upgrade to public * Upgrade to public
* @param string $sql * @param string $sql
* @param array $params * @param array|null $params
* @param int $type * @param int $type
* @param array $extrainfo * @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); return parent::query_start($sql, $params, $type);
} }

View File

@ -544,12 +544,12 @@ class tgz_packer extends file_packer {
* @param array $expandedfiles List of all files to archive (output) * @param array $expandedfiles List of all files to archive (output)
* @param string $archivepath Current path within archive * @param string $archivepath Current path within archive
* @param string $path OS path on disk * @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 * @param int $done Value for progress indicator
* @return bool True if successful * @return bool True if successful
*/ */
protected function list_files_path(array &$expandedfiles, $archivepath, $path, protected function list_files_path(array &$expandedfiles, $archivepath, $path,
file_progress $progress = null, $done) { ?file_progress $progress , $done) {
if (is_dir($path)) { if (is_dir($path)) {
// Unless we're using this directory as archive root, add a // Unless we're using this directory as archive root, add a
// directory entry. // directory entry.

View File

@ -786,13 +786,13 @@ function validate_param($param, $type, $allownull=NULL_NOT_ALLOWED, $debuginfo='
* $options = clean_param($options, PARAM_INT); * $options = clean_param($options, PARAM_INT);
* </code> * </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 string $type expected format of param after cleaning.
* @param bool $recursive clean recursive arrays * @param bool $recursive clean recursive arrays
* @return array * @return array
* @throws coding_exception * @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. // Convert null to empty array.
$param = (array)$param; $param = (array)$param;
foreach ($param as $key => $value) { foreach ($param as $key => $value) {

View File

@ -4742,12 +4742,12 @@ class action_menu_link extends action_link implements renderable {
* Constructs the object. * Constructs the object.
* *
* @param moodle_url $url The URL for the action. * @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 string $text The text to represent the action.
* @param bool $primary Whether this is a primary action or not. * @param bool $primary Whether this is a primary action or not.
* @param array $attributes Any attribtues associated with the action. * @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); parent::__construct($url, $text, null, $attributes, $icon);
$this->primary = (bool)$primary; $this->primary = (bool)$primary;
$this->add_class('menu-action'); $this->add_class('menu-action');
@ -4813,11 +4813,11 @@ class action_menu_link_primary extends action_menu_link {
* Constructs the object. * Constructs the object.
* *
* @param moodle_url $url * @param moodle_url $url
* @param pix_icon $icon * @param pix_icon|null $icon
* @param string $text * @param string $text
* @param array $attributes * @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); parent::__construct($url, $icon, $text, true, $attributes);
} }
} }
@ -4835,11 +4835,11 @@ class action_menu_link_secondary extends action_menu_link {
* Constructs the object. * Constructs the object.
* *
* @param moodle_url $url * @param moodle_url $url
* @param pix_icon $icon * @param pix_icon|null $icon
* @param string $text * @param string $text
* @param array $attributes * @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); parent::__construct($url, $icon, $text, false, $attributes);
} }
} }

View File

@ -141,7 +141,7 @@ abstract class base_message extends \core_search\base {
* @return \moodle_recordset|null Recordset or null if no results possible * @return \moodle_recordset|null Recordset or null if no results possible
* @throws \coding_exception If context invalid * @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) { $userfield) {
global $DB; global $DB;

View File

@ -452,7 +452,7 @@ abstract class base {
* @return array Array with SQL and parameters; both null if no need to query * @return array Array with SQL and parameters; both null if no need to query
* @throws \coding_exception If called with invalid params * @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) { $coursetable, $paramtype = SQL_PARAMS_QM) {
global $DB; global $DB;

View File

@ -109,7 +109,7 @@ abstract class base_mod extends base {
* @return array Array with SQL and parameters; both null if no need to query * @return array Array with SQL and parameters; both null if no need to query
* @throws \coding_exception If called with invalid params * @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) { $paramtype = SQL_PARAMS_QM) {
global $DB; global $DB;