Tobias Gritschacher has submitted this change and it was merged.
Change subject: Removed Diff\Exception
......................................................................
Removed Diff\Exception
Change-Id: Iea7333242edf94683d4fdabab5c359b88dd7c4fd
---
M Diff.mw.php
M Diff.standalone.php
M RELEASE-NOTES
M includes/DiffOpFactory.php
M includes/differ/CallbackListDiffer.php
M includes/differ/Differ.php
M includes/differ/ListDiffer.php
M includes/differ/MapDiffer.php
M includes/diffop/diff/Diff.php
M includes/diffop/diff/MapDiff.php
10 files changed, 15 insertions(+), 17 deletions(-)
Approvals:
Tobias Gritschacher: Looks good to me, approved
jenkins-bot: Verified
diff --git a/Diff.mw.php b/Diff.mw.php
index d90349d..f0e576b 100644
--- a/Diff.mw.php
+++ b/Diff.mw.php
@@ -83,5 +83,3 @@
return true;
// @codeCoverageIgnoreEnd
};
-
-class_alias( '\MWException', 'Diff\Exception' );
diff --git a/Diff.standalone.php b/Diff.standalone.php
index bff08e4..7e0e3c0 100644
--- a/Diff.standalone.php
+++ b/Diff.standalone.php
@@ -21,8 +21,6 @@
die( 'Not an entry point for MediaWiki. Use Diff.php' );
}
- class Exception extends \Exception {}
-
spl_autoload_register( function ( $className ) {
static $classes = false;
diff --git a/RELEASE-NOTES b/RELEASE-NOTES
index 746f1ef..09e7dd6 100644
--- a/RELEASE-NOTES
+++ b/RELEASE-NOTES
@@ -16,6 +16,7 @@
is now private rather than public.
* Adding a non-DiffOp element to a Diff will now result in an
InvalidArgumentException
rather than a MWException.
+* Removed Diff\Exception
=== Version 0.5 ===
2013-02-26
diff --git a/includes/DiffOpFactory.php b/includes/DiffOpFactory.php
index 1175826..12426a6 100644
--- a/includes/DiffOpFactory.php
+++ b/includes/DiffOpFactory.php
@@ -1,7 +1,8 @@
<?php
namespace Diff;
-use Diff\Exception;
+
+use InvalidArgumentException;
/**
* Factory for constructing DiffOp objects.
@@ -58,7 +59,7 @@
* @param array $diffOp
*
* @return DiffOp
- * @throws Exception
+ * @throws InvalidArgumentException
*/
public function newFromArray( array $diffOp ) {
$this->assertHasKey( 'type', $diffOp );
@@ -94,7 +95,7 @@
return new Diff( $operations, $diffOp['isassoc'] );
}
- throw new Exception( 'Invalid array provided. Unknown type' );
+ throw new InvalidArgumentException( 'Invalid array provided.
Unknown type' );
}
/**
@@ -103,11 +104,11 @@
* @param mixed $key
* @param array $diffOp
*
- * @throws Exception
+ * @throws InvalidArgumentException
*/
protected function assertHasKey( $key, array $diffOp ) {
if ( !array_key_exists( $key, $diffOp ) ) {
- throw new Exception( 'Invalid array provided. Missing
key "' . $key . '"' );
+ throw new InvalidArgumentException( 'Invalid array
provided. Missing key "' . $key . '"' );
}
}
diff --git a/includes/differ/CallbackListDiffer.php
b/includes/differ/CallbackListDiffer.php
index 60681a8..c01561a 100644
--- a/includes/differ/CallbackListDiffer.php
+++ b/includes/differ/CallbackListDiffer.php
@@ -2,6 +2,8 @@
namespace Diff;
+use Exception;
+
/**
* Differ that only looks at the values of the arrays (and thus ignores key
differences).
* Values are compared via callback.
@@ -59,7 +61,6 @@
* @param array $oldValues The first array
* @param array $newValues The second array
*
- * @throws Exception
* @return DiffOp[]
*/
public function doDiff( array $oldValues, array $newValues ) {
diff --git a/includes/differ/Differ.php b/includes/differ/Differ.php
index 4d0d9ff..66cc01b 100644
--- a/includes/differ/Differ.php
+++ b/includes/differ/Differ.php
@@ -38,8 +38,8 @@
* @param array $oldValues The first array
* @param array $newValues The second array
*
- * @throws Exception
* @return DiffOp[]
+ * @throws \Exception
*/
public function doDiff( array $oldValues, array $newValues );
diff --git a/includes/differ/ListDiffer.php b/includes/differ/ListDiffer.php
index 90d6e2c..e1d9808 100644
--- a/includes/differ/ListDiffer.php
+++ b/includes/differ/ListDiffer.php
@@ -99,8 +99,8 @@
* @param array $oldValues The first array
* @param array $newValues The second array
*
- * @throws Exception
* @return DiffOp[]
+ * @throws \Exception
*/
public function doDiff( array $oldValues, array $newValues ) {
$operations = array();
diff --git a/includes/differ/MapDiffer.php b/includes/differ/MapDiffer.php
index 18cde1c..ee0b463 100644
--- a/includes/differ/MapDiffer.php
+++ b/includes/differ/MapDiffer.php
@@ -88,8 +88,8 @@
* @param array $oldValues The first array
* @param array $newValues The second array
*
- * @throws Exception
* @return DiffOp[]
+ * @throws \Exception
*/
public function doDiff( array $oldValues, array $newValues ) {
$newSet = $this->array_diff_assoc( $newValues, $oldValues );
diff --git a/includes/diffop/diff/Diff.php b/includes/diffop/diff/Diff.php
index 1ee4cbc..ac0c306 100644
--- a/includes/diffop/diff/Diff.php
+++ b/includes/diffop/diff/Diff.php
@@ -141,21 +141,21 @@
* @param mixed $value
*
* @return boolean
- * @throws Exception
+ * @throws InvalidArgumentException
*/
protected function preSetElement( $index, $value ) {
/**
* @var DiffOp $value
*/
if ( $this->isAssociative === false && ( $value->getType() !==
'add' && $value->getType() !== 'remove' ) ) {
- throw new Exception( 'Diff operation with invalid type
"' . $value->getType() . '" provided.' );
+ throw new InvalidArgumentException( 'Diff operation
with invalid type "' . $value->getType() . '" provided.' );
}
if ( array_key_exists( $value->getType(), $this->typePointers )
) {
$this->typePointers[$value->getType()][] = $index;
}
else {
- throw new Exception( 'Diff operation with invalid type
"' . $value->getType() . '" provided.' );
+ throw new InvalidArgumentException( 'Diff operation
with invalid type "' . $value->getType() . '" provided.' );
}
return true;
diff --git a/includes/diffop/diff/MapDiff.php b/includes/diffop/diff/MapDiff.php
index f885d87..2a30d81 100644
--- a/includes/diffop/diff/MapDiff.php
+++ b/includes/diffop/diff/MapDiff.php
@@ -64,7 +64,6 @@
* @param array $newValues The second array
* @param boolean $recursively If elements that are arrays should also
be diffed.
*
- * @throws Exception
* @return DiffOp[]
*/
public static function doDiff( array $oldValues, array $newValues,
$recursively = false ) {
--
To view, visit https://gerrit.wikimedia.org/r/57407
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Iea7333242edf94683d4fdabab5c359b88dd7c4fd
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Diff
Gerrit-Branch: master
Gerrit-Owner: Jeroen De Dauw <[email protected]>
Gerrit-Reviewer: Daniel Kinzler <[email protected]>
Gerrit-Reviewer: Daniel Werner <[email protected]>
Gerrit-Reviewer: John Erling Blad <[email protected]>
Gerrit-Reviewer: Tobias Gritschacher <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits