Skip to content

Commit d09ba21

Browse files
committed
improve return type
1 parent f4a2e33 commit d09ba21

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

benchmark/benchmark.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,15 @@ function runValgrindPhpCgiCommand(
136136
return ['instructions' => $instructions];
137137
}
138138

139+
/**
140+
* @return decimal-int-string
141+
*/
139142
function extractInstructionsFromValgrindOutput(string $output): string {
140-
preg_match("(==[0-9]+== Events : Ir\n==[0-9]+== Collected : (?<instructions>[0-9]+))", $output, $matches);
141-
return $matches['instructions'] ?? throw new \Exception('Unexpected valgrind output');
143+
if (!preg_match("(==[0-9]+== Events : Ir\n==[0-9]+== Collected : (?<instructions>[0-9]+))", $output, $matches)) {
144+
throw new \Exception('Unexpected valgrind output');
145+
}
146+
147+
return $matches['instructions'];
142148
}
143149

144150
main();

0 commit comments

Comments
 (0)