Skip to content

Commit

Permalink
refactor: remove gc_collect_cycles() called twice for PHP < 8.1
Browse files Browse the repository at this point in the history
Since #162 we only support PHP 8.1 and PHP 8.2
This code added in #124  is only for PHP 8.0 and PHP 7.4
  • Loading branch information
sad270 committed Aug 2, 2023
1 parent cfaf91a commit 3ceeced
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions src/CollectTestExecutionMemoryFootprints.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
use function memory_get_usage;
use function sprintf;

use const PHP_VERSION_ID;

/**
* Note: we need to implement TestListener, because the hook API is not allowing
* us to interact with test suite instances. This means that the entire package
Expand Down Expand Up @@ -52,19 +50,13 @@ public function startTestSuite(TestSuite $suite): void
public function executeBeforeTest(string $test): void
{
gc_collect_cycles();
if (PHP_VERSION_ID < 80100) {
gc_collect_cycles();
}

$this->preTestMemoryUsages[$test][] = memory_get_usage();
}

public function executeAfterSuccessfulTest(string $test, float $time): void
{
gc_collect_cycles();
if (PHP_VERSION_ID < 80100) {
gc_collect_cycles();
}

$this->postTestMemoryUsages[$test][] = memory_get_usage();
}
Expand Down

0 comments on commit 3ceeced

Please sign in to comment.