@@ -51,6 +51,65 @@ limitation.
5151
5252---
5353
54+ #### 33a. Generator yield inference gaps inside generator bodies
55+
56+ The basic generator yield inference (item 33) is implemented, but
57+ several edge cases do not resolve yet:
58+
59+ ** Yield inside control flow.** When ` yield $var ` appears inside an ` if ` ,
60+ ` foreach ` , or other block within the generator body, the variable is not
61+ inferred outside that block. The text-based body scan finds the yield,
62+ but the variable resolution pipeline does not connect it back to the
63+ outer scope.
64+
65+ ``` php
66+ /** @return \Generator<int , User > */
67+ public function filteredUsers(): \Generator {
68+ if (true) {
69+ yield $user;
70+ }
71+ $user-> // ← no completion
72+ }
73+ ```
74+
75+ ** Multiple yields with different variable names.** When two separate
76+ variables are yielded in the same generator, neither resolves. The
77+ scan finds both yield statements but the inference does not fire for
78+ either variable.
79+
80+ ``` php
81+ /** @return \Generator<int , User > */
82+ public function allUsers(): \Generator {
83+ yield $first;
84+ $first-> // ← no completion
85+
86+ yield $second;
87+ $second-> // ← no completion
88+ }
89+ ```
90+
91+ ** Chaining through a yield-inferred variable.** When a variable gets
92+ its type from reverse yield inference, chaining a method call on it
93+ does not resolve the next link. The yield fallback returns the type
94+ directly from ` resolve_variable_in_members ` instead of feeding it
95+ back into the normal subject resolution chain.
96+
97+ ``` php
98+ /** @return \Generator<int , User > */
99+ public function withProfiles(): \Generator {
100+ yield $user;
101+ $user->getProfile()-> // ← no completion after getProfile()
102+ }
103+ ```
104+
105+ ** TSend inference not consistent across classes.** The ` $var = yield `
106+ pattern resolves in some classes but not others with identical
107+ structure. Likely a position-dependent issue in
108+ ` find_enclosing_return_type ` where the backward scan crosses the
109+ wrong opening brace.
110+
111+ ---
112+
54113## Go-to-Implementation Gaps
55114
56115### 5b. Short-name collisions in ` find_implementors `
0 commit comments