MDL-52081 forms: Use __construct() for constructors
This commit is contained in:
@@ -80,9 +80,8 @@ class HTML_QuickForm_element extends HTML_Common
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function HTML_QuickForm_element($elementName=null, $elementLabel=null, $attributes=null)
|
||||
{
|
||||
HTML_Common::HTML_Common($attributes);
|
||||
public function __construct($elementName=null, $elementLabel=null, $attributes=null) {
|
||||
parent::__construct($attributes);
|
||||
if (isset($elementName)) {
|
||||
$this->setName($elementName);
|
||||
}
|
||||
@@ -90,6 +89,16 @@ class HTML_QuickForm_element extends HTML_Common
|
||||
$this->setLabel($elementLabel);
|
||||
}
|
||||
} //end constructor
|
||||
|
||||
/**
|
||||
* Old syntax of class constructor. Deprecated in PHP7.
|
||||
*
|
||||
* @deprecated since Moodle 3.1
|
||||
*/
|
||||
public function HTML_QuickForm_element($elementName=null, $elementLabel=null, $attributes=null) {
|
||||
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
|
||||
self::__construct($elementName, $elementLabel, $attributes);
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ apiVersion()
|
||||
@@ -359,8 +368,7 @@ class HTML_QuickForm_element extends HTML_Common
|
||||
{
|
||||
switch ($event) {
|
||||
case 'createElement':
|
||||
$className = get_class($this);
|
||||
$this->$className($arg[0], $arg[1], $arg[2], $arg[3], $arg[4]);
|
||||
static::__construct($arg[0], $arg[1], $arg[2], $arg[3], $arg[4]);
|
||||
break;
|
||||
case 'addElement':
|
||||
$this->onQuickFormEvent('createElement', $arg, $caller);
|
||||
|
||||
Reference in New Issue
Block a user