Code Duplication    Length = 21-23 lines in 2 locations

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

@@ 135-155 (lines=21) @@
132
                if (!$var_id
133
                    || ($var_id !== '$_SESSION' && $var_id !== '$_SERVER' && !isset($changed_var_ids[$var_id]))
134
                ) {
135
                    if ($naive_type->from_docblock) {
136
                        if (IssueBuffer::accepts(
137
                            new \Psalm\Issue\DocblockTypeContradiction(
138
                                $naive_type->getId() . ' does not contain null',
139
                                new CodeLocation($statements_analyzer, $stmt->left)
140
                            ),
141
                            $statements_analyzer->getSuppressedIssues()
142
                        )) {
143
                            // fall through
144
                        }
145
                    } else {
146
                        if (IssueBuffer::accepts(
147
                            new \Psalm\Issue\TypeDoesNotContainType(
148
                                $naive_type->getId() . ' is always defined and non-null',
149
                                new CodeLocation($statements_analyzer, $stmt->left)
150
                            ),
151
                            $statements_analyzer->getSuppressedIssues()
152
                        )) {
153
                            // fall through
154
                        }
155
                    }
156
                }
157
            }
158
        }

src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/InstancePropertyFetchAnalyzer.php 1 location

@@ 458-480 (lines=23) @@
455
                }
456
457
                if (!$class_exists && !$interface_exists) {
458
                    if ($lhs_type_part->from_docblock) {
459
                        if (IssueBuffer::accepts(
460
                            new UndefinedDocblockClass(
461
                                'Cannot set properties of undefined docblock class ' . $lhs_type_part->value,
462
                                new CodeLocation($statements_analyzer->getSource(), $stmt),
463
                                $lhs_type_part->value
464
                            ),
465
                            $statements_analyzer->getSuppressedIssues()
466
                        )) {
467
                            // fall through
468
                        }
469
                    } else {
470
                        if (IssueBuffer::accepts(
471
                            new UndefinedClass(
472
                                'Cannot set properties of undefined class ' . $lhs_type_part->value,
473
                                new CodeLocation($statements_analyzer->getSource(), $stmt),
474
                                $lhs_type_part->value
475
                            ),
476
                            $statements_analyzer->getSuppressedIssues()
477
                        )) {
478
                            // fall through
479
                        }
480
                    }
481
482
                    return true;
483
                }