Skip to content

Commit

Permalink
Use array_pop instead of slow array_shift
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek authored and sebastianbergmann committed Jun 20, 2024
1 parent 1282659 commit 933af56
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Framework/TestSuite.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
use const PHP_EOL;
use function array_keys;
use function array_map;
use function array_shift;
use function array_pop;
use function array_reverse;
use function assert;
use function call_user_func;
use function class_exists;
Expand Down Expand Up @@ -356,10 +357,12 @@ public function run(): void
$tests[] = $test;
}

$tests = array_reverse($tests);

$this->tests = [];
$this->groups = [];

while ($test = array_shift($tests)) {
while (($test = array_pop($tests)) !== false) {
if (TestResultFacade::shouldStop()) {
$emitter->testRunnerExecutionAborted();

Expand Down

0 comments on commit 933af56

Please sign in to comment.