Skip to content
This repository was archived by the owner on Jan 31, 2023. It is now read-only.

Commit 8ad74ab

Browse files
committed
Improve error handling for unknown cases
1 parent 9ad145c commit 8ad74ab

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

lib/php/libsdk/SDK/Build/PGO/Controller.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,15 +210,18 @@ public function train()
210210
foreach (new TrainingCaseIterator($this->conf) as $handler) {
211211
$name = $handler->getName();
212212
/* Just a white list handling for now. */
213-
if ($cases && !in_array($name, $cases)) {
214-
continue;
213+
if (is_array($cases)) {
214+
if (!in_array($name, $cases)) {
215+
continue;
216+
}
217+
$key = array_search($name, $cases);
218+
unset($cases[$key]);
215219
}
216-
unset($cases[array_search($name, $cases)]);
217220

218221
echo "\n";
219222
$handler->run();
220223
}
221-
if (!empty($cases)) {
224+
if (is_array($cases) && !empty($cases)) {
222225
echo "\n\033[31m WARNING: The cases " . implode(",", $cases) . " don't exist and was ignored!\033[0m\n\n";
223226
}
224227

0 commit comments

Comments
 (0)