Skip to content

Commit 364bd34

Browse files
simPodondrejmirtes
authored andcommitted
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 091c5a7 commit 364bd34

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
@@ -8,6 +8,7 @@
88
use Iterator;
99
use ObjectTypeEnums\FooEnum;
1010
use PHPStan\Analyser\OutOfClassScope;
11+
use PHPStan\DependencyInjection\BleedingEdgeToggle;
1112
use PHPStan\Testing\PHPStanTestCase;
1213
use PHPStan\TrinaryLogic;
1314
use PHPStan\Type\Accessory\AccessoryArrayListType;
@@ -142,20 +143,20 @@ public static function dataIsAcceptedBy(): Iterator
142143
// array&callable isAcceptedBy constantArray{stdClass, 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 UnionType([new ObjectType('stdClass'), new StringType()]), new StringType()],
148-
),
149+
)),
149150
TrinaryLogic::createMaybe(),
150151
];
151152

152153
// array&callable isAcceptedBy constantArray{string, string} - maybe
153154
yield [
154155
new IntersectionType([new ArrayType(new MixedType(), new MixedType()), new CallableType()]),
155-
new ConstantArrayType(
156+
BleedingEdgeToggle::withBleedingEdge(false, static fn (): ConstantArrayType => new ConstantArrayType(
156157
[new ConstantIntegerType(0), new ConstantIntegerType(1)],
157158
[new StringType(), new StringType()],
158-
),
159+
)),
159160
TrinaryLogic::createMaybe(),
160161
];
161162

@@ -199,10 +200,10 @@ public static function dataIsAcceptedBy(): Iterator
199200
new NonEmptyArrayType(),
200201
new HasOffsetValueType(new ConstantIntegerType(0), new IntegerType()),
201202
]),
202-
new ConstantArrayType(
203+
BleedingEdgeToggle::withBleedingEdge(false, static fn (): ConstantArrayType => new ConstantArrayType(
203204
[new ConstantIntegerType(0), new ConstantIntegerType(1)],
204205
[new IntegerType(), new IntegerType()],
205-
),
206+
)),
206207
TrinaryLogic::createMaybe(),
207208
];
208209

@@ -213,10 +214,10 @@ public static function dataIsAcceptedBy(): Iterator
213214
new NonEmptyArrayType(),
214215
new HasOffsetValueType(new ConstantIntegerType(0), new IntegerType()),
215216
]),
216-
new ConstantArrayType(
217+
BleedingEdgeToggle::withBleedingEdge(false, static fn (): ConstantArrayType => new ConstantArrayType(
217218
[new ConstantIntegerType(0), new ConstantIntegerType(1)],
218219
[new StringType(), new StringType()],
219-
),
220+
)),
220221
TrinaryLogic::createNo(),
221222
];
222223

0 commit comments

Comments
 (0)