Skip to content
Permalink
Browse files

Add protection for leaky assertions

  • Loading branch information...
muglug committed Aug 10, 2019
1 parent 0347997 commit 1586cb249ddd01dde88f378da4e5a3ea275fe8d9
@@ -1316,6 +1316,10 @@ private static function reconcileArray(
$code_location,
$suppressed_issues
);
if (!$did_remove_type) {
$failed_reconciliation = 1;
}
}
}
@@ -283,6 +283,8 @@ function (array $new_type_part_parts) {
$code_location,
$suppressed_issues
);
} elseif (!$has_negation) {
$changed_var_ids[] = $key;
}
if ($failed_reconciliation === 2) {
@@ -1406,7 +1406,18 @@ function takesTraversable (Traversable $x): void {}
$x = null;
assert($x instanceof Traversable);
takesTraversable($x);',
]
],
'dontReconcileArrayOffset' => [
'<?php
/** @psalm-suppress TypeDoesNotContainType */
function foo(array $a) : void {
if (!is_array($a)) {
return;
}
if ($a[0] === 5) {}
}'
],
];
}

0 comments on commit 1586cb2

Please sign in to comment.
You can’t perform that action at this time.