diff --git a/tests/PHPStan/Type/Constant/ConstantArrayTypeTest.php b/tests/PHPStan/Type/Constant/ConstantArrayTypeTest.php index c0ecc6e78d..29f20e4b9a 100644 --- a/tests/PHPStan/Type/Constant/ConstantArrayTypeTest.php +++ b/tests/PHPStan/Type/Constant/ConstantArrayTypeTest.php @@ -1594,18 +1594,15 @@ public function testEqualsTreatsLegacyNullAndSealedMarkerAsEqual(): void public function testSealedness(): void { - $bleedingEdgeBackup = BleedingEdgeToggle::isBleedingEdge(); - - BleedingEdgeToggle::setBleedingEdge(false); - - try { + BleedingEdgeToggle::withBleedingEdge(false, function () { $builder = ConstantArrayTypeBuilder::createEmpty(); $array = $builder->getArray(); $this->assertInstanceOf(ConstantArrayType::class, $array); $this->assertSame(TrinaryLogic::createMaybe()->describe(), $array->isSealed()->describe()); $this->assertSame(TrinaryLogic::createMaybe()->describe(), $array->isUnsealed()->describe()); + }); - BleedingEdgeToggle::setBleedingEdge(true); + BleedingEdgeToggle::withBleedingEdge(true, function () { $builder = ConstantArrayTypeBuilder::createEmpty(); $array = $builder->getArray(); $this->assertInstanceOf(ConstantArrayType::class, $array); @@ -1619,9 +1616,7 @@ public function testSealedness(): void // (see ConstantArrayTypeBuilder::getArray). $this->assertInstanceOf(ArrayType::class, $array); $this->assertSame('array', $array->describe(VerbosityLevel::precise())); - } finally { - BleedingEdgeToggle::setBleedingEdge($bleedingEdgeBackup); - } + }); } public static function dataGetArraySize(): iterable