mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree
synced 2024-11-27 09:43:06 +00:00
Merge "Simplify CategoryTree::capDepth"
This commit is contained in:
commit
6cba244a94
|
@ -802,7 +802,6 @@ class CategoryTree {
|
|||
|
||||
/**
|
||||
* Internal function to cap depth
|
||||
* @suppress PhanPluginDuplicateConditionalNullCoalescing until PHP7 is required
|
||||
* @param string $mode
|
||||
* @param int $depth
|
||||
* @return int|mixed
|
||||
|
@ -810,14 +809,14 @@ class CategoryTree {
|
|||
public static function capDepth( $mode, $depth ) {
|
||||
global $wgCategoryTreeMaxDepth;
|
||||
|
||||
if ( is_numeric( $depth ) ) {
|
||||
$depth = intval( $depth );
|
||||
} else {
|
||||
if ( !is_numeric( $depth ) ) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
$depth = intval( $depth );
|
||||
|
||||
if ( is_array( $wgCategoryTreeMaxDepth ) ) {
|
||||
$max = isset( $wgCategoryTreeMaxDepth[$mode] ) ? $wgCategoryTreeMaxDepth[$mode] : 1;
|
||||
$max = $wgCategoryTreeMaxDepth[$mode] ?? 1;
|
||||
} elseif ( is_numeric( $wgCategoryTreeMaxDepth ) ) {
|
||||
$max = $wgCategoryTreeMaxDepth;
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue