Commit df5ee10
Move generic type arg check from TemplateTypeVariance to VarTagTypeRuleHelper
Revert the TemplateTypeVariance hack that treated template types as equal
to their bounds for invariant checks - this was conceptually wrong since
invariant means exact type equality.
Instead, fix VarTagTypeRuleHelper::checkType() to compare generic object
type arguments individually (covariantly) when both types are the same
generic class. This correctly allows @var tags like `@var IRepository<E>`
or `@var IRepository<Foo>` when the expression type is `IRepository<IEntity>`
and E/Foo are subtypes of IEntity.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent 3e1b2d6 commit df5ee10
File tree
3 files changed
+18
-4
lines changed- src
- Rules/PhpDoc
- Type/Generic
3 files changed
+18
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
726 | 726 | | |
727 | 727 | | |
728 | 728 | | |
729 | | - | |
| 729 | + | |
730 | 730 | | |
731 | 731 | | |
732 | 732 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
180 | 197 | | |
181 | 198 | | |
182 | 199 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | 180 | | |
184 | 181 | | |
185 | 182 | | |
| |||
0 commit comments