[MediaWiki-commits] [Gerrit] replacers: Make Replacer abstract, and add abstract Replacer... - change (mediawiki/core)

2015-01-29 Thread Legoktm (Code Review)
Legoktm has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/187401

Change subject: replacers: Make Replacer abstract, and add abstract 
Replacer::replace()
..

replacers: Make Replacer abstract, and add abstract Replacer::replace()

Change-Id: Ib00dc8585e8ba599491e51e0b99a8667c3b4cd63
---
M includes/libs/replacers/DoubleReplacer.php
M includes/libs/replacers/HashtableReplacer.php
M includes/libs/replacers/RegexlikeReplacer.php
M includes/libs/replacers/Replacer.php
4 files changed, 10 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/01/187401/1

diff --git a/includes/libs/replacers/DoubleReplacer.php 
b/includes/libs/replacers/DoubleReplacer.php
index 20a4089..fed023b 100644
--- a/includes/libs/replacers/DoubleReplacer.php
+++ b/includes/libs/replacers/DoubleReplacer.php
@@ -37,7 +37,7 @@
 * @param array $matches
 * @return mixed
 */
-   public function replace( $matches ) {
+   public function replace( array $matches ) {
return str_replace( $this-from, $this-to, 
$matches[$this-index] );
}
 }
diff --git a/includes/libs/replacers/HashtableReplacer.php 
b/includes/libs/replacers/HashtableReplacer.php
index e1572f2..b3c219d 100644
--- a/includes/libs/replacers/HashtableReplacer.php
+++ b/includes/libs/replacers/HashtableReplacer.php
@@ -37,7 +37,7 @@
 * @param array $matches
 * @return mixed
 */
-   public function replace( $matches ) {
+   public function replace( array $matches ) {
return $this-table[$matches[$this-index]];
}
 }
diff --git a/includes/libs/replacers/RegexlikeReplacer.php 
b/includes/libs/replacers/RegexlikeReplacer.php
index 630a754..2b1fa74 100644
--- a/includes/libs/replacers/RegexlikeReplacer.php
+++ b/includes/libs/replacers/RegexlikeReplacer.php
@@ -35,7 +35,7 @@
 * @param array $matches
 * @return string
 */
-   public function replace( $matches ) {
+   public function replace( array $matches ) {
$pairs = array();
foreach ( $matches as $i = $match ) {
$pairs[\$$i] = $match;
diff --git a/includes/libs/replacers/Replacer.php 
b/includes/libs/replacers/Replacer.php
index 924fb30..f4850bf 100644
--- a/includes/libs/replacers/Replacer.php
+++ b/includes/libs/replacers/Replacer.php
@@ -22,11 +22,17 @@
  * Base class for replacers, objects used in preg_replace_callback() and
  * StringUtils::delimiterReplaceCallback()
  */
-class Replacer {
+abstract class Replacer {
/**
 * @return array
 */
public function cb() {
return array( $this, 'replace' );
}
+
+   /**
+* @param array $matches
+* @return string
+*/
+   abstract public function replace( array $matches );
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/187401
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib00dc8585e8ba599491e51e0b99a8667c3b4cd63
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Legoktm legoktm.wikipe...@gmail.com

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] replacers: Make Replacer abstract, and add abstract Replacer... - change (mediawiki/core)

2015-01-29 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: replacers: Make Replacer abstract, and add abstract 
Replacer::replace()
..


replacers: Make Replacer abstract, and add abstract Replacer::replace()

Change-Id: Ib00dc8585e8ba599491e51e0b99a8667c3b4cd63
---
M includes/libs/replacers/DoubleReplacer.php
M includes/libs/replacers/HashtableReplacer.php
M includes/libs/replacers/RegexlikeReplacer.php
M includes/libs/replacers/Replacer.php
4 files changed, 10 insertions(+), 4 deletions(-)

Approvals:
  Addshore: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/libs/replacers/DoubleReplacer.php 
b/includes/libs/replacers/DoubleReplacer.php
index 20a4089..fed023b 100644
--- a/includes/libs/replacers/DoubleReplacer.php
+++ b/includes/libs/replacers/DoubleReplacer.php
@@ -37,7 +37,7 @@
 * @param array $matches
 * @return mixed
 */
-   public function replace( $matches ) {
+   public function replace( array $matches ) {
return str_replace( $this-from, $this-to, 
$matches[$this-index] );
}
 }
diff --git a/includes/libs/replacers/HashtableReplacer.php 
b/includes/libs/replacers/HashtableReplacer.php
index e1572f2..b3c219d 100644
--- a/includes/libs/replacers/HashtableReplacer.php
+++ b/includes/libs/replacers/HashtableReplacer.php
@@ -37,7 +37,7 @@
 * @param array $matches
 * @return mixed
 */
-   public function replace( $matches ) {
+   public function replace( array $matches ) {
return $this-table[$matches[$this-index]];
}
 }
diff --git a/includes/libs/replacers/RegexlikeReplacer.php 
b/includes/libs/replacers/RegexlikeReplacer.php
index 630a754..2b1fa74 100644
--- a/includes/libs/replacers/RegexlikeReplacer.php
+++ b/includes/libs/replacers/RegexlikeReplacer.php
@@ -35,7 +35,7 @@
 * @param array $matches
 * @return string
 */
-   public function replace( $matches ) {
+   public function replace( array $matches ) {
$pairs = array();
foreach ( $matches as $i = $match ) {
$pairs[\$$i] = $match;
diff --git a/includes/libs/replacers/Replacer.php 
b/includes/libs/replacers/Replacer.php
index 924fb30..f4850bf 100644
--- a/includes/libs/replacers/Replacer.php
+++ b/includes/libs/replacers/Replacer.php
@@ -22,11 +22,17 @@
  * Base class for replacers, objects used in preg_replace_callback() and
  * StringUtils::delimiterReplaceCallback()
  */
-class Replacer {
+abstract class Replacer {
/**
 * @return array
 */
public function cb() {
return array( $this, 'replace' );
}
+
+   /**
+* @param array $matches
+* @return string
+*/
+   abstract public function replace( array $matches );
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/187401
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib00dc8585e8ba599491e51e0b99a8667c3b4cd63
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Legoktm legoktm.wikipe...@gmail.com
Gerrit-Reviewer: Addshore addshorew...@gmail.com
Gerrit-Reviewer: jenkins-bot 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits