Skip to content

Commit 4c36e11

Browse files
committed
Revert "Narrow type on setting offsets of properties"
This reverts commit 17d4a03.
1 parent 3e78ccf commit 4c36e11

File tree

1 file changed

+6
-22
lines changed

1 file changed

+6
-22
lines changed

src/Analyser/NodeScopeResolver.php

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5610,17 +5610,9 @@ private function processAssignVar(
56105610
$originalVar = $var;
56115611
$assignedPropertyExpr = $assignedExpr;
56125612
while ($var instanceof ArrayDimFetch) {
5613-
if (
5614-
$var->var instanceof PropertyFetch
5615-
|| $var->var instanceof StaticPropertyFetch
5616-
) {
5617-
if (((new ObjectType(ArrayAccess::class))->isSuperTypeOf($scope->getType($var->var))->yes())) {
5618-
$varForSetOffsetValue = $var->var;
5619-
} else {
5620-
$varForSetOffsetValue = new OriginalPropertyTypeExpr($var->var);
5621-
}
5622-
} else {
5623-
$varForSetOffsetValue = $var->var;
5613+
$varForSetOffsetValue = $var->var;
5614+
if ($varForSetOffsetValue instanceof PropertyFetch || $varForSetOffsetValue instanceof StaticPropertyFetch) {
5615+
$varForSetOffsetValue = new OriginalPropertyTypeExpr($varForSetOffsetValue);
56245616
}
56255617

56265618
if (
@@ -6034,17 +6026,9 @@ static function (): void {
60346026
$dimFetchStack = [];
60356027
$assignedPropertyExpr = $assignedExpr;
60366028
while ($var instanceof ExistingArrayDimFetch) {
6037-
if (
6038-
$var->getVar() instanceof PropertyFetch
6039-
|| $var->getVar() instanceof StaticPropertyFetch
6040-
) {
6041-
if (((new ObjectType(ArrayAccess::class))->isSuperTypeOf($scope->getType($var->getVar()))->yes())) {
6042-
$varForSetOffsetValue = $var->getVar();
6043-
} else {
6044-
$varForSetOffsetValue = new OriginalPropertyTypeExpr($var->getVar());
6045-
}
6046-
} else {
6047-
$varForSetOffsetValue = $var->getVar();
6029+
$varForSetOffsetValue = $var->getVar();
6030+
if ($varForSetOffsetValue instanceof PropertyFetch || $varForSetOffsetValue instanceof StaticPropertyFetch) {
6031+
$varForSetOffsetValue = new OriginalPropertyTypeExpr($varForSetOffsetValue);
60486032
}
60496033
$assignedPropertyExpr = new SetExistingOffsetValueTypeExpr(
60506034
$varForSetOffsetValue,

0 commit comments

Comments
 (0)