From 933af567cd3f9e1cfdcbcdf13f999938a64c0dbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= Date: Thu, 20 Jun 2024 10:07:46 +0200 Subject: [PATCH] Use array_pop instead of slow array_shift --- src/Framework/TestSuite.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Framework/TestSuite.php b/src/Framework/TestSuite.php index 6f9fc6e3300..caad08b5080 100644 --- a/src/Framework/TestSuite.php +++ b/src/Framework/TestSuite.php @@ -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; @@ -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();