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
This commit is contained in:
Fomafix 2024-09-04 19:21:46 +00:00
parent 921e6fe3f9
commit 092797b0e2
2 changed files with 2 additions and 8 deletions

View file

@ -147,7 +147,7 @@ class ApiCategoryTree extends ApiBase {
), ),
$this->wanCache::TTL_DAY, $this->wanCache::TTL_DAY,
static function () use ( $ct, $title, $depth ) { static function () use ( $ct, $title, $depth ) {
return trim( $ct->renderChildren( $title, $depth ) ); return $ct->renderChildren( $title, $depth );
}, },
[ [
'touchedCallback' => function () { 'touchedCallback' => function () {

View file

@ -81,14 +81,8 @@ class CategoryTree {
public function getTag( string $category, bool $hideroot = false, array $attr = [], public function getTag( string $category, bool $hideroot = false, array $attr = [],
int $depth = 1 int $depth = 1
) { ) {
$category = trim( $category );
if ( $category === '' ) {
return false;
}
$title = self::makeTitle( $category ); $title = self::makeTitle( $category );
if ( !$title ) {
if ( $title === null ) {
return false; return false;
} }