diff --git a/.upgradenotes/MDL-87799-2026012915562005.yml b/.upgradenotes/MDL-87799-2026012915562005.yml new file mode 100644 index 00000000000..ef8677018df --- /dev/null +++ b/.upgradenotes/MDL-87799-2026012915562005.yml @@ -0,0 +1,8 @@ +issueNumber: MDL-87799 +notes: + core: + - message: >- + New `\core\attribute\description` attribute, previously + `\core_sms\description`, for representing a language string in code + attributes + type: improved diff --git a/public/sms/classes/description.php b/public/lib/classes/attribute/description.php similarity index 89% rename from public/sms/classes/description.php rename to public/lib/classes/attribute/description.php index 343cd5f96e5..d65a9ba4e85 100644 --- a/public/sms/classes/description.php +++ b/public/lib/classes/attribute/description.php @@ -14,15 +14,17 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . -namespace core_sms; +namespace core\attribute; + +use core\lang_string; /** * A language string attribute used for a description. * - * @package core_sms + * @package core * @copyright 2024 Andrew Lyons * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ #[\Attribute] -class description extends \lang_string { +class description extends lang_string { } diff --git a/public/lib/db/renamedclasses.php b/public/lib/db/renamedclasses.php index 9b286aa665f..ef387f93044 100644 --- a/public/lib/db/renamedclasses.php +++ b/public/lib/db/renamedclasses.php @@ -45,4 +45,6 @@ $renamedclasses = [ // Since Moodle 5.1. 'core_xml_parser' => 'core\\xml_parser', 'xml_format_exception' => 'core\\exception\\xml_format_exception', + // Since Moodle 5.2. + 'core_sms\\description' => 'core\\attribute\\description', ]; diff --git a/public/sms/classes/message_status.php b/public/sms/classes/message_status.php index 5e014994081..1ed05b321d8 100644 --- a/public/sms/classes/message_status.php +++ b/public/sms/classes/message_status.php @@ -17,6 +17,7 @@ namespace core_sms; use core\attribute_helper; +use core\attribute\description; /** * The general status of a message. Gateways are able to provide more specific statuses to supplement these. diff --git a/public/sms/tests/message_status_test.php b/public/sms/tests/message_status_test.php index d9641be2080..11431886959 100644 --- a/public/sms/tests/message_status_test.php +++ b/public/sms/tests/message_status_test.php @@ -16,6 +16,7 @@ namespace core_sms; +use core\lang_string; /** * Tests for sms @@ -51,7 +52,7 @@ final class message_status_test extends \advanced_testcase { public function test_description(): void { foreach (message_status::cases() as $case) { - $this->assertInstanceOf(\lang_string::class, $case->description()); + $this->assertInstanceOf(lang_string::class, $case->description()); } } }