From e45ce1f5bd3f9dafb70070f314eec72cabb45806 Mon Sep 17 00:00:00 2001 From: Thiemo Kreuz Date: Thu, 3 Dec 2020 16:47:19 +0100 Subject: [PATCH] Mark two private methods as such Not used anywhere else: https://codesearch.wmcloud.org/search/?q=stringifyActions https://codesearch.wmcloud.org/search/?q=normalizeBlocks This patch also moves that [ '' ] fallback out of a method where it was misplaced. That fallback is very specific for the diff algorithm, but not something one would expect from a method called "stringifyActions". Change-Id: I458eef61c6b6741bbd433ea26a012aaeb01cea3f --- includes/View/AbuseFilterViewDiff.php | 10 +++------- includes/View/AbuseFilterViewEdit.php | 2 +- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/includes/View/AbuseFilterViewDiff.php b/includes/View/AbuseFilterViewDiff.php index f666ea455..ccc3d3513 100644 --- a/includes/View/AbuseFilterViewDiff.php +++ b/includes/View/AbuseFilterViewDiff.php @@ -370,8 +370,8 @@ class AbuseFilterViewDiff extends AbuseFilterView { $actions = $this->getDiffRow( 'abusefilter-edit-consequences', - $this->stringifyActions( $oldVersion['actions'] ), - $this->stringifyActions( $newVersion['actions'] ) + $this->stringifyActions( $oldVersion['actions'] ) ?: [ '' ], + $this->stringifyActions( $newVersion['actions'] ) ?: [ '' ] ); if ( $actions !== '' ) { @@ -392,7 +392,7 @@ class AbuseFilterViewDiff extends AbuseFilterView { * @param string[][] $actions * @return string[] */ - public function stringifyActions( $actions ) { + private function stringifyActions( array $actions ) : array { $lines = []; ksort( $actions ); @@ -400,10 +400,6 @@ class AbuseFilterViewDiff extends AbuseFilterView { $lines[] = AbuseFilter::formatAction( $action, $parameters, $this->getLanguage() ); } - if ( !count( $lines ) ) { - $lines[] = ''; - } - return $lines; } diff --git a/includes/View/AbuseFilterViewEdit.php b/includes/View/AbuseFilterViewEdit.php index 71816b2ad..18c41cd40 100644 --- a/includes/View/AbuseFilterViewEdit.php +++ b/includes/View/AbuseFilterViewEdit.php @@ -1096,7 +1096,7 @@ class AbuseFilterViewEdit extends AbuseFilterView { * @param string[] $durations * @return string[] */ - protected static function normalizeBlocks( array $durations ) { + private static function normalizeBlocks( array $durations ) { global $wgAbuseFilterBlockDuration, $wgAbuseFilterAnonBlockDuration; // We need to have same values since it may happen that ipblocklist // and one (or both) of the global variables use different wording