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
This commit is contained in:
Thiemo Kreuz 2020-12-03 16:47:19 +01:00
parent 34968d783e
commit e45ce1f5bd
2 changed files with 4 additions and 8 deletions

View file

@ -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;
}

View file

@ -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