Skip to content

Commit 623157c

Browse files
committed
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.
1 parent 4177ab7 commit 623157c

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

‎tests/PHPStan/Type/IntersectionTypeTest.php‎

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use DoctrineIntersectionTypeIsSupertypeOf\Collection;
66
use Iterator;
77
use ObjectTypeEnums\FooEnum;
8+
use PHPStan\DependencyInjection\BleedingEdgeToggle;
89
use PHPStan\Testing\PHPStanTestCase;
910
use PHPStan\TrinaryLogic;
1011
use PHPStan\Type\Accessory\AccessoryArrayListType;
@@ -132,20 +133,20 @@ public static function dataIsAcceptedBy(): Iterator
132133
// array&callable isAcceptedBy constantArray{stdClass, string} - maybe
133134
yield [
134135
new IntersectionType([new ArrayType(new MixedType(), new MixedType()), new CallableType()]),
135-
new ConstantArrayType(
136+
BleedingEdgeToggle::withBleedingEdge(false, static fn (): ConstantArrayType => new ConstantArrayType(
136137
[new ConstantIntegerType(0), new ConstantIntegerType(1)],
137138
[new UnionType([new ObjectType('stdClass'), new StringType()]), new StringType()],
138-
),
139+
)),
139140
TrinaryLogic::createMaybe(),
140141
];
141142

142143
// array&callable isAcceptedBy constantArray{string, string} - maybe
143144
yield [
144145
new IntersectionType([new ArrayType(new MixedType(), new MixedType()), new CallableType()]),
145-
new ConstantArrayType(
146+
BleedingEdgeToggle::withBleedingEdge(false, static fn (): ConstantArrayType => new ConstantArrayType(
146147
[new ConstantIntegerType(0), new ConstantIntegerType(1)],
147148
[new StringType(), new StringType()],
148-
),
149+
)),
149150
TrinaryLogic::createMaybe(),
150151
];
151152

@@ -189,10 +190,10 @@ public static function dataIsAcceptedBy(): Iterator
189190
new NonEmptyArrayType(),
190191
new HasOffsetValueType(new ConstantIntegerType(0), new IntegerType()),
191192
]),
192-
new ConstantArrayType(
193+
BleedingEdgeToggle::withBleedingEdge(false, static fn (): ConstantArrayType => new ConstantArrayType(
193194
[new ConstantIntegerType(0), new ConstantIntegerType(1)],
194195
[new IntegerType(), new IntegerType()],
195-
),
196+
)),
196197
TrinaryLogic::createMaybe(),
197198
];
198199

@@ -203,10 +204,10 @@ public static function dataIsAcceptedBy(): Iterator
203204
new NonEmptyArrayType(),
204205
new HasOffsetValueType(new ConstantIntegerType(0), new IntegerType()),
205206
]),
206-
new ConstantArrayType(
207+
BleedingEdgeToggle::withBleedingEdge(false, static fn (): ConstantArrayType => new ConstantArrayType(
207208
[new ConstantIntegerType(0), new ConstantIntegerType(1)],
208209
[new StringType(), new StringType()],
209-
),
210+
)),
210211
TrinaryLogic::createNo(),
211212
];
212213

0 commit comments

Comments
 (0)