8000 [Form] replaced UnexpectedValueException by InvalidArgumentException … · symfony/symfony@dcbeeb1 · GitHub
[go: up one dir, main page]

Skip to content

Commit dcbeeb1

Browse files
committed
[Form] replaced UnexpectedValueException by InvalidArgumentException in Guess
this is a better fit because the error is a logic exception instead of a runtime exception
1 parent c0590bf commit dcbeeb1

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/Symfony/Component/Form/Guess/Guess.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,12 @@ public static function getBestGuess(array $guesses)
9797
*
9898
* @param integer $confidence The confidence
9999
*
100-
* @throws \UnexpectedValueException if the given value of confidence is unknown
100+
* @throws \InvalidArgumentException if the given value of confidence is unknown
101101
*/
102102
public function __construct($confidence)
103103
{
104104
if (!in_array($confidence, self::$confidences)) {
105-
throw new \UnexpectedValueException(sprintf('The confidence should be one of "%s"', implode('", "', self::$confidences)));
105+
throw new \InvalidArgumentException(sprintf('The confidence should be one of "%s"', implode('", "', self::$confidences)));
106106
}
107107

108108
$this->confidence = $confidence;

src/Symfony/Component/Form/Tests/Guess/GuessTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function testGetBestGuessReturnsGuessWithHighestConfidence()
2727
}
2828

2929
/**
30-
* @expectedException \UnexpectedValueException
30+
* @expectedException \InvalidArgumentException
3131
*/
3232
public function testGuessExpectsValidConfidence()
3333
{

0 commit comments

Comments
 (0)
0