Skip to content

Commit 97ff68f

Browse files
committed
MDL-78159 lib: Added missing properties for core libraries
In PHP 8.2 and later, setting a value to an undeclared class property is deprecated and emits a deprecation notice. So we need to add missing class properties that still need to be declared.
1 parent 1b1a15a commit 97ff68f

26 files changed

+152
-28
lines changed

admin/presets/classes/local/setting/adminpresets_admin_setting_configmultiselect.php

+3
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
*/
2727
class adminpresets_admin_setting_configmultiselect extends adminpresets_setting {
2828

29+
/** @var \admin_setting_configmultiselect $settingdata */
30+
protected $settingdata;
31+
2932
/**
3033
* Ensure that the $value values are setting choices.
3134
*

admin/presets/classes/local/setting/adminpresets_admin_setting_configselect.php

+3
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
*/
2727
class adminpresets_admin_setting_configselect extends adminpresets_setting {
2828

29+
/** @var \admin_setting_configselect $settingdata */
30+
protected $settingdata;
31+
2932
/**
3033
* Sets the setting value cleaning it.
3134
*

admin/presets/classes/local/setting/adminpresets_admin_setting_configtime.php

+3
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
*/
2727
class adminpresets_admin_setting_configtime extends adminpresets_setting {
2828

29+
/** @var \admin_setting_configtime $settingdata */
30+
protected $settingdata;
31+
2932
/**
3033
* To check that the value is one of the options
3134
*

admin/presets/classes/local/setting/adminpresets_admin_setting_special_backupdays.php

+3
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
*/
2929
class adminpresets_admin_setting_special_backupdays extends adminpresets_setting {
3030

31+
/** @var \admin_setting_special_backupdays $settingdata */
32+
protected $settingdata;
33+
3134
protected function set_value($value) {
3235
$this->value = clean_param($value, PARAM_SEQUENCE);
3336
$this->set_visiblevalue();

admin/presets/classes/local/setting/adminpresets_admin_setting_users_with_capability.php

+3
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
*/
2727
class adminpresets_admin_setting_users_with_capability extends adminpresets_admin_setting_configmultiselect {
2828

29+
/** @var \admin_setting_configmultiselect $settingdata */
30+
protected $settingdata;
31+
2932
protected function set_behaviors() {
3033
$this->behaviors['loadchoices'] = &$this->settingdata;
3134
}

admin/roles/classes/allow_role_page.php

-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ public function get_table() {
141141
$table->cellspacing = 0;
142142
$table->width = '90%';
143143
$table->align = array('left');
144-
$table->rotateheaders = true;
145144
$table->head = array(' ');
146145
$table->colclasses = array('');
147146

admin/tool/brickfield/classes/output/renderer.php

-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ public function tabs(filter $filter, array $tools): string {
7676
$label = $tool->get_toolshortname();
7777
}
7878
$tab = new tabobject($idprefix . $toolname, $link, $label);
79-
$tab->extraclass = isset($extraclass[$toolname]) ? $extraclass[$toolname] : null;
8079
$tabs[] = $tab;
8180
}
8281
return $this->render(new tabtree($tabs, $idprefix . $filter->tab));

lib/adminlib.php

+9-6
Original file line numberDiff line numberDiff line change
@@ -1738,6 +1738,8 @@ abstract class admin_setting {
17381738
private $dependenton = [];
17391739
/** @var bool Whether this setting uses a custom form control */
17401740
protected $customcontrol = false;
1741+
/** @var mixed int means PARAM_XXX type, string is a allowed format in regex */
1742+
public $paramtype;
17411743

17421744
/**
17431745
* Constructor
@@ -2442,8 +2444,6 @@ public function output_html($data, $query='') {
24422444
*/
24432445
class admin_setting_configtext extends admin_setting {
24442446

2445-
/** @var mixed int means PARAM_XXX type, string is a allowed format in regex */
2446-
public $paramtype;
24472447
/** @var int default field size */
24482448
public $size;
24492449

@@ -3126,11 +3126,12 @@ public function output_html($data, $query='') {
31263126
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
31273127
*/
31283128
class admin_setting_configmulticheckbox extends admin_setting {
3129-
/** @var array Array of choices value=>label */
3130-
public $choices;
31313129
/** @var callable|null Loader function for choices */
31323130
protected $choiceloader = null;
31333131

3132+
/** @var array Array of choices value=>label. */
3133+
public $choices;
3134+
31343135
/**
31353136
* Constructor: uses parent::__construct
31363137
*
@@ -4664,7 +4665,8 @@ public function write_setting($data) {
46644665
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
46654666
*/
46664667
class admin_setting_courselist_frontpage extends admin_setting {
4667-
/** @var array Array of choices value=>label */
4668+
4669+
/** @var array Array of choices value=>label. */
46684670
public $choices;
46694671

46704672
/**
@@ -6260,7 +6262,8 @@ public function output_html($data, $query = '') {
62606262
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
62616263
*/
62626264
class admin_setting_gradecat_combo extends admin_setting {
6263-
/** @var array Array of choices */
6265+
6266+
/** @var array Array of choices value=>label. */
62646267
public $choices;
62656268

62666269
/**

lib/dmllib.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ function __construct($sql='', array $params=null) {
178178
*/
179179
class dml_missing_record_exception extends dml_exception {
180180
/** @var string A table's name.*/
181-
public $table;
181+
public $tablename;
182182
/** @var string An SQL query.*/
183183
public $sql;
184184
/** @var array The SQL's parameters.*/

lib/filelib.php

+5
Original file line numberDiff line numberDiff line change
@@ -3154,6 +3154,8 @@ class curl {
31543154
private $ignoresecurity;
31553155
/** @var array $mockresponses For unit testing only - return the head of this list instead of making the next request. */
31563156
private static $mockresponses = [];
3157+
/** @var array temporary params value if the value is not belongs to class stored_file. */
3158+
public $_tmp_file_post_params = [];
31573159

31583160
/**
31593161
* Curl constructor.
@@ -4261,6 +4263,9 @@ class curl_cache {
42614263
/** @var string Path to cache directory */
42624264
public $dir = '';
42634265

4266+
/** @var int the repositorycacheexpire config value. */
4267+
private $ttl;
4268+
42644269
/**
42654270
* Constructor
42664271
*

lib/filterlib.php

+6
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,12 @@ class filterobject {
496496
/** @var null|string once initialised, holds the mangled HTML to replace the regexp with. */
497497
public $workreplacementphrase = null;
498498

499+
/** @var null|callable hold a replacement function to be called. */
500+
public $replacementcallback;
501+
502+
/** @var null|array data to be passed to $replacementcallback. */
503+
public $replacementcallbackdata;
504+
499505
/**
500506
* Constructor.
501507
*

lib/flickrlib.php

+3-7
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ class phpFlickr {
5757
var $token;
5858
var $php_version;
5959

60+
/** @var curl cURL class. */
61+
private $curl;
62+
6063
/**
6164
* When your database cache table hits this many rows, a cleanup
6265
* will occur to get rid of all of the old rows and cleanup the
@@ -78,7 +81,6 @@ function __construct ($api_key, $secret = NULL, $token = '')
7881
$this->api_key = $api_key;
7982
$this->secret = $secret;
8083
$this->die_on_error = false;
81-
$this->service = "flickr";
8284
$this->token = $token;
8385
//Find the PHP version and store it for future reference
8486
$this->php_version = explode("-", phpversion());
@@ -1134,12 +1136,6 @@ function upload(stored_file $photo, array $meta = array()) {
11341136
// $args['async'] = 1;
11351137
$args['api_key'] = $this->api_key;
11361138

1137-
if (!empty($this->email)) {
1138-
$args['email'] = $this->email;
1139-
}
1140-
if (!empty($this->password)) {
1141-
$args['password'] = $this->password;
1142-
}
11431139
if (!empty($this->token)) {
11441140
$args['auth_token'] = $this->token;
11451141
}

lib/formslib.php

+12
Original file line numberDiff line numberDiff line change
@@ -1682,6 +1682,12 @@ class MoodleQuickForm extends HTML_QuickForm_DHTMLRulesTableless {
16821682
*/
16831683
const DEP_HIDE = 1;
16841684

1685+
/** @var string request class HTML. */
1686+
protected $_reqHTML;
1687+
1688+
/** @var string advanced class HTML. */
1689+
protected $_advancedHTML;
1690+
16851691
/**
16861692
* Class constructor - same parameters as HTML_QuickForm_DHTMLRulesTableless
16871693
*
@@ -3104,6 +3110,12 @@ class MoodleQuickForm_Renderer extends HTML_QuickForm_Renderer_Tableless{
31043110
*/
31053111
var $_collapseButtons = '';
31063112

3113+
/** @var string request class HTML. */
3114+
protected $_reqHTML;
3115+
3116+
/** @var string advanced class HTML. */
3117+
protected $_advancedHTML;
3118+
31073119
/**
31083120
* Constructor
31093121
*/

lib/graphlib.php

+14
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,20 @@ class graph {
154154
var $y_tick_labels = null; // array of text values for y-axis tick labels
155155
var $offset_relation = null; // array of offsets for different sets of data
156156

157+
/** @var array y_order data. */
158+
public $y_order = [];
159+
160+
/** @var array y_format data. */
161+
public $y_format = [];
162+
163+
/** @var array x_data data. */
164+
public $x_data = [];
165+
166+
/** @var array colour. */
167+
public $colour = [];
168+
169+
/** @var array y_data data. */
170+
public $y_data = [];
157171

158172
// init all text - title, labels, and axis text.
159173
function init() {

lib/listlib.php

+3
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ abstract class moodle_list {
7979
public $pageurl;
8080
public $pageparamname;
8181

82+
/** @var int no of top level items. */
83+
private $itemsperpage;
84+
8285
/**
8386
* Constructor.
8487
*

lib/modinfolib.php

+6
Original file line numberDiff line numberDiff line change
@@ -3070,6 +3070,12 @@ class section_info implements IteratorAggregate {
30703070
*/
30713071
private $modinfo;
30723072

3073+
/**
3074+
* True if has activities, otherwise false.
3075+
* @var bool
3076+
*/
3077+
public $hasactivites;
3078+
30733079
/**
30743080
* Constructs object from database information plus extra required data.
30753081
* @param object $data Array entry from cached sectioncache

lib/navigationlib.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,12 @@ class navigation_node implements renderable {
158158
public $showinsecondarynavigation = true;
159159
/** @var bool If set to true the children of this node will be displayed within a submenu when applicable */
160160
public $showchildreninsubmenu = false;
161+
/** @var string tab element ID. */
162+
public $tab;
163+
/** @var string unique identifier. */
164+
public $moremenuid;
165+
/** @var bool node that have children. */
166+
public $haschildren;
161167

162168
/**
163169
* Constructs a new navigation_node
@@ -2279,7 +2285,6 @@ public function load_generic_course_sections(stdClass $course, navigation_node $
22792285
if ($this->includesectionnum !== false && $this->includesectionnum == $section->section) {
22802286
$this->load_section_activities($sectionnode, $section->section, $activities);
22812287
}
2282-
$section->sectionnode = $sectionnode;
22832288
$navigationsections[$sectionid] = $section;
22842289
}
22852290
}

lib/oauthlib.php

+13
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,19 @@ class oauth_helper {
6161
protected $http;
6262
/** @var array options to pass to the next curl request */
6363
protected $http_options;
64+
/** @var moodle_url oauth callback URL. */
65+
protected $oauth_callback;
66+
/** @var string access token. */
67+
protected $access_token;
68+
/** @var string access secret token. */
69+
protected $access_token_secret;
70+
/** @var string sign secret. */
71+
protected $sign_secret;
72+
/** @var string nonce. */
73+
protected $nonce;
74+
/** @var int timestamp. */
75+
protected $timestamp;
76+
6477

6578
/**
6679
* Contructor for oauth_helper.

lib/outputactions.php

+6-7
Original file line numberDiff line numberDiff line change
@@ -170,18 +170,17 @@ class popup_action extends component_action {
170170
*/
171171
public function __construct($event, $url, $name='popup', $params=array()) {
172172
global $CFG;
173-
$this->name = $name;
174173

175174
$url = new moodle_url($url);
176175

177-
if ($this->name) {
178-
$_name = $this->name;
179-
if (($_name = preg_replace("/\s/", '_', $_name)) != $this->name) {
180-
throw new coding_exception('The $name of a popup window shouldn\'t contain spaces - string modified. '. $this->name .' changed to '. $_name);
181-
$this->name = $_name;
176+
if ($name) {
177+
$_name = $name;
178+
if (($_name = preg_replace("/\s/", '_', $_name)) != $name) {
179+
throw new coding_exception('The $name of a popup window shouldn\'t contain spaces - string modified. '. $name .' changed to '. $_name);
180+
$name = $_name;
182181
}
183182
} else {
184-
$this->name = 'popup';
183+
$name = 'popup';
185184
}
186185

187186
foreach ($this->params as $var => $val) {

lib/outputcomponents.php

+6
Original file line numberDiff line numberDiff line change
@@ -1116,6 +1116,9 @@ class single_select implements renderable, templatable {
11161116
*/
11171117
var $helpicon = null;
11181118

1119+
/** @var component_action[] component action. */
1120+
public $actions = [];
1121+
11191122
/**
11201123
* Constructor
11211124
* @param moodle_url $url form action target, includes hidden fields
@@ -2866,6 +2869,9 @@ class html_table {
28662869
/** @var bool Whether to make the table to be scrolled horizontally with ease. Make table responsive across all viewports. */
28672870
public $responsive = true;
28682871

2872+
/** @var string class name to add to this html table. */
2873+
public $class;
2874+
28692875
/**
28702876
* Constructor
28712877
*/

lib/outputlib.php

+25
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,31 @@ class theme_config {
689689
*/
690690
public $activityheaderconfig = [];
691691

692+
/**
693+
* For backward compatibility with old themes.
694+
* BLOCK_ADDBLOCK_POSITION_DEFAULT, BLOCK_ADDBLOCK_POSITION_FLATNAV.
695+
* @var int
696+
*/
697+
public $addblockposition;
698+
699+
/**
700+
* editor_scss file(s) provided by this theme.
701+
* @var array
702+
*/
703+
public $editor_scss;
704+
705+
/**
706+
* Name of the class extending \core\output\icon_system.
707+
* @var string
708+
*/
709+
public $iconsystem;
710+
711+
/**
712+
* Theme defines its own editing mode switch.
713+
* @var bool
714+
*/
715+
public $haseditswitch = false;
716+
692717
/**
693718
* Load the config.php file for a particular theme, and return an instance
694719
* of this class. (That is, this is a factory method.)

lib/outputrequirementslib.php

+6
Original file line numberDiff line numberDiff line change
@@ -1851,6 +1851,12 @@ class YUI_config {
18511851
public $insertBefore = 'firstthemesheet';
18521852
public $groups = array();
18531853
public $modules = array();
1854+
/** @var array The log sources that should be not be logged. */
1855+
public $logInclude = [];
1856+
/** @var array Tog sources that should be logged. */
1857+
public $logExclude = [];
1858+
/** @var string The minimum log level for YUI logging statements. */
1859+
public $logLevel;
18541860

18551861
/**
18561862
* @var array List of functions used by the YUI Loader group pattern recognition.

0 commit comments

Comments
 (0)