Skip to content

Commit 9fcd620

Browse files
committed
review: replaced optional Filter dependency in concurrency parsing
1 parent ca0a1e7 commit 9fcd620

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

run-tests.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3377,13 +3377,13 @@ function parse_max_concurrency(string $text, string $file): int
33773377
{
33783378
// Strip comments
33793379
$text = trim(preg_replace('/#.*/', '', $text));
3380-
$maxConcurrency = filter_var($text, FILTER_VALIDATE_INT, [
3381-
'options' => ['min_range' => 1],
3382-
]);
3383-
if ($maxConcurrency === false) {
3380+
if (
3381+
preg_match('/^[1-9][0-9]*$/D', $text) !== 1
3382+
|| (string) (int) $text !== $text
3383+
) {
33843384
error("Invalid positive integer in $file");
33853385
}
3386-
return $maxConcurrency;
3386+
return (int) $text;
33873387
}
33883388

33893389
function show_result(

0 commit comments

Comments
 (0)