Commit 3e1b2d6
Use strict get_class() check in ObjectType::equals() and fix invariant variance for template types
Instead of narrowly rejecting only EnumCaseObjectType and GenericObjectType
in ObjectType::equals(), use a strict get_class() comparison for all
ObjectType subclasses. This makes equals() properly symmetric and prevents
any ObjectType subclass from being considered equal to a plain ObjectType.
To preserve the correct behavior where IRepository<E of IEntity> remains
a valid subtype of IRepository<IEntity>, add a template type bound check
in TemplateTypeVariance::isValidVariance() for invariant positions: when
the actual type argument ($b) is a TemplateType whose bound equals the
expected type argument ($a), treat them as equal.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent ffdd556 commit 3e1b2d6
File tree
3 files changed
+5
-8
lines changed- src/Type
- Generic
3 files changed
+5
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1473 | 1473 | | |
1474 | 1474 | | |
1475 | 1475 | | |
1476 | | - | |
1477 | | - | |
1478 | | - | |
1479 | | - | |
1480 | | - | |
1481 | | - | |
1482 | 1476 | | |
1483 | 1477 | | |
1484 | 1478 | | |
1485 | | - | |
| 1479 | + | |
1486 | 1480 | | |
1487 | 1481 | | |
1488 | 1482 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
180 | 183 | | |
181 | 184 | | |
182 | 185 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
629 | 629 | | |
630 | 630 | | |
631 | 631 | | |
632 | | - | |
| 632 | + | |
633 | 633 | | |
634 | 634 | | |
635 | 635 | | |
| |||
0 commit comments