Skip to content
Permalink
Browse files

Fix unset bug

  • Loading branch information...
muglug committed May 13, 2019
1 parent bfcf3cd commit c6e29322c0983e72828730c4ec58e81216d4968a
Showing with 13 additions and 0 deletions.
  1. +2 −0 src/Psalm/Internal/Analyzer/StatementsAnalyzer.php
  2. +11 −0 tests/RedundantConditionTest.php
@@ -848,6 +848,8 @@ private function analyzeUnset(PhpParser\Node\Stmt\Unset_ $stmt, Context $context
}
}
} else {
$atomic_root_type->sealed = false;
$root_type->addType(
$atomic_root_type->getGenericArrayType()
);
@@ -572,6 +572,17 @@ function foo(?string $s) : string {
}
}'
],
'possiblyUpdateArrayAfterUnset' => [
'<?php
/**
* @param string[] $arr
*/
function foo(string $s) : void {
$dict = ["a" => 1];
unset($dict[$s]);
if (count($dict)) {}
}'
],
];
}

0 comments on commit c6e2932

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