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
6565
6666 public function isEmpty (): bool
6767 {
68- return count ( $ this ->types ) === 0 ;
68+ return $ this ->count ( ) === 0 ;
6969 }
7070
7171 public function count (): int
7272 {
73- return count ($ this ->types );
73+ return count ($ this ->types + $ this -> lowerBoundTypes );
7474 }
7575
7676 /** @return array<string,\PHPStan\Type\Type> */
Original file line number Diff line number Diff line change @@ -15,6 +15,11 @@ public function dataUnionWithLowerBoundTypes(): iterable
1515 'T ' => new ObjectType (\Exception::class),
1616 ]))->convertToLowerBoundTypes ();
1717
18+ yield [
19+ $ map ,
20+ \Exception::class,
21+ ];
22+
1823 yield [
1924 $ map ->union (new TemplateTypeMap ([
2025 'T ' => new ObjectType (\InvalidArgumentException::class),
@@ -51,6 +56,7 @@ public function dataUnionWithLowerBoundTypes(): iterable
5156 /** @dataProvider dataUnionWithLowerBoundTypes */
5257 public function testUnionWithLowerBoundTypes (TemplateTypeMap $ map , string $ expectedTDescription ): void
5358 {
59+ $ this ->assertFalse ($ map ->isEmpty ());
5460 $ t = $ map ->getType ('T ' );
5561 $ this ->assertNotNull ($ t );
5662 $ this ->assertSame ($ expectedTDescription , $ t ->describe (VerbosityLevel::precise ()));
You can’t perform that action at this time.
0 commit comments