Skip to content

Commit 89dbdf9

Browse files
staabmondrejmirtes
authored andcommitted
NodeScopeResolver: faster produceArrayDimFetchAssignValueToWrite()
1 parent 417e1d8 commit 89dbdf9

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/Analyser/NodeScopeResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6604,7 +6604,7 @@ private function produceArrayDimFetchAssignValueToWrite(array $dimFetchStack, ar
66046604
$offsetValueType = array_pop($offsetValueTypeStack);
66056605
if (
66066606
!$offsetValueType instanceof MixedType
6607-
&& !$offsetValueType->isConstantArray()->yes()
6607+
&& !$offsetValueType->isArray()->yes()
66086608
) {
66096609
$types = [
66106610
new ArrayType(new MixedType(), new MixedType()),

tests/PHPStan/Analyser/nsrt/bug-13270b-php8.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function parseData(array $data): array
1919
if (!array_key_exists('priceWithVat', $data['price'])) {
2020
$data['price']['priceWithVat'] = null;
2121
}
22-
assertType("non-empty-array&hasOffsetValue('priceWithVat', mixed)", $data['price']);
22+
assertType("non-empty-array&hasOffset('priceWithVat')", $data['price']);
2323
if (!array_key_exists('priceWithoutVat', $data['price'])) {
2424
$data['price']['priceWithoutVat'] = null;
2525
}

tests/PHPStan/Analyser/nsrt/superglobals.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function canBePartlyOverwritten(): void
3232
{
3333
$GLOBALS['foo'] = 'foo';
3434
assertType("non-empty-array&hasOffsetValue('foo', 'foo')", $GLOBALS);
35-
assertNativeType("non-empty-array&hasOffsetValue('foo', 'foo')", $GLOBALS);
35+
assertNativeType("non-empty-array<mixed>&hasOffsetValue('foo', 'foo')", $GLOBALS);
3636
}
3737

3838
public function canBeNarrowed(): void

0 commit comments

Comments
 (0)