MDL-75952 general: Since php81, refection->setAccessible() is no-op
Refereces: - https://wiki.php.net/rfc/make-reflection-setaccessible-no-op - https://www.php.net/manual/en/reflectionproperty.setaccessible.php - https://www.php.net/manual/en/reflectionmethod.setaccessible.php As of PHP 8.1.0, calling this method has no effect; all methods are invokable by default. So, let's remove all uses from core, they are no-op.
This commit is contained in:
@@ -966,7 +966,6 @@ class completionlib_test extends advanced_testcase {
|
||||
$completioninfo = new completion_info($this->course);
|
||||
|
||||
$method = new ReflectionMethod("completion_info", "get_other_cm_completion_data");
|
||||
$method->setAccessible(true);
|
||||
|
||||
// Check that fetching data for a module with custom completion provides its info.
|
||||
$choicecompletiondata = $method->invoke($completioninfo, $cmchoice, $user->id);
|
||||
@@ -1813,7 +1812,6 @@ class completionlib_test extends advanced_testcase {
|
||||
|
||||
// We're testing a private method, so we need to setup reflector magic.
|
||||
$method = new ReflectionMethod($ccompletion, '_save');
|
||||
$method->setAccessible(true); // Allow accessing of private method.
|
||||
$completionid = $method->invoke($ccompletion);
|
||||
$completions = $DB->get_records('course_completions');
|
||||
$this->assertEquals(count($completions), 1);
|
||||
@@ -1821,7 +1819,6 @@ class completionlib_test extends advanced_testcase {
|
||||
|
||||
$ccompletion->id = 0;
|
||||
$method = new ReflectionMethod($ccompletion, '_save');
|
||||
$method->setAccessible(true); // Allow accessing of private method.
|
||||
$completionid = $method->invoke($ccompletion);
|
||||
$this->assertDebuggingCalled('Can not update data object, no id!');
|
||||
$this->assertNull($completionid);
|
||||
|
||||
Reference in New Issue
Block a user