From 092797b0e21bb3d65e068d3726b353dcfaa3c6ea Mon Sep 17 00:00:00 2001 From: Fomafix Date: Wed, 4 Sep 2024 19:21:46 +0000 Subject: [PATCH] Remove duplicate/unnecessary trim CategoryTree::makeTitle also makes a trim and an early return. A trim on the return value of renderChildren() is not needed. Change-Id: I1fc2705277491797eb6c0d0900152b63913ca875 --- includes/ApiCategoryTree.php | 2 +- includes/CategoryTree.php | 8 +------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/includes/ApiCategoryTree.php b/includes/ApiCategoryTree.php index fcd367a1..6b4968f3 100644 --- a/includes/ApiCategoryTree.php +++ b/includes/ApiCategoryTree.php @@ -147,7 +147,7 @@ class ApiCategoryTree extends ApiBase { ), $this->wanCache::TTL_DAY, static function () use ( $ct, $title, $depth ) { - return trim( $ct->renderChildren( $title, $depth ) ); + return $ct->renderChildren( $title, $depth ); }, [ 'touchedCallback' => function () { diff --git a/includes/CategoryTree.php b/includes/CategoryTree.php index 0c9188b6..1a84af84 100644 --- a/includes/CategoryTree.php +++ b/includes/CategoryTree.php @@ -81,14 +81,8 @@ class CategoryTree { public function getTag( string $category, bool $hideroot = false, array $attr = [], int $depth = 1 ) { - $category = trim( $category ); - if ( $category === '' ) { - return false; - } - $title = self::makeTitle( $category ); - - if ( $title === null ) { + if ( !$title ) { return false; }