Skip to content

Commit 7b2b956

Browse files
committed
fix
1 parent 4c4b293 commit 7b2b956

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/Analyser/TypeSpecifier.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -715,8 +715,9 @@ public function specifyTypesInCondition(
715715
continue;
716716
}
717717

718+
$hasOffsetType = $type->hasOffsetValueType($dimType);
718719
$offsetType = $type->getOffsetValueType($dimType);
719-
if (!TypeCombinator::containsNull($offsetType)) {
720+
if ($hasOffsetType->yes() && !TypeCombinator::containsNull($offsetType)) {
720721
$specifiedTypes = $specifiedTypes->unionWith($this->create(
721722
new NotIssetExpr($var),
722723
new ErrorType(),

tests/PHPStan/Analyser/data/falsy-isset.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function optionalOffsetNonNull($a): void
6161
}
6262

6363
assertVariableCertainty(TrinaryLogic::createYes(), $a);
64-
assertType("array{bar?: null}|array{bar: 1}", $a);
64+
assertType("array{}|array{bar: 1}", $a);
6565
}
6666

6767
public function maybeCertainNull(): void

0 commit comments

Comments
 (0)