N°9319 increase php min. version to 8.2 (#887)

* Update minimum PHP version to 8.2
* Fix previous wrong resolution of merge conflict
This commit is contained in:
jf-cbd
2026-04-20 14:47:44 +02:00
committed by GitHub
parent f439490bfc
commit 805087a01b
171 changed files with 5629 additions and 1446 deletions

View File

@@ -12,10 +12,12 @@
namespace Symfony\Bundle\FrameworkBundle\Test;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\Resource\SelfCheckingResourceChecker;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Contracts\Service\ResetInterface;
@@ -38,6 +40,8 @@ abstract class KernelTestCase extends TestCase
protected static $booted = false;
private static bool $kernelHasBeenRebooted = false;
protected function tearDown(): void
{
static::ensureKernelShutdown();
@@ -88,6 +92,7 @@ abstract class KernelTestCase extends TestCase
// reboot a fresh one.
if ($kernel->getContainer()->initialized('cache_warmer')) {
static::ensureKernelShutdown();
self::$kernelHasBeenRebooted = true;
$kernel = static::createKernel($options);
$kernel->boot();
@@ -161,6 +166,20 @@ abstract class KernelTestCase extends TestCase
static::$kernel->shutdown();
static::$booted = false;
if (self::$kernelHasBeenRebooted) {
self::$kernelHasBeenRebooted = false;
try {
(new \ReflectionProperty(Kernel::class, 'freshCache'))->setValue(null, []);
} catch (\ReflectionException) {
// ignore if the property doesn't exist
}
try {
(new \ReflectionProperty(SelfCheckingResourceChecker::class, 'cache'))->setValue(null, []);
} catch (\ReflectionException) {
// ignore if the property doesn't exist
}
}
if ($container instanceof ResetInterface) {
$container->reset();
}