MCPcopy Create free account
hub / github.com/PHPantom-dev/phpantom_lsp / collect_phpstan_actions

Method collect_phpstan_actions

src/code_actions/phpstan/mod.rs:96–144  ·  view source on GitHub ↗

Collect all PHPStan-specific code actions. Called from [`Backend::handle_code_action`](super) to gather every PHPStan quickfix that applies at the given cursor/range.

(
        &self,
        uri: &str,
        content: &str,
        params: &CodeActionParams,
        out: &mut Vec<CodeActionOrCommand>,
    )

Source from the content-addressed store, hash-verified

94 /// Called from [`Backend::handle_code_action`](super) to gather every
95 /// PHPStan quickfix that applies at the given cursor/range.
96 pub(crate) fn collect_phpstan_actions(
97 &self,
98 uri: &str,
99 content: &str,
100 params: &CodeActionParams,
101 out: &mut Vec<CodeActionOrCommand>,
102 ) {
103 // ── PHPStan ignore / remove unnecessary ignore ──────────────
104 self.collect_phpstan_ignore_actions(uri, content, params, out);
105
106 // ── Add @throws for checked exceptions ──────────────────────
107 self.collect_add_throws_actions(uri, content, params, out);
108
109 // ── Remove invalid/unused @throws ───────────────────────────
110 self.collect_remove_throws_actions(uri, content, params, out);
111
112 // ── Add #[Override] for overriding methods ──────────────────
113 self.collect_add_override_actions(uri, content, params, out);
114
115 // ── Remove #[Override] from non-overriding members ──────────
116 self.collect_remove_override_actions(uri, content, params, out);
117
118 // ── Add #[\ReturnTypeWillChange] for tentative return types ─
119 self.collect_add_return_type_will_change_actions(uri, content, params, out);
120
121 // ── Fix unsafe `new static()` ───────────────────────────────
122 self.collect_new_static_actions(uri, content, params, out);
123
124 // ── Fix PHPDoc type mismatch (@return, @param, @var) ────────
125 self.collect_fix_phpdoc_type_actions(uri, content, params, out);
126
127 // ── Fix prefixed class name ─────────────────────────────────
128 self.collect_fix_prefixed_class_actions(uri, content, params, out);
129
130 // ── Remove always-true assert() ─────────────────────────────
131 self.collect_remove_assert_actions(uri, content, params, out);
132
133 // ── Fix return type (return.void / return.empty / return.type / missingType.return) ─
134 self.collect_fix_return_type_actions(uri, content, params, out);
135
136 // ── Remove unused return type (return.unusedType) ───────────
137 self.collect_remove_unused_return_type_actions(uri, content, params, out);
138
139 // ── Add iterable return type (missingType.iterableValue) ────
140 self.collect_add_iterable_type_actions(uri, content, params, out);
141
142 // ── Remove unreachable statement ────────────────────────────
143 self.collect_remove_unreachable_actions(uri, content, params, out);
144 }
145}
146
147#[cfg(test)]

Callers 1

handle_code_actionMethod · 0.80

Tested by

no test coverage detected