mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 08:22:07 +02:00
MDL-76415 core: Fixed ${var} string interpolation deprecations.
Since PHP 8.2, placing the dollar sign outside the curly brace is deprecated when the expression inside the braces resolves to a variable or an expression.
This commit is contained in:
parent
6b02417e8c
commit
e2cd808b34
@ -60,7 +60,7 @@ class lock_config {
|
||||
$dbtype = clean_param($DB->get_dbfamily(), PARAM_ALPHA);
|
||||
|
||||
// DB Specific lock factory is preferred - should support auto-release.
|
||||
$lockfactoryclass = "\\core\\lock\\${dbtype}_lock_factory";
|
||||
$lockfactoryclass = "\\core\\lock\\{$dbtype}_lock_factory";
|
||||
if (!class_exists($lockfactoryclass)) {
|
||||
$lockfactoryclass = '\core\lock\file_lock_factory';
|
||||
}
|
||||
|
@ -6292,10 +6292,10 @@ EOD;
|
||||
['description' => $description, 'version' => $version] = $DB->get_server_info();
|
||||
// MariaDB RPL_VERSION_HACK sanity check: "5.5.5" has never been released!
|
||||
$this->assertNotSame('5.5.5', $version,
|
||||
"Found invalid DB server version i.e. RPL_VERSION_HACK: '${version}' (${description}).");
|
||||
"Found invalid DB server version i.e. RPL_VERSION_HACK: '{$version}' ({$description}).");
|
||||
// DB version format is: "X.Y.Z".
|
||||
$this->assertMatchesRegularExpression('/^\d+\.\d+\.\d+$/', $version,
|
||||
"Found invalid DB server version format: '${version}' (${description}).");
|
||||
"Found invalid DB server version format: '{$version}' ({$description}).");
|
||||
|
||||
// Alter the DB options to force the read from DB and check for the same assertions above.
|
||||
$cfg->dboptions['versionfromdb'] = true;
|
||||
@ -6309,9 +6309,9 @@ EOD;
|
||||
$this->assertTrue($rcm->invokeArgs($db2, []), 'Invalid test state!');
|
||||
['description' => $description, 'version' => $version] = $db2->get_server_info();
|
||||
$this->assertNotSame('5.5.5', $version,
|
||||
"Found invalid DB server version when reading version from DB i.e. RPL_VERSION_HACK: '${version}' (${description}).");
|
||||
"Found invalid DB server version when reading version from DB i.e. RPL_VERSION_HACK: '{$version}' ({$description}).");
|
||||
$this->assertMatchesRegularExpression('/^\d+\.\d+\.\d+$/', $version,
|
||||
"Found invalid DB server version format when reading version from DB: '${version}' (${description}).");
|
||||
"Found invalid DB server version format when reading version from DB: '{$version}' ({$description}).");
|
||||
$db2->dispose();
|
||||
}
|
||||
}
|
||||
|
@ -49,13 +49,13 @@ class behat_editor_atto extends behat_base implements \core_behat\settable_edito
|
||||
public function set_editor_value(string $editorid, string $value): void {
|
||||
$js = <<<EOF
|
||||
(function() {
|
||||
const editableEditor = document.getElementById("${editorid}editable");
|
||||
const editableEditor = document.getElementById("{$editorid}editable");
|
||||
if (editableEditor && editableEditor.classList.contains('editor_atto_content')) {
|
||||
editableEditor.innerHTML = "${value}";
|
||||
editableEditor.innerHTML = "{$value}";
|
||||
}
|
||||
const editor = document.getElementById("${editorid}");
|
||||
const editor = document.getElementById("{$editorid}");
|
||||
if (editor) {
|
||||
editor.value = "${value}";
|
||||
editor.value = "{$value}";
|
||||
}
|
||||
})();
|
||||
EOF;
|
||||
|
@ -37,9 +37,9 @@ class behat_editor_textarea extends behat_base implements \core_behat\settable_e
|
||||
public function set_editor_value(string $editorid, string $value): void {
|
||||
$js = <<<EOF
|
||||
(function() {
|
||||
const editor = document.getElementById("${editorid}");
|
||||
const editor = document.getElementById("{$editorid}");
|
||||
if (editor && editor.tagName.toLowerCase() === 'textarea') {
|
||||
editor.value = "${value}";
|
||||
editor.value = "{$value}";
|
||||
}
|
||||
})();
|
||||
EOF;
|
||||
|
@ -226,8 +226,8 @@ class editor extends \texteditor {
|
||||
M.util.js_pending('editor_tiny/editor');
|
||||
require(['editor_tiny/editor'], (Tiny) => {
|
||||
Tiny.setupForElementId({
|
||||
elementId: "${elementid}",
|
||||
options: ${configoptions},
|
||||
elementId: "{$elementid}",
|
||||
options: {$configoptions},
|
||||
});
|
||||
M.util.js_complete('editor_tiny/editor');
|
||||
});
|
||||
|
@ -50,7 +50,7 @@ class behat_editor_tiny extends behat_base implements \core_behat\settable_edito
|
||||
protected function execute_javascript_for_editor(string $editorid, string $code): void {
|
||||
$js = <<<EOF
|
||||
require(['editor_tiny/editor'], (editor) => {
|
||||
const instance = editor.getInstanceForElementId('${editorid}');
|
||||
const instance = editor.getInstanceForElementId('{$editorid}');
|
||||
{$code}
|
||||
});
|
||||
EOF;
|
||||
@ -72,9 +72,9 @@ class behat_editor_tiny extends behat_base implements \core_behat\settable_edito
|
||||
$js = <<<EOF
|
||||
return new Promise((resolve, reject) => {
|
||||
require(['editor_tiny/editor'], (editor) => {
|
||||
const instance = editor.getInstanceForElementId('${editorid}');
|
||||
const instance = editor.getInstanceForElementId('{$editorid}');
|
||||
if (!instance) {
|
||||
reject("Instance '${editorid}' not found");
|
||||
reject("Instance '{$editorid}' not found");
|
||||
}
|
||||
|
||||
{$code}
|
||||
@ -101,7 +101,7 @@ class behat_editor_tiny extends behat_base implements \core_behat\settable_edito
|
||||
}
|
||||
|
||||
$this->execute_javascript_for_editor($editorid, <<<EOF
|
||||
instance.setContent('${value}');
|
||||
instance.setContent('{$value}');
|
||||
instance.undoManager.add();
|
||||
EOF);
|
||||
}
|
||||
@ -189,7 +189,7 @@ class behat_editor_tiny extends behat_base implements \core_behat\settable_edito
|
||||
$js = <<<EOF
|
||||
const container = instance.getContainer();
|
||||
if (!container.id) {
|
||||
container.id = '${targetid}';
|
||||
container.id = '{$targetid}';
|
||||
}
|
||||
resolve(container.id);
|
||||
EOF;
|
||||
@ -228,7 +228,7 @@ class behat_editor_tiny extends behat_base implements \core_behat\settable_edito
|
||||
// Ensure that a name is set on the iframe relating to the editorid.
|
||||
$js = <<<EOF
|
||||
if (!instance.iframeElement.name) {
|
||||
instance.iframeElement.name = '${editorid}';
|
||||
instance.iframeElement.name = '{$editorid}';
|
||||
}
|
||||
resolve(instance.iframeElement.name);
|
||||
EOF;
|
||||
@ -327,7 +327,7 @@ class behat_editor_tiny extends behat_base implements \core_behat\settable_edito
|
||||
|
||||
// Ensure that a name is set on the iframe relating to the editorid.
|
||||
$js = <<<EOF
|
||||
const element = instance.dom.select("${textlocator}")[${position}];
|
||||
const element = instance.dom.select("{$textlocator}")[{$position}];
|
||||
instance.selection.select(element);
|
||||
EOF;
|
||||
|
||||
@ -427,7 +427,7 @@ class behat_editor_tiny extends behat_base implements \core_behat\settable_edito
|
||||
$js = <<<EOF
|
||||
const editorDocument = instance.getDoc();
|
||||
const element = editorDocument.evaluate(
|
||||
"${xpath}",
|
||||
"{$xpath}",
|
||||
editorDocument,
|
||||
null,
|
||||
XPathResult.FIRST_ORDERED_NODE_TYPE,
|
||||
|
@ -53,7 +53,7 @@ function moodle_minimum_php_version_is_met($haltexecution = false) {
|
||||
|
||||
if (version_compare(PHP_VERSION, $minimumversion) < 0) {
|
||||
if ($haltexecution) {
|
||||
$error = "Moodle ${moodlerequirementchanged} or later requires at least PHP ${minimumversion} "
|
||||
$error = "Moodle {$moodlerequirementchanged} or later requires at least PHP {$minimumversion} "
|
||||
. "(currently using version " . PHP_VERSION .").\n"
|
||||
. "Some servers may have multiple PHP versions installed, are you using the correct executable?\n";
|
||||
|
||||
|
@ -903,7 +903,7 @@ class component_test extends advanced_testcase {
|
||||
// Iterate over all apis and perform more validations.
|
||||
foreach ($apis as $apiname => $attributes) {
|
||||
// Message, to be used later and easier finding the problem.
|
||||
$message = "Validation problem found with API: ${apiname}";
|
||||
$message = "Validation problem found with API: {$apiname}";
|
||||
|
||||
$this->assertIsObject($attributes, $message);
|
||||
$this->assertMatchesRegularExpression('/^[a-z][a-z0-9]+$/', $apiname, $message);
|
||||
|
@ -881,7 +881,7 @@ EXPECTED;
|
||||
$url1 = "{$CFG->wwwroot}/draftfile.php/5/user/draft/99999999/test1.jpg";
|
||||
$url2 = "{$CFG->wwwroot}/draftfile.php/5/user/draft/99999998/test2.jpg";
|
||||
|
||||
$html = "<p>This is a test.</p><p><img src=\"${url1}\" alt=\"\" role=\"presentation\"></p>
|
||||
$html = "<p>This is a test.</p><p><img src=\"{$url1}\" alt=\"\" role=\"presentation\"></p>
|
||||
<br>Test content.<p></p><p><img src=\"{$url2}\" alt=\"\" width=\"2048\" height=\"1536\"
|
||||
role=\"presentation\" class=\"img-fluid atto_image_button_text-bottom\"><br></p>";
|
||||
$draftareas = array(
|
||||
|
Loading…
x
Reference in New Issue
Block a user