MDL-79890 core: Stop using get_class() without args
PHP 8.3 deprecates the use of `get_class()` without arguments. The following alternatives should instead be used as appropriate: - `get_class($this)` - The equivalent for instance methods - `self::class` - The current class Note that the behaviour of `get_class()` in a static method was equivalent to `self::class` and _not_ `static::class`. That is to say that the previous behaviour did not respect late static binding.
This commit is contained in:
@@ -102,7 +102,7 @@ class block extends base {
|
||||
*/
|
||||
public static function add_disabled_constraints_to_form(\MoodleQuickForm $mform) {
|
||||
$mform->hideIf('targetvalue_block', 'targettype', 'noteq',
|
||||
\tool_usertours\target::get_target_constant_for_class(get_class()));
|
||||
\tool_usertours\target::get_target_constant_for_class(self::class));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -92,7 +92,7 @@ class selector extends base {
|
||||
*/
|
||||
public static function add_disabled_constraints_to_form(\MoodleQuickForm $mform) {
|
||||
$mform->hideIf('targetvalue_selector', 'targettype', 'noteq',
|
||||
\tool_usertours\target::get_target_constant_for_class(get_class()));
|
||||
\tool_usertours\target::get_target_constant_for_class(self::class));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -81,7 +81,7 @@ class unattached extends base {
|
||||
* @param MoodleQuickForm $mform The form to add configuration to.
|
||||
*/
|
||||
public static function add_disabled_constraints_to_form(\MoodleQuickForm $mform) {
|
||||
$myvalue = \tool_usertours\target::get_target_constant_for_class(get_class());
|
||||
$myvalue = \tool_usertours\target::get_target_constant_for_class(self::class);
|
||||
|
||||
foreach (array_keys(self::$forcedsettings) as $settingname) {
|
||||
$mform->hideIf($settingname, 'targettype', 'eq', $myvalue);
|
||||
|
||||
@@ -53,6 +53,8 @@ Local changes (to reapply until upstream upgrades contain them):
|
||||
cd lib/google/src
|
||||
for file in `find . -name '*.php' `; do sed -i '/^class /i #[AllowDynamicProperties]' $file; done
|
||||
```
|
||||
* MDL-46563 - PHP 8.3 compliance
|
||||
- Converted use of `get_class()` to `static::class`
|
||||
|
||||
Information
|
||||
-----------
|
||||
|
||||
@@ -40,7 +40,7 @@ class Google_Http_REST
|
||||
$runner = new Google_Task_Runner(
|
||||
$client,
|
||||
sprintf('%s %s', $req->getRequestMethod(), $req->getUrl()),
|
||||
array(get_class(), 'doExecute'),
|
||||
array(self::class, 'doExecute'),
|
||||
array($client, $req)
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user