Skip to content

Commit 24eefc8

Browse files
committed
fix remaining part of bug8282
1 parent 993b045 commit 24eefc8

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/Type/IntersectionType.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -802,6 +802,9 @@ public function setOffsetValueType(?Type $offsetType, Type $valueType, bool $uni
802802
}
803803

804804
$result = $this->intersectTypes(static fn (Type $type): Type => $type->setOffsetValueType($offsetType, $valueType, $unionValues));
805+
if ($this->isList()->yes() && $valueType->isArray()->yes()) {
806+
$result = TypeCombinator::intersect($result, new AccessoryArrayListType());
807+
}
805808

806809
if (
807810
$offsetType !== null

tests/PHPStan/Rules/Properties/data/bug-8282.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ public function __construct(
1414
{
1515
}
1616

17+
public function updateName(int $index, string $name): void
18+
{
19+
assert(isset($this->list[$index]));
20+
$this->list[$index]['name'] = $name;
21+
}
22+
1723
public function updateNameById(int $id, string $name): void
1824
{
1925
foreach ($this->list as $index => $entry) {

0 commit comments

Comments
 (0)