File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed
tests/PHPStan/Type/Generic Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -65,12 +65,12 @@ public static function createEmpty(): self
65
65
66
66
public function isEmpty (): bool
67
67
{
68
- return count ( $ this ->types ) === 0 ;
68
+ return $ this ->count ( ) === 0 ;
69
69
}
70
70
71
71
public function count (): int
72
72
{
73
- return count ($ this ->types );
73
+ return count ($ this ->types + $ this -> lowerBoundTypes );
74
74
}
75
75
76
76
/** @return array<string,\PHPStan\Type\Type> */
Original file line number Diff line number Diff line change @@ -15,6 +15,11 @@ public function dataUnionWithLowerBoundTypes(): iterable
15
15
'T ' => new ObjectType (\Exception::class),
16
16
]))->convertToLowerBoundTypes ();
17
17
18
+ yield [
19
+ $ map ,
20
+ \Exception::class,
21
+ ];
22
+
18
23
yield [
19
24
$ map ->union (new TemplateTypeMap ([
20
25
'T ' => new ObjectType (\InvalidArgumentException::class),
@@ -51,6 +56,7 @@ public function dataUnionWithLowerBoundTypes(): iterable
51
56
/** @dataProvider dataUnionWithLowerBoundTypes */
52
57
public function testUnionWithLowerBoundTypes (TemplateTypeMap $ map , string $ expectedTDescription ): void
53
58
{
59
+ $ this ->assertFalse ($ map ->isEmpty ());
54
60
$ t = $ map ->getType ('T ' );
55
61
$ this ->assertNotNull ($ t );
56
62
$ this ->assertSame ($ expectedTDescription , $ t ->describe (VerbosityLevel::precise ()));
You can’t perform that action at this time.
0 commit comments