Skip to content

Commit

Permalink
code review init variables
Browse files Browse the repository at this point in the history
  • Loading branch information
kkmuffme committed Jun 2, 2023
1 parent 322878b commit fa644cb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Psalm/Internal/Algebra.php
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ public static function simplifyCNF(array $clauses): array
/**
* Look for clauses with only one possible value
*
* doesn't infer the "unset" correctly
* @psalm-suppress MoreSpecificReturnType
* @param list<Clause> $clauses
* @param array<string, bool> $cond_referenced_var_ids
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2336,6 +2336,8 @@ private static function getTrueInequalityAssertions(
$if_types = $if_types ? [$if_types] : [];

if ($if_types === [] && count($notif_types) === 2) {
$check_var_assertion = null;
$check_var = null;
foreach ($notif_types as $notif_type) {
foreach ($notif_type as $var => $assertions) {
if (count($assertions) !== 1 || count($assertions[0]) !== 1) {
Expand Down Expand Up @@ -3066,6 +3068,8 @@ private static function getFalseEqualityAssertions(
// @todo optionally extend this to arbitrary number of assert-if cases of multiple variables in the function
// same code above too
if ($if_types === [] && count($notif_types) === 2) {
$check_var_assertion = null;
$check_var = null;
foreach ($notif_types as $notif_type) {
foreach ($notif_type as $var => $assertions) {
if (count($assertions) !== 1 || count($assertions[0]) !== 1) {
Expand Down

0 comments on commit fa644cb

Please sign in to comment.