MDL-77348 mod_lti: 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.

While working on this issue, even though it's not related to the deprecation issue,
I added 'use core_external\external_api' to avoid the 'Undefined type external_api' warning at
mod_lti_testcase::generate_tool_proxy().
This commit is contained in:
Meirza 2023-02-08 17:44:40 +07:00
parent 52f512e5cf
commit 67e583783c
6 changed files with 19 additions and 4 deletions

View File

@ -81,6 +81,9 @@ class OAuthConsumer {
public $key;
public $secret;
/** @var string|null callback URL. */
public ?string $callback_url;
function __construct($key, $secret, $callback_url = null) {
$this->key = $key;
$this->secret = $secret;

View File

@ -40,6 +40,12 @@ use stdClass;
*/
class registration_upgrade_choice_page implements renderable, templatable {
/** @var array array of tools. */
protected array $tools = [];
/** @var string tool URL. */
protected string $startregurl;
/**
* Constructor
*

View File

@ -48,6 +48,12 @@ use stdClass;
*/
class repost_crosssite_page implements renderable, templatable {
/** @var array POST params. */
protected $params;
/** @var string URL to repost to. */
protected string $url;
/**
* Constructor
*

View File

@ -76,8 +76,6 @@ class mod_lti_mod_form extends moodleform_mod {
$showtypes = !$typeid;
}
$this->typeid = 0;
$mform =& $this->_form;
// Adding the "general" fieldset, where all the common settings are shown.

View File

@ -302,7 +302,7 @@ class gradebookservices_test extends \advanced_testcase {
$this->assertEquals(!empty($subreviewurl), isset($lineitem->submissionReview));
if ($subreviewurl) {
if ($subreviewurl == 'DEFAULT') {
$this->assertFalse(isset($this->submissionReview->url));
$this->assertFalse(isset($lineitem->submissionReview->url));
} else {
$this->assertEquals($subreviewurl, $lineitem->submissionReview->url);
}
@ -310,7 +310,7 @@ class gradebookservices_test extends \advanced_testcase {
$custom = $lineitem->submissionReview->custom;
$this->assertEquals($subreviewparams, join("\n", array_map(fn($k) => $k.'='.$custom[$k], array_keys($custom))));
} else {
$this->assertFalse(isset($this->submissionReview->custom));
$this->assertFalse(isset($lineitem->submissionReview->custom));
}
}

View File

@ -14,6 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
use core_external\external_api;
defined('MOODLE_INTERNAL') || die();
global $CFG;