Skip to content

Commit fb94917

Browse files
committed
Correctly detect all exceptions in method body
1 parent d50b952 commit fb94917

30 files changed

Lines changed: 1906 additions & 202 deletions

docs/todo.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,13 @@ within the same impact tier.
2121

2222
## Sprint 3 — Bug fixes
2323

24-
| # | Item | Impact | Effort |
25-
| --- | ------------------------------------------------- | ------ | ------ |
26-
| B13 | [Stop showing dummy symbols in hover](todo/bugs.md#b13--hover-shows-dummy-symbols) | Medium | Low |
24+
| # | Item | Impact | Effort |
25+
| --- | ----------------------------------------------------------------------------------------------------------------- | ------ | ------ |
26+
| B13 | [Stop showing dummy symbols in hover](todo/bugs.md#b13--hover-shows-dummy-symbols) | Medium | Low |
27+
| B14 | [Add @throws action inserts misaligned docblock](todo/bugs.md#b14--add-throws-action-inserts-misaligned-docblock) | Medium | Low |
28+
| B15 | [Completion after `->()` should not insert parentheses](todo/bugs.md#b15--completion-after---should-not-insert-parentheses) | Medium | Low |
29+
| B16 | [PHPStan stale-diagnostic clearing is overly aggressive](todo/bugs.md#b16--phpstan-stale-diagnostic-clearing-is-overly-aggressive) | Medium | Medium |
30+
| | **Release 0.6.0** | | |
2731

2832
## Sprint 4 — Refactoring toolkit
2933

@@ -35,6 +39,7 @@ within the same impact tier.
3539
| A4 | [Inline variable](todo/actions.md#a4-inline-variable) | Medium | Medium |
3640
| A6 | [Generate constructor](todo/actions.md#a6-generate-constructor) | Medium | Medium |
3741
| A7 | [Promote constructor parameter](todo/actions.md#a7-promote-constructor-parameter) | Medium | Low |
42+
| | **Release 0.7.0** | | |
3843

3944
## Sprint 5 — Polish for office adoption
4045

@@ -48,6 +53,7 @@ within the same impact tier.
4853
| D1 | [Unknown class diagnostic](todo/diagnostics.md#d1-unknown-class-diagnostic) | Medium | Medium |
4954
| D3 | [Unknown method / property diagnostic](todo/diagnostics.md#d3-unknown-member) | Medium | Medium |
5055
| D4 | [Unused variable warning](todo/diagnostics.md#d4-unused-variable) | Medium | Medium |
56+
| | **Release 0.8.0** | | |
5157

5258
## Sprint 6 — Type intelligence depth
5359

docs/todo/bugs.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,67 @@ output.
7171

7272
**Fix:** Filter out dummy symbols before building the hover response
7373
so only real, user-relevant information is shown.
74+
75+
---
76+
77+
## B14 — Add `@throws` action inserts misaligned docblock
78+
79+
| Impact | Effort |
80+
| ------ | ------ |
81+
| Medium | Low |
82+
83+
When the "Add `@throws`" code action creates a new docblock (no
84+
existing docblock is present), the inserted block is not aligned with
85+
the function/method it annotates. The opening `/**` and closing `*/`
86+
use incorrect indentation, producing code that is visually broken and
87+
fails style checks.
88+
89+
**Fix:** Detect the indentation of the target function/method line and
90+
use it as the base indentation for every line of the generated
91+
docblock (`/**`, ` * @throws …`, ` */`).
92+
93+
---
94+
95+
## B15 — Completion after `->|()` should not insert parentheses
96+
97+
| Impact | Effort |
98+
| ------ | ------ |
99+
| Medium | Low |
100+
101+
When completing a method call where the cursor is immediately before
102+
existing parentheses (e.g. `$obj->|()` with the cursor at `|`), the
103+
completion item still inserts its own parentheses, producing
104+
`$obj->method()()`. The completion engine should detect that
105+
parentheses already follow the cursor and suppress the snippet
106+
suffix in that case.
107+
108+
**Fix:** Before attaching the `()` (or `($1)`) snippet suffix to a
109+
callable completion item, check whether the character immediately
110+
after the completion range is `(`. If so, emit a plain text insert
111+
without parentheses.
112+
113+
---
114+
115+
## B16 — PHPStan stale-diagnostic clearing is overly aggressive
116+
117+
| Impact | Effort |
118+
| ------ | ------ |
119+
| Medium | Medium |
120+
121+
`is_stale_phpstan_diagnostic()` in `src/diagnostics/mod.rs` sometimes
122+
clears diagnostics that are still valid. For example, adding a
123+
`@throws` tag for one exception may cause an unrelated diagnostic on
124+
a nearby line to be treated as stale if the simple substring check
125+
matches text that happens to appear elsewhere in the file. The
126+
heuristic-based approach (checking whether a short name appears after
127+
`@throws` anywhere in the file content) has false positives.
128+
129+
**Fix:** Audit each branch of `is_stale_phpstan_diagnostic()` and
130+
tighten the checks:
131+
132+
1. Scope `content_has_throws_tag` to the docblock enclosing the
133+
diagnostic line rather than searching the entire file.
134+
2. For `@phpstan-ignore` coverage, verify that the ignore comment is
135+
on the exact diagnostic line (or the line immediately before it),
136+
not just any line in the file.
137+
3. Add regression tests for the false-positive scenarios.

0 commit comments

Comments
 (0)