From: Kunal Mehta Date: Tue, 27 Sep 2016 21:50:13 +0000 (-0700) Subject: Make RecentChange::addTags() accept a string X-Git-Tag: 1.31.0-rc.0~5305 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/comptes/ajouter.php?a=commitdiff_plain;h=fc4de495451f6e2662b5913081d03263edb988c2;p=lhc%2Fweb%2Fwiklou.git Make RecentChange::addTags() accept a string Most planned callers of RecentChange::addTags() only want to add a single tag, so forcing them to create an array seems unfriendly. Plus this lets us avoid a array_merge call. Change-Id: If001ba9ff01a33be158e7edd5c5e4de9825fa180 --- diff --git a/includes/changes/RecentChange.php b/includes/changes/RecentChange.php index 7ae1f29135..584c813bc8 100644 --- a/includes/changes/RecentChange.php +++ b/includes/changes/RecentChange.php @@ -1037,9 +1037,13 @@ class RecentChange { * * @since 1.28 * - * @param array $tags + * @param string|array $tags */ public function addTags( $tags ) { - $this->tags = array_merge( $tags, $this->tags ); + if ( is_string( $tags ) ) { + $this->tags[] = $tags; + } else { + $this->tags = array_merge( $tags, $this->tags ); + } } }