Skip to content

Commit 056afc8

Browse files
AyeshGirgias
authored andcommittedJul 22, 2022
[run-tests.php] Minor optimizations in if blocks by placing simple expressions first
1 parent 51447fb commit 056afc8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎run-tests.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ function main(): void
419419
switch ($switch) {
420420
case 'j':
421421
$workers = substr($argv[$i], 2);
422-
if (!preg_match('/^\d+$/', $workers) || $workers == 0) {
422+
if ($workers == 0 || !preg_match('/^\d+$/', $workers)) {
423423
error("'$workers' is not a valid number of workers, try e.g. -j16 for 16 workers");
424424
}
425425
$workers = intval($workers, 10);
@@ -2424,7 +2424,7 @@ function run_test(string $php, $file, array $env): string
24242424

24252425
// Remember CLEAN output to report borked test if it otherwise passes.
24262426
$clean_output = null;
2427-
if ($test->sectionNotEmpty('CLEAN') && (!$no_clean || $cfg['keep']['clean'])) {
2427+
if ((!$no_clean || $cfg['keep']['clean']) && $test->sectionNotEmpty('CLEAN')) {
24282428
show_file_block('clean', $test->getSection('CLEAN'));
24292429
save_text($test_clean, trim($test->getSection('CLEAN')), $temp_clean);
24302430

0 commit comments

Comments
 (0)
Please sign in to comment.