File tree Expand file tree Collapse file tree 2 files changed +3
-2
lines changed
tests/PHPStan/Analyser/data Expand file tree Collapse file tree 2 files changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -715,8 +715,9 @@ public function specifyTypesInCondition(
715715continue ;
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 (
721722new NotIssetExpr ($ var ),
722723new ErrorType (),
Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ public function optionalOffsetNonNull($a): void
6161}
6262
6363assertVariableCertainty (TrinaryLogic::createYes (), $ a );
64- assertType ("array{bar?: null }|array{bar: 1} " , $ a );
64+ assertType ("array{}|array{bar: 1} " , $ a );
6565}
6666
6767public function maybeCertainNull (): void
You can’t perform that action at this time.
0 commit comments