[Console] Make sure $maxAttempts is an int or null.
This commit is contained in:
parent
ee8fc9cb41
commit
4fcd4916ed
@ -188,8 +188,11 @@ class Question
|
|||||||
*/
|
*/
|
||||||
public function setMaxAttempts($attempts)
|
public function setMaxAttempts($attempts)
|
||||||
{
|
{
|
||||||
if (null !== $attempts && $attempts < 1) {
|
if (null !== $attempts) {
|
||||||
throw new InvalidArgumentException('Maximum number of attempts must be a positive value.');
|
$attempts = (int) $attempts;
|
||||||
|
if ($attempts < 1) {
|
||||||
|
throw new InvalidArgumentException('Maximum number of attempts must be a positive value.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->attempts = $attempts;
|
$this->attempts = $attempts;
|
||||||
|
Reference in New Issue
Block a user