MDL-81634 core: Fix all implicitly defined nullables

Note: This does not impact third-party libraries.
This commit is contained in:
Andrew Nicols
2024-08-02 14:11:12 +08:00
parent 8a6e8563fd
commit 024e36be17
391 changed files with 782 additions and 782 deletions
+7 -7
View File
@@ -141,7 +141,7 @@ class pgsql_native_moodle_database extends moodle_database {
* @throws moodle_exception
* @throws dml_connection_exception if error
*/
public function raw_connect(string $dbhost, string $dbuser, string $dbpass, string $dbname, $prefix, array $dboptions=null): bool {
public function raw_connect(string $dbhost, string $dbuser, string $dbpass, string $dbname, $prefix, ?array $dboptions=null): bool {
if ($prefix == '' and !$this->external) {
//Enforce prefixes for everybody but mysql
throw new dml_exception('prefixcannotbeempty', $this->get_dbfamily());
@@ -851,7 +851,7 @@ class pgsql_native_moodle_database extends moodle_database {
* @return bool true
* @throws dml_exception A DML specific exception is thrown for any errors.
*/
public function execute($sql, array $params=null) {
public function execute($sql, ?array $params=null) {
list($sql, $params, $type) = $this->fix_sql_params($sql, $params);
if (strpos($sql, ';') !== false) {
@@ -883,7 +883,7 @@ class pgsql_native_moodle_database extends moodle_database {
* @return moodle_recordset instance
* @throws dml_exception A DML specific exception is thrown for any errors.
*/
public function get_recordset_sql($sql, array $params=null, $limitfrom=0, $limitnum=0) {
public function get_recordset_sql($sql, ?array $params=null, $limitfrom=0, $limitnum=0) {
list($limitfrom, $limitnum) = $this->normalise_limit_from_num($limitfrom, $limitnum);
@@ -1028,7 +1028,7 @@ class pgsql_native_moodle_database extends moodle_database {
* @return array of objects, or empty array if no records were found
* @throws dml_exception A DML specific exception is thrown for any errors.
*/
public function get_records_sql($sql, array $params = null, $limitfrom = 0, $limitnum = 0) {
public function get_records_sql($sql, ?array $params = null, $limitfrom = 0, $limitnum = 0) {
list($limitfrom, $limitnum) = $this->normalise_limit_from_num($limitfrom, $limitnum);
if ($limitnum) {
@@ -1079,7 +1079,7 @@ class pgsql_native_moodle_database extends moodle_database {
* @return array of values
* @throws dml_exception A DML specific exception is thrown for any errors.
*/
public function get_fieldset_sql($sql, array $params=null) {
public function get_fieldset_sql($sql, ?array $params=null) {
list($sql, $params, $type) = $this->fix_sql_params($sql, $params);
$this->query_start($sql, $params, SQL_QUERY_SELECT);
@@ -1405,7 +1405,7 @@ class pgsql_native_moodle_database extends moodle_database {
* @return bool true
* @throws dml_exception A DML specific exception is thrown for any errors.
*/
public function set_field_select($table, $newfield, $newvalue, $select, array $params=null) {
public function set_field_select($table, $newfield, $newvalue, $select, ?array $params=null) {
if ($select) {
$select = "WHERE $select";
@@ -1444,7 +1444,7 @@ class pgsql_native_moodle_database extends moodle_database {
* @return bool true
* @throws dml_exception A DML specific exception is thrown for any errors.
*/
public function delete_records_select($table, $select, array $params=null) {
public function delete_records_select($table, $select, ?array $params=null) {
if ($select) {
$select = "WHERE $select";
}