diff --git a/admin/tool/brickfield/classes/accessibility.php b/admin/tool/brickfield/classes/accessibility.php index 877511ff649..35f3510b9e8 100644 --- a/admin/tool/brickfield/classes/accessibility.php +++ b/admin/tool/brickfield/classes/accessibility.php @@ -323,7 +323,7 @@ class accessibility { /** * 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 @@ -333,7 +333,7 @@ class accessibility { * @throws \dml_exception */ public static function run_one_check( - string $html = null, + ?string $html, int $contentid, int $errid, string $check, diff --git a/availability/classes/tree.php b/availability/classes/tree.php index 6f5d08b3711..36e759e763a 100644 --- a/availability/classes/tree.php +++ b/availability/classes/tree.php @@ -482,13 +482,13 @@ class tree extends tree_node { * * @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; diff --git a/calendar/classes/local/event/entities/event.php b/calendar/classes/local/event/entities/event.php index b3a7c748768..b0f3f428b14 100644 --- a/calendar/classes/local/event/entities/event.php +++ b/calendar/classes/local/event/entities/event.php @@ -118,16 +118,16 @@ 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. */ @@ -135,12 +135,12 @@ class event implements event_interface { $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, diff --git a/contentbank/classes/output/bankcontent.php b/contentbank/classes/output/bankcontent.php index a595f195c16..a2dfb0e0d20 100644 --- a/contentbank/classes/output/bankcontent.php +++ b/contentbank/classes/output/bankcontent.php @@ -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; diff --git a/lib/dml/moodle_database.php b/lib/dml/moodle_database.php index f9f7aada275..8d1f0351056 100644 --- a/lib/dml/moodle_database.php +++ b/lib/dml/moodle_database.php @@ -415,12 +415,12 @@ abstract class moodle_database { /** * 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; } diff --git a/lib/dml/moodle_read_slave_trait.php b/lib/dml/moodle_read_slave_trait.php index 7f06e5efb8d..7a2da7d134c 100644 --- a/lib/dml/moodle_read_slave_trait.php +++ b/lib/dml/moodle_read_slave_trait.php @@ -262,12 +262,12 @@ trait moodle_read_slave_trait { /** * 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); } diff --git a/lib/dml/oci_native_moodle_database.php b/lib/dml/oci_native_moodle_database.php index 06e6b3a8d45..22816826f91 100644 --- a/lib/dml/oci_native_moodle_database.php +++ b/lib/dml/oci_native_moodle_database.php @@ -245,12 +245,12 @@ class oci_native_moodle_database extends moodle_database { /** * 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); diff --git a/lib/dml/pdo_moodle_database.php b/lib/dml/pdo_moodle_database.php index 2a0989fd583..ba20e29de12 100644 --- a/lib/dml/pdo_moodle_database.php +++ b/lib/dml/pdo_moodle_database.php @@ -614,12 +614,12 @@ abstract class pdo_moodle_database extends moodle_database { * 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); } diff --git a/lib/dml/pgsql_native_moodle_database.php b/lib/dml/pgsql_native_moodle_database.php index ba0abe1d1b1..8fde868843a 100644 --- a/lib/dml/pgsql_native_moodle_database.php +++ b/lib/dml/pgsql_native_moodle_database.php @@ -315,12 +315,12 @@ class pgsql_native_moodle_database extends moodle_database { /** * 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); diff --git a/lib/dml/sqlsrv_native_moodle_database.php b/lib/dml/sqlsrv_native_moodle_database.php index 55ad90ab49a..37a1d9fe4ba 100644 --- a/lib/dml/sqlsrv_native_moodle_database.php +++ b/lib/dml/sqlsrv_native_moodle_database.php @@ -306,12 +306,12 @@ class sqlsrv_native_moodle_database extends moodle_database { /** * 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); } diff --git a/lib/dml/tests/fixtures/read_slave_moodle_database.php b/lib/dml/tests/fixtures/read_slave_moodle_database.php index 7659854c7b3..ecf5d572b7c 100644 --- a/lib/dml/tests/fixtures/read_slave_moodle_database.php +++ b/lib/dml/tests/fixtures/read_slave_moodle_database.php @@ -91,12 +91,12 @@ class read_slave_moodle_database extends test_moodle_database { /** * 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) { diff --git a/lib/dml/tests/fixtures/test_moodle_read_slave_trait.php b/lib/dml/tests/fixtures/test_moodle_read_slave_trait.php index 6172c3c174e..1d9d6639156 100644 --- a/lib/dml/tests/fixtures/test_moodle_read_slave_trait.php +++ b/lib/dml/tests/fixtures/test_moodle_read_slave_trait.php @@ -95,11 +95,11 @@ trait test_moodle_read_slave_trait { /** * 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); } diff --git a/lib/filestorage/tgz_packer.php b/lib/filestorage/tgz_packer.php index 23a8cd3c64e..2d67ade7b10 100644 --- a/lib/filestorage/tgz_packer.php +++ b/lib/filestorage/tgz_packer.php @@ -544,12 +544,12 @@ class tgz_packer extends file_packer { * @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. diff --git a/lib/moodlelib.php b/lib/moodlelib.php index d555ca6f7a8..5f57ce8869b 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -786,13 +786,13 @@ function validate_param($param, $type, $allownull=NULL_NOT_ALLOWED, $debuginfo=' * $options = clean_param($options, PARAM_INT); * * - * @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) { diff --git a/lib/outputcomponents.php b/lib/outputcomponents.php index f1b6caa0d5a..925f2f49b0b 100644 --- a/lib/outputcomponents.php +++ b/lib/outputcomponents.php @@ -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'); @@ -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); } } @@ -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); } } diff --git a/message/classes/search/base_message.php b/message/classes/search/base_message.php index a4aa6fe125d..bcb7dd882bf 100644 --- a/message/classes/search/base_message.php +++ b/message/classes/search/base_message.php @@ -141,7 +141,7 @@ abstract class base_message extends \core_search\base { * @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; diff --git a/search/classes/base.php b/search/classes/base.php index 78c1fe25186..c3678125ff1 100644 --- a/search/classes/base.php +++ b/search/classes/base.php @@ -452,7 +452,7 @@ abstract class base { * @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; diff --git a/search/classes/base_mod.php b/search/classes/base_mod.php index 6015f86d3e5..2f638b849dc 100644 --- a/search/classes/base_mod.php +++ b/search/classes/base_mod.php @@ -109,7 +109,7 @@ abstract class base_mod extends base { * @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;