MDL-77343 mod_assign: Added missing class properties.

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.
This commit is contained in:
Meirza 2023-03-15 14:30:47 +07:00
parent 12a8176926
commit 29d20be214
11 changed files with 44 additions and 2 deletions

View File

@ -98,6 +98,8 @@ class assign_submission_status implements \renderable {
public $usergroups = array();
/** @var int The time limit for the assignment */
public $timelimit = 0;
/** @var bool */
public $caneditowner;
/**
* Constructor

View File

@ -56,6 +56,11 @@ class grading_app implements templatable, renderable {
*/
public $assignment = null;
/**
* @var array - List of user records with extra fields.
*/
public $participants = [];
/**
* Constructor for this renderable.
*

View File

@ -39,6 +39,9 @@ use \mod_assign\output\grading_app;
*/
class renderer extends \plugin_renderer_base {
/** @var string a unique ID. */
public $htmlid;
/**
* Rendering assignment files
*

View File

@ -63,6 +63,9 @@ class annotation {
/** @var string type - One of line, oval, rect, etc */
public $type = 'line';
/** @var int draft status, default 1 = true */
public $draft = 1;
/**
* Convert a compatible stdClass into an instance of this class.
* @param stdClass $record

View File

@ -55,6 +55,9 @@ class comment {
/** @var string colour - One of red, yellow, green, blue, white */
public $colour = 'yellow';
/** @var int draft status, default 1 = true */
public $draft = 1;
/**
* Convert a compatible stdClass into an instance of a comment.
* @param \stdClass $record

View File

@ -283,7 +283,10 @@ class assign_feedback_editpdf extends assign_feedback_plugin {
foreach ($nondraftannotations as $ndannotation) {
foreach ($draftannotations as $dannotation) {
foreach ($ndannotation as $key => $value) {
if ($key != 'id' && $value != $dannotation->{$key}) {
// As the $draft was included in the class annotation,
// it is necessary to omit it in the condition below as well,
// otherwise, an error would be raised.
if ($key != 'id' && $key != 'draft' && $value != $dannotation->{$key}) {
continue 2;
}
}
@ -305,7 +308,10 @@ class assign_feedback_editpdf extends assign_feedback_plugin {
foreach ($nondraftcomments as $ndcomment) {
foreach ($draftcomments as $dcomment) {
foreach ($ndcomment as $key => $value) {
if ($key != 'id' && $value != $dcomment->{$key}) {
// As the $draft was included in the class comment,
// it is necessary to omit it in the condition below as well,
// otherwise, an error would be raised.
if ($key != 'id' && $key != 'draft' && $value != $dcomment->{$key}) {
continue 2;
}
}

View File

@ -64,6 +64,8 @@ class assign_grading_table extends table_sql implements renderable {
private $plugincache = array();
/** @var array $scale - A list of the keys and descriptions for the custom scale */
private $scale = null;
/** @var bool true if the user has this capability. Otherwise false. */
private $hasviewblind;
/**
* overridden constructor keeps a reference to the assignment class that is displaying this table

View File

@ -195,6 +195,9 @@ class assign {
/** @var mixed This var can vary between false for no overrides to a stdClass of the overrides for a group */
private $overridedata;
/** @var float grade value. */
public $grade;
/**
* Constructor for the base assign class.
*

View File

@ -69,6 +69,8 @@ class assign_gradingmessage implements renderable {
public $coursemoduleid = 0;
/** @var int $gradingerror should be set true if there was a problem grading */
public $gradingerror = null;
/** @var int the grading page. */
public $page;
/**
* Constructor
@ -293,6 +295,8 @@ class assign_feedback_status implements renderable {
public $canviewfullnames = false;
/** @var string gradingcontrollergrade The grade information rendered by a grade controller */
public $gradingcontrollergrade;
/** @var array information for the given plugins. */
public $plugins = [];
/**
* Constructor
@ -424,6 +428,8 @@ class assign_attempt_history_chooser implements renderable, templatable {
public $coursemoduleid = 0;
/** @var int userid - The current userid */
public $userid = 0;
/** @var int submission count */
public $submissioncount;
/**
* Constructor

View File

@ -46,6 +46,12 @@ class locallib_test extends \advanced_testcase {
// Use the generator helper.
use mod_assign_test_generator;
/** @var array */
public $extrastudents;
/** @var array */
public $extrasuspendedstudents;
public function test_return_links() {
global $PAGE;

View File

@ -32,6 +32,9 @@ require_once($CFG->dirroot . '/course/lib.php');
*/
class markerallocation_test extends \advanced_testcase {
/** @var \stdClass course record. */
private $course;
/**
* Create all the needed elements to test the difference between both functions.
*/