Code Duplication    Length = 15-16 lines in 3 locations

src/Psalm/Internal/Analyzer/Statements/Expression/BinaryOp/OrAnalyzer.php 1 location

@@ 168-183 (lines=16) @@
165
166
        $right_context = clone $context;
167
168
        if ($negated_type_assertions) {
169
            // while in an or, we allow scope to boil over to support
170
            // statements of the form if ($x === null || $x->foo())
171
            $right_vars_in_scope = Reconciler::reconcileKeyedTypes(
172
                $negated_type_assertions,
173
                $active_negated_type_assertions,
174
                $right_context->vars_in_scope,
175
                $changed_var_ids,
176
                $left_referenced_var_ids,
177
                $statements_analyzer,
178
                [],
179
                $left_context->inside_loop,
180
                new CodeLocation($statements_analyzer->getSource(), $stmt)
181
            );
182
            $right_context->vars_in_scope = $right_vars_in_scope;
183
        }
184
185
        $right_context->clauses = $clauses_for_right_analysis;
186

src/Psalm/Internal/Analyzer/Statements/Expression/TernaryAnalyzer.php 2 locations

@@ 138-152 (lines=15) @@
135
136
        $changed_var_ids = [];
137
138
        if ($reconcilable_if_types) {
139
            $if_vars_in_scope_reconciled = Reconciler::reconcileKeyedTypes(
140
                $reconcilable_if_types,
141
                $active_if_types,
142
                $if_context->vars_in_scope,
143
                $changed_var_ids,
144
                $cond_referenced_var_ids,
145
                $statements_analyzer,
146
                $statements_analyzer->getTemplateTypeMap() ?: [],
147
                $if_context->inside_loop,
148
                new CodeLocation($statements_analyzer->getSource(), $stmt->cond)
149
            );
150
151
            $if_context->vars_in_scope = $if_vars_in_scope_reconciled;
152
        }
153
154
        $t_else_context = clone $context;
155
@@ 178-192 (lines=15) @@
175
            );
176
        }
177
178
        if ($negated_if_types) {
179
            $t_else_vars_in_scope_reconciled = Reconciler::reconcileKeyedTypes(
180
                $negated_if_types,
181
                $negated_if_types,
182
                $t_else_context->vars_in_scope,
183
                $changed_var_ids,
184
                $cond_referenced_var_ids,
185
                $statements_analyzer,
186
                $statements_analyzer->getTemplateTypeMap() ?: [],
187
                $t_else_context->inside_loop,
188
                new CodeLocation($statements_analyzer->getSource(), $stmt->else)
189
            );
190
191
            $t_else_context->vars_in_scope = $t_else_vars_in_scope_reconciled;
192
        }
193
194
        if (ExpressionAnalyzer::analyze($statements_analyzer, $stmt->else, $t_else_context) === false) {
195
            return false;