8000 [Form] refactor Guess · symfony/symfony@e7e39e0 · GitHub
[go: up one dir, main page]

Skip to content

Commit e7e39e0

Browse files
committed
[Form] refactor Guess
1 parent dcbeeb1 commit e7e39e0

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

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

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,6 @@ abstract class Guess
4646
*/
4747
const LOW_CONFIDENCE = 0;
4848

49-
/**
50-
* The list of allowed confidence values
51-
* @var array
52-
*/
53-
private static $confidences = array(
54-
self::VERY_HIGH_CONFIDENCE,
55-
self::HIGH_CONFIDENCE,
56-
self::MEDIUM_CONFIDENCE,
57-
self::LOW_CONFIDENCE,
58-
);
59-
6049
/**
6150
* The confidence about the correctness of the value
6251
*
@@ -101,8 +90,9 @@ public static function getBestGuess(array $guesses)
10190
*/
10291
public function __construct($confidence)
10392
{
104-
if (!in_array($confidence, self::$confidences)) {
105-
throw new \InvalidArgumentException(sprintf('The confidence should be one of "%s"', implode('", "', self::$confidences)));
93+
if (self::VERY_HIGH_CONFIDENCE !== $confidence && self::HIGH_CONFIDENCE !== $confidence &&
94+
self::MEDIUM_CONFIDENCE !== $confidence && self::LOW_CONFIDENCE !== $confidence) {
95+
throw new \InvalidArgumentException('The confidence should be one of the constants defined in Guess.');
10696
}
10797

10898
$this->confidence = $confidence;

0 commit comments

Comments
 (0)
0