Skip to content

Commit

Permalink
Allow unset of potentially invalid array key type
Browse files Browse the repository at this point in the history
  • Loading branch information
muglug committed Aug 18, 2019
1 parent 9d62971 commit 1b983ba
Showing 1 changed file with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1023,15 +1023,17 @@ public static function getArrayAccessTypeGivenOffset(
if ($has_valid_offset && $context->inside_isset) {
// do nothing
} elseif ($has_valid_offset) {
if (IssueBuffer::accepts(
new PossiblyInvalidArrayOffset(
'Cannot access value on variable ' . $array_var_id . ' ' . $used_offset
. ', expecting ' . $invalid_offset_type,
new CodeLocation($statements_analyzer->getSource(), $stmt)
),
$statements_analyzer->getSuppressedIssues()
)) {
// fall through
if (!$context->inside_unset) {
if (IssueBuffer::accepts(
new PossiblyInvalidArrayOffset(
'Cannot access value on variable ' . $array_var_id . ' ' . $used_offset
. ', expecting ' . $invalid_offset_type,
new CodeLocation($statements_analyzer->getSource(), $stmt)
),
$statements_analyzer->getSuppressedIssues()
)) {
// fall through
}
}
} else {
if (IssueBuffer::accepts(
Expand Down

0 comments on commit 1b983ba

Please sign in to comment.