From 0af23667d9f3c1616c2979cae598c64c356dca64 Mon Sep 17 00:00:00 2001 From: Thomas Calvet Date: Mon, 29 Nov 2021 13:29:37 +0100 Subject: [PATCH] Fix redundant type casts --- Question/Question.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Question/Question.php b/Question/Question.php index 04d2d411d..553be3404 100644 --- a/Question/Question.php +++ b/Question/Question.php @@ -105,7 +105,7 @@ public function setHidden(bool $hidden) throw new LogicException('A hidden question cannot use the autocompleter.'); } - $this->hidden = (bool) $hidden; + $this->hidden = $hidden; return $this; } @@ -127,7 +127,7 @@ public function isHiddenFallback() */ public function setHiddenFallback(bool $fallback) { - $this->hiddenFallback = (bool) $fallback; + $this->hiddenFallback = $fallback; return $this; } @@ -230,11 +230,8 @@ public function getValidator() */ public function setMaxAttempts(?int $attempts) { - if (null !== $attempts) { - $attempts = (int) $attempts; - if ($attempts < 1) { - throw new InvalidArgumentException('Maximum number of attempts must be a positive value.'); - } + if (null !== $attempts && $attempts < 1) { + throw new InvalidArgumentException('Maximum number of attempts must be a positive value.'); } $this->attempts = $attempts;