mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 17:06:53 +02:00
MDL-72321 question: Ensure that all instance props are defined
Since PHP 8.2, all properties on a class must be defined as the PHP Dynamic Property feature has been deprecated. This commit goes one step further and switches this class to using constructor property promotion. This language feature has been available since PHP 8.0 and allows for simplified creation of class properties which are initially defined in the constructor.
This commit is contained in:
parent
b36bc08686
commit
47cc73fe1a
1 changed files with 15 additions and 44 deletions
|
@ -30,41 +30,19 @@ use stdClass;
|
||||||
*/
|
*/
|
||||||
class question_bank_filter_ui extends datafilter {
|
class question_bank_filter_ui extends datafilter {
|
||||||
|
|
||||||
/** @var array $searchconditions Searchconditions for the filter. */
|
|
||||||
protected $searchconditions = array();
|
|
||||||
|
|
||||||
/** @var int $perpage number of records per page. */
|
/** @var int $perpage number of records per page. */
|
||||||
protected $perpage = 0;
|
protected $perpage = 0;
|
||||||
|
|
||||||
/**
|
/** @var array Parameters for the page URL. */
|
||||||
* @var string Component for calling the fragment callback.
|
|
||||||
*/
|
|
||||||
protected $component;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string Fragment callback.
|
|
||||||
*/
|
|
||||||
protected $callback;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string View class name.
|
|
||||||
*/
|
|
||||||
protected $view;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var int|null if in an activity, the cmid.
|
|
||||||
*/
|
|
||||||
protected $cmid;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var array Parameters for the page URL.
|
|
||||||
*/
|
|
||||||
protected $pagevars;
|
protected $pagevars;
|
||||||
|
|
||||||
/**
|
/** @var array $searchconditions Searchconditions for the filter. */
|
||||||
* @var array Additional parameters used by view classes.
|
/** @var array $additionalparams Conditino objects for the current filter. */
|
||||||
*/
|
/** @var string $component Component for calling the fragment callback. */
|
||||||
protected $extraparams;
|
/** @var string $callback Fragment callback. */
|
||||||
|
/** @var string $view View class name. */
|
||||||
|
/** @var int|null $cmid if in an activity, the cmid. */
|
||||||
|
/** @var array $extraparams Additional parameters used by view classes. */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new datafilter
|
* Create a new datafilter
|
||||||
|
@ -82,24 +60,17 @@ class question_bank_filter_ui extends datafilter {
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
\context $context,
|
\context $context,
|
||||||
array $searchconditions,
|
protected array $searchconditions,
|
||||||
array $additionalparams,
|
protected array $additionalparams,
|
||||||
string $component,
|
protected string $component,
|
||||||
string $callback,
|
protected string $callback,
|
||||||
string $view,
|
protected string $view,
|
||||||
?string $tableregionid = null,
|
?string $tableregionid = null,
|
||||||
?int $cmid = null,
|
protected ?int $cmid = null,
|
||||||
array $pagevars = [],
|
array $pagevars = [],
|
||||||
array $extraparams = []
|
protected array $extraparams = []
|
||||||
) {
|
) {
|
||||||
parent::__construct($context, $tableregionid);
|
parent::__construct($context, $tableregionid);
|
||||||
$this->searchconditions = $searchconditions;
|
|
||||||
$this->additionalparams = $additionalparams;
|
|
||||||
$this->component = $component;
|
|
||||||
$this->callback = $callback;
|
|
||||||
$this->view = $view;
|
|
||||||
$this->cmid = $cmid;
|
|
||||||
$this->extraparams = $extraparams;
|
|
||||||
if (array_key_exists('sortData', $pagevars)) {
|
if (array_key_exists('sortData', $pagevars)) {
|
||||||
foreach ($pagevars['sortData'] as $sortname => $sortorder) {
|
foreach ($pagevars['sortData'] as $sortname => $sortorder) {
|
||||||
unset($pagevars['sortData'][$sortname]);
|
unset($pagevars['sortData'][$sortname]);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue