Permalink
Browse files

[Form] replaced UnexpectedValueException by InvalidArgumentException …

…in Guess

this is a better fit because the error is a logic exception instead of a runtime exception
  • Loading branch information...
1 parent 5018dae commit 6c5eca787701df3063f7e45f59e47a0964b9c297 @Tobion Tobion committed Aug 27, 2012
Showing with 3 additions and 3 deletions.
  1. +2 −2 Guess/Guess.php
  2. +1 −1 Tests/Guess/GuessTest.php
View
@@ -97,12 +97,12 @@ public static function getBestGuess(array $guesses)
*
* @param integer $confidence The confidence
*
- * @throws \UnexpectedValueException if the given value of confidence is unknown
+ * @throws \InvalidArgumentException if the given value of confidence is unknown
*/
public function __construct($confidence)
{
if (!in_array($confidence, self::$confidences)) {
- throw new \UnexpectedValueException(sprintf('The confidence should be one of "%s"', implode('", "', self::$confidences)));
+ throw new \InvalidArgumentException(sprintf('The confidence should be one of "%s"', implode('", "', self::$confidences)));
}
$this->confidence = $confidence;
@@ -27,7 +27,7 @@ public function testGetBestGuessReturnsGuessWithHighestConfidence()
}
/**
- * @expectedException \UnexpectedValueException
+ * @expectedException \InvalidArgumentException
*/
public function testGuessExpectsValidConfidence()
{

0 comments on commit 6c5eca7

Please sign in to comment.