Skip to content

Commit 8bc7c38

Browse files
committed
Update IntersectionType.php
1 parent 7525103 commit 8bc7c38

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/Type/IntersectionType.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,7 @@ public function getIterableValueType(): Type
806806
$result,
807807
new UnionType([
808808
new ObjectWithoutClassType(),
809-
new IntersectionType([new StringType(), new AccessoryNonEmptyStringType()]),
809+
new IntersectionType([new StringType(), new AccessoryNonFalsyStringType()]),
810810
]),
811811
);
812812
}
@@ -1009,9 +1009,9 @@ private function doGetOffsetValueType(Type $offsetType): Type
10091009
if ((new ConstantIntegerType(0))->isSuperTypeOf($arrayKeyOffsetType)->yes()) {
10101010
$narrowedType = new UnionType([new ClassStringType(), new ObjectWithoutClassType()]);
10111011
} elseif ((new ConstantIntegerType(1))->isSuperTypeOf($arrayKeyOffsetType)->yes()) {
1012-
$narrowedType = new StringType();
1012+
$narrowedType = new IntersectionType([new StringType(), new AccessoryNonFalsyStringType()]);
10131013
} else {
1014-
$narrowedType = new UnionType([new StringType(), new ObjectWithoutClassType()]);
1014+
$narrowedType = new UnionType([new IntersectionType([new StringType(), new AccessoryNonFalsyStringType()]), new ObjectWithoutClassType()]);
10151015
}
10161016
$result = TypeCombinator::intersect($result, $narrowedType);
10171017
}

0 commit comments

Comments
 (0)