From 7bf801f84e92d4c51a1d921de7dc6c8c938eb694 Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Tue, 27 Sep 2022 16:19:02 +0100 Subject: [PATCH] Fixes memory leak on Annotations registry --- src/Illuminate/Foundation/Testing/TestCase.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Illuminate/Foundation/Testing/TestCase.php b/src/Illuminate/Foundation/Testing/TestCase.php index 69d49280d2f0..c540407ce040 100644 --- a/src/Illuminate/Foundation/Testing/TestCase.php +++ b/src/Illuminate/Foundation/Testing/TestCase.php @@ -18,6 +18,7 @@ use Mockery\Exception\InvalidCountException; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase as BaseTestCase; +use PHPUnit\Util\Annotation\Registry; use ReflectionProperty; use Throwable; @@ -237,6 +238,11 @@ protected function tearDown(): void public static function tearDownAfterClass(): void { static::$latestResponse = null; + + (function () { + $this->classDocBlocks = []; + $this->methodDocBlocks = []; + })->call(Registry::getInstance()); } /**