|
25 | 25 | ├── inheritance.rs # Base class inheritance merging (traits, parent chain) |
26 | 26 | ├── virtual_members/ |
27 | 27 | │ ├── mod.rs # VirtualMemberProvider trait, VirtualMembers struct, merge logic |
28 | | -│ ├── phpdoc.rs # PHPDocProvider (@method, @property, @property-read, @property-write) |
29 | | -│ └── mixin.rs # MixinProvider (@mixin class member forwarding) |
| 28 | +│ └── phpdoc.rs # PHPDocProvider (@method, @property, @property-read, @property-write, @mixin) |
30 | 29 | ├── subject_extraction.rs # Shared helpers for extracting subjects before ->, ?->, :: |
31 | 30 | ├── util.rs # Position conversion, class lookup, logging |
32 | 31 | ├── parser/ |
@@ -227,11 +226,8 @@ ClassInfo (own members) |
227 | 226 | ├── 1. Merge used traits (via `use TraitName;`) |
228 | 227 | │ └── Recursively follows trait composition and parent_class chains |
229 | 228 | │ |
230 | | -├── 2. Walk the extends chain (parent_class) |
231 | | -│ └── For each parent: merge its traits, then its public/protected members |
232 | | -│ |
233 | | -└── 3. Merge @mixin classes (lowest precedence) |
234 | | - └── Resolved with full inheritance, only public members |
| 229 | +└── 2. Walk the extends chain (parent_class) |
| 230 | + └── For each parent: merge its traits, then its public/protected members |
235 | 231 | ``` |
236 | 232 |
|
237 | 233 | ### Virtual Member Providers |
@@ -259,22 +255,19 @@ resolve_class_fully(class) |
259 | 255 | Provider priority order (highest first): |
260 | 256 |
|
261 | 257 | 1. **Framework provider** (e.g. Laravel): richest type info |
262 | | -2. **PHPDoc provider**: `@method`, `@property`, `@property-read`, `@property-write` |
263 | | -3. **Mixin provider**: `@mixin` class members |
| 258 | +2. **PHPDoc provider**: `@method`, `@property`, `@property-read`, `@property-write`, `@mixin` |
264 | 259 |
|
265 | | -Three providers are currently registered in `default_providers()`: |
| 260 | +Two providers are currently registered in `default_providers()`: |
266 | 261 |
|
267 | 262 | - **`LaravelModelProvider`** (`virtual_members/laravel.rs`): synthesizes virtual members for classes extending `Illuminate\Database\Eloquent\Model`. Currently produces relationship properties: methods returning known relationship types (`HasMany`, `HasOne`, `BelongsTo`, etc.) generate a virtual property with the same name, typed from the relationship's generic parameters (e.g. `HasMany<Post, $this>` produces a `$posts` property typed as `\Illuminate\Database\Eloquent\Collection<Post>`). Highest priority among virtual member providers. |
268 | | -- **`PHPDocProvider`** (`virtual_members/phpdoc.rs`): parses `@method`, `@property`, `@property-read`, and `@property-write` tags from the class-level docblock stored in `ClassInfo.class_docblock`. These tags are not parsed eagerly during AST extraction; instead, the raw docblock string is preserved and parsed lazily when `provide` is called. |
269 | | -- **`MixinProvider`** (`virtual_members/mixin.rs`): loads classes listed in `@mixin` tags and returns their public members. Recurses into mixin-of-mixin chains up to `MAX_MIXIN_DEPTH`. |
| 263 | +- **`PHPDocProvider`** (`virtual_members/phpdoc.rs`): parses `@method`, `@property`, `@property-read`, `@property-write`, and `@mixin` tags from the class-level docblock stored in `ClassInfo.class_docblock`. Explicit `@method` / `@property` tags are not parsed eagerly during AST extraction; instead, the raw docblock string is preserved and parsed lazily when `provide` is called. For `@mixin` tags, the provider loads the referenced classes and merges their public members. Within the provider, explicit tags take precedence over mixin members. Recurses into mixin-of-mixin chains up to `MAX_MIXIN_DEPTH`. |
270 | 264 |
|
271 | 265 | ### Precedence Rules |
272 | 266 |
|
273 | 267 | - **Class own members** always win. |
274 | 268 | - **Trait members** override inherited members but not own members. |
275 | 269 | - **Parent members** fill in anything not already present. |
276 | | -- **Mixin members** have the lowest precedence within base resolution. |
277 | | -- **Virtual members** from providers sit below all real declared members (own, trait, parent). Higher-priority providers shadow lower-priority ones. |
| 270 | +- **Virtual members** from providers sit below all real declared members (own, trait, parent). Higher-priority providers shadow lower-priority ones. Within the PHPDoc provider, `@method` / `@property` tags beat `@mixin` members. |
278 | 271 | - **Private members** are never inherited from parents (but trait private members are copied, matching PHP semantics). |
279 | 272 |
|
280 | 273 | ### Interface Inheritance in Traits/Used Interfaces |
|
0 commit comments