Skip to content

Commit 933af56

Browse files
mvoriseksebastianbergmann
authored andcommitted
Use array_pop instead of slow array_shift
1 parent 1282659 commit 933af56

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/Framework/TestSuite.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
use const PHP_EOL;
1313
use function array_keys;
1414
use function array_map;
15-
use function array_shift;
15+
use function array_pop;
16+
use function array_reverse;
1617
use function assert;
1718
use function call_user_func;
1819
use function class_exists;
@@ -356,10 +357,12 @@ public function run(): void
356357
$tests[] = $test;
357358
}
358359

360+
$tests = array_reverse($tests);
361+
359362
$this->tests = [];
360363
$this->groups = [];
361364

362-
while ($test = array_shift($tests)) {
365+
while (($test = array_pop($tests)) !== false) {
363366
if (TestResultFacade::shouldStop()) {
364367
$emitter->testRunnerExecutionAborted();
365368

0 commit comments

Comments
 (0)