Skip to content

Commit eb9c158

Browse files
Merge branch '4.4' into 5.1
* 4.4: [Debug] fix test consistently use same types for strict comparisons [PhpUnitBridge] Skip internal classes in CoverageListenerTrait [VarExporter] unserialize() might throw an Exception on php 8. [ErrorHandler] Parse "x not found" errors correctly on php 8. Prevent parsing invalid octal digits as octal numbers remove unnecessary check for existing request [DI] fix ContainerBuilder on PHP8 [Console] Make sure $maxAttempts is an int or null. [VarDumper] Fix caster for invalid SplFileInfo objects on php 8. [Intl] Skip test cases that produce a TypeError on php 8. [PhpUnitBridge] Adjust output parsing for PHPUnit 9.3. [PhpUnitBridge] CoverageListenerTrait update for PHPUnit 8.5/9.x add bosnian (bs) translation [Debug] Parse "x not found" errors correctly on php 8.
2 parents bc882da + 903b243 commit eb9c158

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Question/Question.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,11 @@ public function getValidator()
213213
*/
214214
public function setMaxAttempts(?int $attempts)
215215
{
216-
if (null !== $attempts && $attempts < 1) {
217-
throw new InvalidArgumentException('Maximum number of attempts must be a positive value.');
216+
if (null !== $attempts) {
217+
$attempts = (int) $attempts;
218+
if ($attempts < 1) {
219+
throw new InvalidArgumentException('Maximum number of attempts must be a positive value.');
220+
}
218221
}
219222

220223
$this->attempts = $attempts;

0 commit comments

Comments
 (0)