1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 04:45:20 +01:00

code review init variables

This commit is contained in:
kkmuffme 2023-06-02 08:54:00 +02:00
parent 322878b1d7
commit fa644cbb34
2 changed files with 5 additions and 0 deletions

View File

@ -325,6 +325,7 @@ class Algebra
/**
* 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

View File

@ -2336,6 +2336,8 @@ class AssertionFinder
$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) {
@ -3066,6 +3068,8 @@ class AssertionFinder
// @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) {