Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
SCIF committed Mar 25, 2022
1 parent de2f82a commit 5be3195
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
7 changes: 1 addition & 6 deletions psalm-baseline.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="dev-master@ce643859134338d6527992a18bc64223866dd22e">
<files psalm-version="dev-master@f7fc28bf5c23969ef1d9c8fd26f020ade0a2db9e">
<file src="examples/TemplateChecker.php">
<PossiblyUndefinedIntArrayOffset occurrences="2">
<code>$comment_block-&gt;tags['variablesfrom'][0]</code>
Expand Down Expand Up @@ -67,11 +67,6 @@
<code>$traverser-&gt;traverse([$switch_condition])[0]</code>
</PossiblyUndefinedIntArrayOffset>
</file>
<file src="src/Psalm/Internal/Analyzer/Statements/Block/TryAnalyzer.php">
<InvalidPropertyAssignmentValue occurrences="1">
<code>$catch_context-&gt;assigned_var_ids += $old_catch_assigned_var_ids</code>
</InvalidPropertyAssignmentValue>
</file>
<file src="src/Psalm/Internal/Analyzer/Statements/Expression/AssertionFinder.php">
<PossiblyUndefinedIntArrayOffset occurrences="34">
<code>$assertion-&gt;rule[0]</code>
Expand Down
Expand Up @@ -99,14 +99,16 @@ public static function analyze(
$keys = array_keys($clause->possibilities);
$mixed_var_ids = array_diff($mixed_var_ids, $keys);

foreach ($keys as $key => $_clause) {
foreach ($keys as $key) {
foreach ($mixed_var_ids as $mixed_var_id) {
if (preg_match('/^' . preg_quote($mixed_var_id, '/') . '(\[|-)/', $key)) {
$elseif_clauses_handled[] = new Clause([], $elseif_cond_id, $elseif_cond_id, true);
continue 3;
break 2;
}
}
}

$elseif_clauses_handled[] = $clause;
}

$elseif_clauses = $elseif_clauses_handled;
Expand Down Expand Up @@ -143,7 +145,7 @@ public static function analyze(
$elseif_context_clauses = array_values(
array_filter(
$elseif_context_clauses,
static fn($c): bool => !in_array($c->hash, $reconciled_expression_clauses)
static fn(Clause $c): bool => !in_array($c->hash, $reconciled_expression_clauses, true)
)
);
}
Expand All @@ -155,7 +157,7 @@ public static function analyze(
try {
if (array_filter(
$entry_clauses,
static fn($clause): bool => (bool) $clause->possibilities
static fn(Clause $clause): bool => (bool) $clause->possibilities
)) {
$omit_keys = array_reduce(
$entry_clauses,
Expand Down
Expand Up @@ -1563,7 +1563,8 @@ private static function handleArrayAccessOnKeyedArray(
$formatted_keys = implode(
', ',
array_map(
static fn($key): string => is_int($key) ? $key : '\'' . $key . '\'',
/** @param int|string $key */
static fn($key): string => is_int($key) ? "$key" : '\'' . $key . '\'',
$object_like_keys
)
);
Expand Down

0 comments on commit 5be3195

Please sign in to comment.