mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 04:22:07 +02:00
MDL-50453 core: Replace reserved word usage in progress\null (PHP7)
This commit is contained in:
parent
f1a415ea70
commit
303936aa57
@ -110,7 +110,7 @@ class backup_controller extends base_controller {
|
||||
|
||||
// By default there is no progress reporter. Interfaces that wish to
|
||||
// display progress must set it.
|
||||
$this->progress = new \core\progress\null();
|
||||
$this->progress = new \core\progress\none();
|
||||
|
||||
// Instantiate the output_controller singleton and active it if interactive and inmediate
|
||||
$oc = output_controller::get_instance();
|
||||
|
@ -114,7 +114,7 @@ class restore_controller extends base_controller {
|
||||
if ($progress) {
|
||||
$this->progress = $progress;
|
||||
} else {
|
||||
$this->progress = new \core\progress\null();
|
||||
$this->progress = new \core\progress\none();
|
||||
}
|
||||
$this->progress->start_progress('Constructing restore_controller');
|
||||
|
||||
|
@ -123,7 +123,7 @@ abstract class restore_dbops {
|
||||
|
||||
// Set up progress tracking (indeterminate).
|
||||
if (!$progress) {
|
||||
$progress = new \core\progress\null();
|
||||
$progress = new \core\progress\none();
|
||||
}
|
||||
$progress->start_progress('Loading inforef.xml file');
|
||||
|
||||
@ -430,7 +430,7 @@ abstract class restore_dbops {
|
||||
|
||||
// Set up progress tracking (indeterminate).
|
||||
if (!$progress) {
|
||||
$progress = new \core\progress\null();
|
||||
$progress = new \core\progress\none();
|
||||
}
|
||||
$progress->start_progress('Loading users into temporary table');
|
||||
|
||||
|
@ -185,11 +185,11 @@ class restore_ui extends base_ui {
|
||||
* there are long-running tasks even though there is no restore controller
|
||||
* in use.
|
||||
*
|
||||
* @return \core\progress\null
|
||||
* @return \core\progress\none
|
||||
*/
|
||||
public function get_progress_reporter() {
|
||||
if (!$this->progressreporter) {
|
||||
$this->progressreporter = new \core\progress\null();
|
||||
$this->progressreporter = new \core\progress\none();
|
||||
}
|
||||
return $this->progressreporter;
|
||||
}
|
||||
|
@ -144,11 +144,11 @@ abstract class restore_ui_independent_stage {
|
||||
* in use. There is a similar function in restore_ui. but that class is not
|
||||
* used on some stages.
|
||||
*
|
||||
* @return \core\progress\null
|
||||
* @return \core\progress\none
|
||||
*/
|
||||
public function get_progress_reporter() {
|
||||
if (!$this->progressreporter) {
|
||||
$this->progressreporter = new \core\progress\null();
|
||||
$this->progressreporter = new \core\progress\none();
|
||||
}
|
||||
return $this->progressreporter;
|
||||
}
|
||||
|
@ -100,6 +100,9 @@ class core_component {
|
||||
$newclassname = self::$classmaprenames[$classname];
|
||||
$debugging = "Class '%s' has been renamed for the autoloader and is now deprecated. Please use '%s' instead.";
|
||||
debugging(sprintf($debugging, $classname, $newclassname), DEBUG_DEVELOPER);
|
||||
if (PHP_VERSION_ID >= 70000 && preg_match('#\\\null(\\\|$)#', $classname)) {
|
||||
throw new \coding_exception("Cannot alias $classname to $newclassname");
|
||||
}
|
||||
class_alias($newclassname, $classname);
|
||||
return;
|
||||
}
|
||||
|
@ -14,6 +14,14 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Progress handler that ignores progress entirely.
|
||||
*
|
||||
* @package core
|
||||
* @copyright 2013 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace core\progress;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
@ -21,11 +29,16 @@ defined('MOODLE_INTERNAL') || die();
|
||||
/**
|
||||
* Progress handler that ignores progress entirely.
|
||||
*
|
||||
* @package core_progress
|
||||
* @package core
|
||||
* @copyright 2013 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class null extends base {
|
||||
class none extends base {
|
||||
/**
|
||||
* When progress is updated, do nothing.
|
||||
*
|
||||
* @see \core\progress\base::update_progress()
|
||||
*/
|
||||
public function update_progress() {
|
||||
// Do nothing.
|
||||
}
|
@ -36,4 +36,5 @@ defined('MOODLE_INTERNAL') || die();
|
||||
// The old class name is the key, the new class name is the value.
|
||||
// The array must be called $renamedclasses.
|
||||
$renamedclasses = array(
|
||||
'core\progress\null' => 'core\progress\none',
|
||||
);
|
||||
|
@ -1,6 +1,10 @@
|
||||
This files describes API changes in core libraries and APIs,
|
||||
information provided here is intended especially for developers.
|
||||
|
||||
=== 3.0 ===
|
||||
|
||||
* \core\progress\null is renamed to \core\progress\none for improved PHP7 compatibility as null is a reserved word (see MDL-50453).
|
||||
|
||||
=== 2.9.1 ===
|
||||
|
||||
* New methods grade_grade::get_grade_max() and get_grade_min() must be used rather than directly the public properties rawgrademax and rawgrademin.
|
||||
|
@ -38,7 +38,7 @@ class calculator {
|
||||
|
||||
public function __construct(\core\progress\base $progress = null) {
|
||||
if ($progress === null) {
|
||||
$progress = new \core\progress\null();
|
||||
$progress = new \core\progress\none();
|
||||
}
|
||||
$this->progress = $progress;
|
||||
}
|
||||
|
@ -544,7 +544,7 @@ class quiz_statistics_report extends quiz_default_report {
|
||||
public function get_all_stats_and_analysis($quiz, $whichattempts, $whichtries, $groupstudents, $questions, $progress = null) {
|
||||
|
||||
if ($progress === null) {
|
||||
$progress = new \core\progress\null();
|
||||
$progress = new \core\progress\none();
|
||||
}
|
||||
|
||||
$qubaids = quiz_statistics_qubaids_condition($quiz->id, $groupstudents, $whichattempts);
|
||||
@ -595,7 +595,7 @@ class quiz_statistics_report extends quiz_default_report {
|
||||
$this->progress = new \core\progress\display_if_slow(get_string('calculatingallstats', 'quiz_statistics'));
|
||||
$this->progress->set_display_names();
|
||||
} else {
|
||||
$this->progress = new \core\progress\null();
|
||||
$this->progress = new \core\progress\none();
|
||||
}
|
||||
}
|
||||
return $this->progress;
|
||||
@ -613,7 +613,7 @@ class quiz_statistics_report extends quiz_default_report {
|
||||
protected function analyse_responses_for_all_questions_and_subquestions($questions, $subquestions, $qubaids,
|
||||
$whichtries, $progress = null) {
|
||||
if ($progress === null) {
|
||||
$progress = new \core\progress\null();
|
||||
$progress = new \core\progress\none();
|
||||
}
|
||||
|
||||
// Starting response analysis tasks.
|
||||
@ -643,7 +643,7 @@ class quiz_statistics_report extends quiz_default_report {
|
||||
return array();
|
||||
}
|
||||
if ($progress === null) {
|
||||
$progress = new \core\progress\null();
|
||||
$progress = new \core\progress\none();
|
||||
}
|
||||
$progress->start_progress('', $countquestions, $countquestions);
|
||||
foreach ($questions as $question) {
|
||||
|
@ -68,12 +68,12 @@ class calculator {
|
||||
*
|
||||
* @param object[] questions to analyze, keyed by slot, also analyses sub questions for random questions.
|
||||
* we expect some extra fields - slot, maxmark and number on the full question data objects.
|
||||
* @param \core\progress\base|null $progress the element to send progress messages to, default is {@link \core\progress\null}.
|
||||
* @param \core\progress\base|null $progress the element to send progress messages to, default is {@link \core\progress\none}.
|
||||
*/
|
||||
public function __construct($questions, $progress = null) {
|
||||
|
||||
if ($progress === null) {
|
||||
$progress = new \core\progress\null();
|
||||
$progress = new \core\progress\none();
|
||||
}
|
||||
$this->progress = $progress;
|
||||
$this->stats = new $this->statscollectionclassname();
|
||||
|
Loading…
x
Reference in New Issue
Block a user