From 0cca112259259a27e1f9ede43a88d31b553045b9 Mon Sep 17 00:00:00 2001 From: Daniel Ziegenberg Date: Wed, 27 Mar 2024 20:16:48 +0100 Subject: [PATCH] MDL-74484 lib: Final deprecation of print_error Signed-off-by: Daniel Ziegenberg --- lib/deprecatedlib.php | 24 ++++++++---------------- lib/upgrade.txt | 5 +++++ 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/lib/deprecatedlib.php b/lib/deprecatedlib.php index 409a16a4187..a312b0b63c2 100644 --- a/lib/deprecatedlib.php +++ b/lib/deprecatedlib.php @@ -2872,24 +2872,16 @@ function get_array_of_activities() { } /** - * Abort execution by throwing of a general exception, - * default exception handler displays the error message in most cases. - * * @deprecated since Moodle 4.1 - * @todo MDL-74484 Final deprecation in Moodle 4.5. - * @param string $errorcode The name of the language string containing the error message. - * Normally this should be in the error.php lang file. - * @param string $module The language file to get the error message from. - * @param string $link The url where the user will be prompted to continue. - * If no url is provided the user will be directed to the site index page. - * @param object $a Extra words and phrases that might be required in the error string - * @param string $debuginfo optional debugging information - * @return void, always throws exception! */ -function print_error($errorcode, $module = 'error', $link = '', $a = null, $debuginfo = null) { - debugging("The function print_error() is deprecated. " . - "Please throw a new moodle_exception instance instead.", DEBUG_DEVELOPER); - throw new \moodle_exception($errorcode, $module, $link, $a, $debuginfo); +#[\core\attribute\deprecated( + 'Please throw a new moodle_exception instance instead.', + since: '4.1', + mdl: 'MDL-71062', + final: true +)] +function print_error(): void { + \core\deprecation::emit_deprecation_if_present([__FUNCTION__]); } /** diff --git a/lib/upgrade.txt b/lib/upgrade.txt index 163bde8bb81..25aeb716713 100644 --- a/lib/upgrade.txt +++ b/lib/upgrade.txt @@ -1,6 +1,11 @@ This files describes API changes in core libraries and APIs, information provided here is intended especially for developers. +=== 4.5 === + +* Final deprecation of print_error(). Use moodle_exception instead. + + === 4.4 === * New modinfo methods related to delegated sections (sections controlled by a component):