Code Duplication    Length = 15-15 lines in 3 locations

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

@@ 64-78 (lines=15) @@
61
                /**
62
                 * @return \Psalm\Internal\Clause
63
                 */
64
                function (\Psalm\Internal\Clause $c) use ($mixed_var_ids) {
65
                    $keys = array_keys($c->possibilities);
66
67
                    $mixed_var_ids = \array_diff($mixed_var_ids, $keys);
68
69
                    foreach ($keys as $key) {
70
                        foreach ($mixed_var_ids as $mixed_var_id) {
71
                            if (preg_match('/^' . preg_quote($mixed_var_id, '/') . '(\[|-)/', $key)) {
72
                                return new \Psalm\Internal\Clause([], true);
73
                            }
74
                        }
75
                    }
76
77
                    return $c;
78
                },
79
                $if_clauses
80
            )
81
        );

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

@@ 83-97 (lines=15) @@
80
                /**
81
                 * @return \Psalm\Internal\Clause
82
                 */
83
                function (\Psalm\Internal\Clause $c) use ($mixed_var_ids) {
84
                    $keys = array_keys($c->possibilities);
85
86
                    $mixed_var_ids = \array_diff($mixed_var_ids, $keys);
87
88
                    foreach ($keys as $key) {
89
                        foreach ($mixed_var_ids as $mixed_var_id) {
90
                            if (preg_match('/^' . preg_quote($mixed_var_id, '/') . '(\[|-)/', $key)) {
91
                                return new \Psalm\Internal\Clause([], true);
92
                            }
93
                        }
94
                    }
95
96
                    return $c;
97
                },
98
                $if_clauses
99
            )
100
        );

src/Psalm/Internal/Analyzer/Statements/Block/DoAnalyzer.php 1 location

@@ 67-81 (lines=15) @@
64
            array_filter(
65
                $while_clauses,
66
                /** @return bool */
67
                function (Clause $c) use ($mixed_var_ids) {
68
                    $keys = array_keys($c->possibilities);
69
70
                    $mixed_var_ids = \array_diff($mixed_var_ids, $keys);
71
72
                    foreach ($keys as $key) {
73
                        foreach ($mixed_var_ids as $mixed_var_id) {
74
                            if (preg_match('/^' . preg_quote($mixed_var_id, '/') . '(\[|-)/', $key)) {
75
                                return false;
76
                            }
77
                        }
78
                    }
79
80
                    return true;
81
                }
82
            )
83
        );
84