mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree
synced 2024-11-27 09:43:06 +00:00
Simplify CategoryTree::capDepth
Current master of CategoryTree requires MW 1.35, which requires PHP 7.3. Change-Id: Ibec271bf45465cd61ac383595041e0475304f31c
This commit is contained in:
parent
c504ecdec1
commit
c7b79338d5
|
@ -806,7 +806,6 @@ class CategoryTree {
|
|||
|
||||
/**
|
||||
* Internal function to cap depth
|
||||
* @suppress PhanPluginDuplicateConditionalNullCoalescing until PHP7 is required
|
||||
* @param string $mode
|
||||
* @param int $depth
|
||||
* @return int|mixed
|
||||
|
@ -814,14 +813,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