Code Duplication    Length = 13-16 lines in 2 locations

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

@@ 308-320 (lines=13) @@
305
        }
306
307
        if ($stmt_var_type->isNullable() && !$stmt_var_type->ignore_nullable_issues) {
308
            if (!$context->inside_isset) {
309
                if (IssueBuffer::accepts(
310
                    new PossiblyNullPropertyFetch(
311
                        'Cannot get property on possibly null variable ' . $stmt_var_id . ' of type ' . $stmt_var_type,
312
                        new CodeLocation($statements_analyzer->getSource(), $stmt)
313
                    ),
314
                    $statements_analyzer->getSuppressedIssues()
315
                )) {
316
                    // fall through
317
                }
318
            } else {
319
                $statements_analyzer->node_data->setType($stmt, Type::getNull());
320
            }
321
        }
322
323
        if (!$prop_name) {

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

@@ 192-207 (lines=16) @@
189
                } elseif (!$context->inside_isset
190
                    || $statements_analyzer->getSource() instanceof FunctionLikeAnalyzer
191
                ) {
192
                    if ($context->is_global || $from_global) {
193
                        if (IssueBuffer::accepts(
194
                            new UndefinedGlobalVariable(
195
                                'Cannot find referenced variable ' . $var_name . ' in global scope',
196
                                new CodeLocation($statements_analyzer->getSource(), $stmt),
197
                                $var_name
198
                            ),
199
                            $statements_analyzer->getSuppressedIssues()
200
                        )) {
201
                            // fall through
202
                        }
203
204
                        $statements_analyzer->node_data->setType($stmt, Type::getMixed());
205
206
                        return true;
207
                    }
208
209
                    if (IssueBuffer::accepts(
210
                        new UndefinedVariable(