Code Duplication    Length = 14-14 lines in 2 locations

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

@@ 228-241 (lines=14) @@
225
226
        $lhs_type = null;
227
228
        if ($stmt_left_type = $statements_analyzer->node_data->getType($stmt->left)) {
229
            $if_return_type_reconciled = AssertionReconciler::reconcile(
230
                'isset',
231
                clone $stmt_left_type,
232
                '',
233
                $statements_analyzer,
234
                $context->inside_loop,
235
                [],
236
                new CodeLocation($statements_analyzer->getSource(), $stmt),
237
                $statements_analyzer->getSuppressedIssues()
238
            );
239
240
            $lhs_type = clone $if_return_type_reconciled;
241
        }
242
243
        $stmt_right_type = null;
244

src/Psalm/Internal/Analyzer/Statements/Expression/TernaryAnalyzer.php 1 location

@@ 246-259 (lines=14) @@
243
            if ($stmt_if_type = $statements_analyzer->node_data->getType($stmt->if)) {
244
                $lhs_type = $stmt_if_type;
245
            }
246
        } elseif ($stmt_cond_type = $statements_analyzer->node_data->getType($stmt->cond)) {
247
            $if_return_type_reconciled = AssertionReconciler::reconcile(
248
                '!falsy',
249
                clone $stmt_cond_type,
250
                '',
251
                $statements_analyzer,
252
                $context->inside_loop,
253
                [],
254
                new CodeLocation($statements_analyzer->getSource(), $stmt),
255
                $statements_analyzer->getSuppressedIssues()
256
            );
257
258
            $lhs_type = $if_return_type_reconciled;
259
        }
260
261
        if ($lhs_type && ($stmt_else_type = $statements_analyzer->node_data->getType($stmt->else))) {
262
            $statements_analyzer->node_data->setType($stmt, Type::combineUnionTypes($lhs_type, $stmt_else_type));