From 623157c8ca06c0b7d529cba3a9d4adfe1b521057 Mon Sep 17 00:00:00 2001 From: Simon Podlipsky Date: Mon, 24 Aug 2026 16:05:13 +0200 Subject: [PATCH] test(type): isolate intersection test toggle state Construct legacy ConstantArrayType fixtures with bleeding edge disabled so reused ParaTest workers cannot change the expected acceptance results. --- tests/PHPStan/Type/IntersectionTypeTest.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/tests/PHPStan/Type/IntersectionTypeTest.php b/tests/PHPStan/Type/IntersectionTypeTest.php index 1d980af5918..342fda59575 100644 --- a/tests/PHPStan/Type/IntersectionTypeTest.php +++ b/tests/PHPStan/Type/IntersectionTypeTest.php @@ -5,6 +5,7 @@ use DoctrineIntersectionTypeIsSupertypeOf\Collection; use Iterator; use ObjectTypeEnums\FooEnum; +use PHPStan\DependencyInjection\BleedingEdgeToggle; use PHPStan\Testing\PHPStanTestCase; use PHPStan\TrinaryLogic; use PHPStan\Type\Accessory\AccessoryArrayListType; @@ -132,20 +133,20 @@ public static function dataIsAcceptedBy(): Iterator // array&callable isAcceptedBy constantArray{stdClass, string} - maybe yield [ new IntersectionType([new ArrayType(new MixedType(), new MixedType()), new CallableType()]), - new ConstantArrayType( + BleedingEdgeToggle::withBleedingEdge(false, static fn (): ConstantArrayType => new ConstantArrayType( [new ConstantIntegerType(0), new ConstantIntegerType(1)], [new UnionType([new ObjectType('stdClass'), new StringType()]), new StringType()], - ), + )), TrinaryLogic::createMaybe(), ]; // array&callable isAcceptedBy constantArray{string, string} - maybe yield [ new IntersectionType([new ArrayType(new MixedType(), new MixedType()), new CallableType()]), - new ConstantArrayType( + BleedingEdgeToggle::withBleedingEdge(false, static fn (): ConstantArrayType => new ConstantArrayType( [new ConstantIntegerType(0), new ConstantIntegerType(1)], [new StringType(), new StringType()], - ), + )), TrinaryLogic::createMaybe(), ]; @@ -189,10 +190,10 @@ public static function dataIsAcceptedBy(): Iterator new NonEmptyArrayType(), new HasOffsetValueType(new ConstantIntegerType(0), new IntegerType()), ]), - new ConstantArrayType( + BleedingEdgeToggle::withBleedingEdge(false, static fn (): ConstantArrayType => new ConstantArrayType( [new ConstantIntegerType(0), new ConstantIntegerType(1)], [new IntegerType(), new IntegerType()], - ), + )), TrinaryLogic::createMaybe(), ]; @@ -203,10 +204,10 @@ public static function dataIsAcceptedBy(): Iterator new NonEmptyArrayType(), new HasOffsetValueType(new ConstantIntegerType(0), new IntegerType()), ]), - new ConstantArrayType( + BleedingEdgeToggle::withBleedingEdge(false, static fn (): ConstantArrayType => new ConstantArrayType( [new ConstantIntegerType(0), new ConstantIntegerType(1)], [new StringType(), new StringType()], - ), + )), TrinaryLogic::createNo(), ];