File tree Expand file tree Collapse file tree 4 files changed +60
-2
lines changed Expand file tree Collapse file tree 4 files changed +60
-2
lines changed Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ public function equals(Type $type): bool
92
92
return $ type instanceof self
93
93
&& $ type ->scope ->equals ($ this ->scope )
94
94
&& $ type ->name === $ this ->name
95
- && $ this ->bound ->equals ($ type );
95
+ && $ this ->bound ->equals ($ type-> bound );
96
96
}
97
97
98
98
public function isAcceptedBy (Type $ acceptingType , bool $ strictTypes ): TrinaryLogic
Original file line number Diff line number Diff line change @@ -444,4 +444,9 @@ public function testBug4590(): void
444
444
]);
445
445
}
446
446
447
+ public function testTemplateStringBound (): void
448
+ {
449
+ $ this ->analyse ([__DIR__ . '/data/template-string-bound.php ' ], []);
450
+ }
451
+
447
452
}
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace TemplateStringBound ;
4
+
5
+ /** @template T of string */
6
+ class Foo
7
+ {
8
+
9
+ /** @var T */
10
+ private $ value ;
11
+
12
+ /**
13
+ * @param T $value
14
+ */
15
+ public function __construct ($ value )
16
+ {
17
+ $ this ->value = $ value ;
18
+ }
19
+
20
+ /**
21
+ * @return T
22
+ */
23
+ public function getValue (): string
24
+ {
25
+ return $ this ->value ;
26
+ }
27
+
28
+ }
29
+
30
+ /** @template T of int */
31
+ class Bar
32
+ {
33
+
34
+ /** @var T */
35
+ private $ value ;
36
+
37
+ /**
38
+ * @param T $value
39
+ */
40
+ public function __construct ($ value )
41
+ {
42
+ $ this ->value = $ value ;
43
+ }
44
+
45
+ /**
46
+ * @return T
47
+ */
48
+ public function getValue (): int
49
+ {
50
+ return $ this ->value ;
51
+ }
52
+
53
+ }
Original file line number Diff line number Diff line change @@ -162,7 +162,7 @@ public function dataAccepts(): iterable
162
162
new StringType (),
163
163
TemplateTypeVariance::createInvariant ()
164
164
)->toArgument (),
165
- TrinaryLogic::createNo (),
165
+ TrinaryLogic::createYes (),
166
166
];
167
167
}
168
168
You can’t perform that action at this time.
0 commit comments