You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/ARCHITECTURE.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -869,6 +869,12 @@ The `symbol_maps` store is keyed by file URI, matching `ast_map`. A typical PHP
869
869
870
870
Files that are not open (vendor files loaded via PSR-4 on demand) do not get a symbol map — they use the stored byte offsets from Tier 2 (which live on `ClassInfo` / `MethodInfo` / etc. in `ast_map`).
871
871
872
+
## Diagnostic Worker Architecture
873
+
874
+
Diagnostics run in a background `tokio::spawn` task so they never block completion, hover, or signature help. The worker is created during `initialized` via `clone_for_diagnostic_worker`, which builds a shallow clone of the `Backend`. All `Arc`-wrapped fields (maps, caches, the notify/pending slot) are shared by `Arc::clone`, so the worker sees every mutation the main `Backend` makes.
875
+
876
+
Non-`Arc` fields are snapshotted at spawn time: `php_version`, `vendor_uri_prefixes`, `vendor_dir_paths`, and `config`. These fields are only written during `initialized` (before the worker is spawned) and never change afterwards. If a future feature adds hot-reloading of `.phpantom.toml` or runtime PHP version changes, the worker would need to be notified or re-cloned. This invariant ("init-time fields are write-once") should be verified before adding any post-init mutation to these fields.
877
+
872
878
## Name Resolution
873
879
874
880
PHP class names go through resolution at parse time (`resolve_parent_class_names`):
Copy file name to clipboardExpand all lines: docs/CHANGELOG.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -54,6 +54,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
54
54
55
55
### Fixed
56
56
57
+
-**Type alias array shape diagnostics no longer fire on object values.** When a method returns a `@phpstan-type` alias that expands to an array shape containing object values (e.g. `array{pen: Pen}`), accessing a method on the object value no longer triggers a false diagnostic. Type aliases are now expanded before walking array shape segments in the resolution pipeline.
58
+
-**Inline array-element function calls resolve correctly in diagnostics.**`end($obj->items)->method()` no longer produces a false "unknown member" diagnostic. Previously the argument text for property access expressions was lost during symbol map extraction, causing the resolver to fall back to the native `mixed|false` return type instead of extracting the element type from the array's generic annotation.
59
+
-**Eloquent Builder scope chain diagnostics no longer flicker.** Scope methods on Builder chains (e.g. `Bakery::where(...)->fresh()->get()`) no longer produce false diagnostics that flip on and off between edits. The diagnostic now checks the pre-resolved class returned by the completion pipeline before re-resolving through the cache, preventing stale cache entries from hiding context-specific virtual members.
57
60
-**Diagnostics refresh across open files when a class signature changes.** Editing a class (adding a method, changing a relation, modifying `$casts`, renaming a property) now triggers a diagnostic re-check in all other open files. Previously only the edited file was re-diagnosed, so stale "unknown member" or "unknown class" warnings in other tabs persisted until those files were manually re-opened or edited.
58
61
-**Unknown member diagnostics on property chains and method return chains.**`$obj->prop->member` and `$obj->getX()->member` now flag unknown members on the resolved intermediate type. Previously the diagnostic was silently skipped because the subject resolver could not handle chained expressions. Virtual properties from `@property` annotations are also resolved through the chain. When the intermediate type is scalar (e.g. `$model->boolProp->value`), a "Cannot access property on type 'bool'" diagnostic is emitted instead of silently skipping.
59
62
-**Variable type resolves through ternary, elvis, null-coalesce, and match assignments.** When a variable is reassigned via `$x = $x ?: Foo::bar()`, `$x = $a ?? $b`, `$x = $cond ? $a : $b`, or `$x = match(...) { ... }`, hover and foreach iteration now show the resolved type from the assignment branches. Previously these expressions returned unknown because the raw type inference path did not recurse into conditional expressions.
Copy file name to clipboardExpand all lines: docs/todo.md
+6-17Lines changed: 6 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,26 +34,12 @@ with each step.
34
34
35
35
## Sprint 2 — Stabilise for 0.5.0 release
36
36
37
-
All Sprint 2+ feature work is done. Before tagging 0.5.0, fix the
38
-
remaining bugs that would embarrass us in front of new users. No new
39
-
features, no refactors, no "while I'm here" detours. Ship what we
40
-
have, ship it correct.
41
-
42
-
The common thread: our own diagnostics contradict our own demos in
43
-
`example.php`. If PHPantom flags working code in its own showcase
44
-
file, users will not trust any diagnostic it produces.
45
-
46
37
| # | Item | Effort | Domain | Doc Link |
47
38
|---|---|---|---|---|
48
-
| 106 | Diagnostics fire on type alias array shape object values | Low | Bug Fixes |[bugs.md §1](todo/bugs.md#1-diagnostics-fire-on-type-alias-array-shape-object-values)|
49
-
| 107 | Inline array-element function calls resolve to native return type in diagnostics | Low | Bug Fixes |[bugs.md §2](todo/bugs.md#2-inline-array-element-function-calls-resolve-to-native-return-type-in-diagnostics)|
50
-
| 108 | Flaky `unknown_member` diagnostic on Eloquent Builder scope chains | Medium | Bug Fixes |[bugs.md §3](todo/bugs.md#3-flaky-unknown_member-diagnostic-on-eloquent-builder-scope-chains)|
39
+
| 106 | Thread panic in parallel file scanners crashes server | Low | Bug Fixes |[bugs.md §0](todo/bugs.md#0-thread-panic-in-parallel-file-scanners-crashes-the-server)|
0 commit comments