From bbc74d93b05e8522578551347a335f87f772d62d Mon Sep 17 00:00:00 2001 From: Dogu Date: Tue, 2 Jan 2024 19:31:56 +0100 Subject: Refactor widget classes to use cleaner namespacing This patch refactors various widget classes in the includes/widget directory to use cleaner namespacing. The patches remove redundant backslash prefixes in class extending statements and add use statements for OOUI classes and other MediaWiki-specific classes. This patch improves readability and maintainability of the code by following the MediaWiki coding conventions and leverages the benefits of PHP's namespacing system. List of affected classes: - CheckMatrixWidget - DateInputWidget - DateTimeInputWidget - NamespaceInputWidget - SearchInputWidget - SelectWithInputWidget - SizeFilterWidget - SpinnerWidget - TagMultiselectWidget - TitleInputWidget - UserInputWidget Additionally, the code now correctly documents exceptions thrown by constructors where missing, enforcing clearer developer expectations. Change-Id: I0fdaf68a412a1c3b7049a79222f4dbeaa95a6bbc --- includes/widget/SpinnerWidget.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'includes/widget/SpinnerWidget.php') diff --git a/includes/widget/SpinnerWidget.php b/includes/widget/SpinnerWidget.php index 71f26f7521af..4fa3887ae78e 100644 --- a/includes/widget/SpinnerWidget.php +++ b/includes/widget/SpinnerWidget.php @@ -2,6 +2,9 @@ namespace MediaWiki\Widget; +use Exception; +use MediaWiki\Html\Html; + /** * PHP version of jquery.spinner. * @@ -47,7 +50,7 @@ class SpinnerWidget { * @return string HTML serialization */ public function toString() { - return \MediaWiki\Html\Html::rawElement( 'div', $this->attributes, $this->content ); + return Html::rawElement( 'div', $this->attributes, $this->content ); } /** @@ -60,7 +63,7 @@ class SpinnerWidget { public function __toString() { try { return $this->toString(); - } catch ( \Exception $ex ) { + } catch ( Exception $ex ) { trigger_error( (string)$ex, E_USER_ERROR ); } } -- cgit v1.2.3