Skip to content

Commit 61cb0c6

Browse files
committed
Remove GenericTemplate class
1 parent c3f3e44 commit 61cb0c6

File tree

5 files changed

+4
-94
lines changed

5 files changed

+4
-94
lines changed

src/PseudoTypes/GenericTemplate.php

Lines changed: 0 additions & 43 deletions
This file was deleted.

src/TypeResolver.php

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
use phpDocumentor\Reflection\PseudoTypes\False_;
2727
use phpDocumentor\Reflection\PseudoTypes\FloatValue;
2828
use phpDocumentor\Reflection\PseudoTypes\Generic;
29-
use phpDocumentor\Reflection\PseudoTypes\GenericTemplate;
3029
use phpDocumentor\Reflection\PseudoTypes\HtmlEscapedString;
3130
use phpDocumentor\Reflection\PseudoTypes\IntegerRange;
3231
use phpDocumentor\Reflection\PseudoTypes\IntegerValue;
@@ -472,17 +471,7 @@ private function createFromGeneric(GenericTypeNode $type, Context $context): Typ
472471
throw new RuntimeException(sprintf('%s is an unsupported generic', (string) $mainType));
473472
}
474473

475-
$types = array_map(
476-
function (TypeNode $node) use ($context): Type {
477-
$innerType = $this->createType($node, $context);
478-
if ($innerType instanceof Object_ && $innerType instanceof Generic === false) {
479-
return new GenericTemplate($innerType);
480-
}
481-
482-
return $innerType;
483-
},
484-
$type->genericTypes
485-
);
474+
$types = $this->createTypesByTypeNodes($type->genericTypes, $context);
486475

487476
return new Generic($mainType->getFqsen(), $types);
488477
}

tests/unit/CollectionResolverTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
namespace phpDocumentor\Reflection;
1515

1616
use phpDocumentor\Reflection\PseudoTypes\Generic;
17-
use phpDocumentor\Reflection\PseudoTypes\GenericTemplate;
1817
use phpDocumentor\Reflection\PseudoTypes\List_;
1918
use phpDocumentor\Reflection\PseudoTypes\NonEmptyList;
2019
use phpDocumentor\Reflection\Types\Array_;
@@ -81,7 +80,7 @@ public function testResolvingCollectionWithKeyType(): void
8180
$this->assertArrayHasKey(0, $types);
8281
$this->assertEquals(new Array_(new String_()), $types[0]);
8382
$this->assertArrayHasKey(1, $types);
84-
$this->assertEquals(new GenericTemplate(new Object_(new Fqsen('\\Iterator'))), $types[1]);
83+
$this->assertEquals(new Object_(new Fqsen('\\Iterator')), $types[1]);
8584
}
8685

8786
/**
@@ -193,7 +192,7 @@ public function testResolvingCollectionOfCollection(): void
193192

194193
$nestedGenericTypes = $types[1]->getTypes();
195194
$this->assertArrayHasKey(0, $nestedGenericTypes);
196-
$this->assertEquals(new GenericTemplate(new Object_(new Fqsen('\\DateTime'))), $nestedGenericTypes[0]);
195+
$this->assertEquals(new Object_(new Fqsen('\\DateTime')), $nestedGenericTypes[0]);
197196
}
198197

199198
/**

tests/unit/PseudoTypes/GenericTemplateTest.php

Lines changed: 0 additions & 35 deletions
This file was deleted.

tests/unit/PseudoTypes/GenericTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public static function provideToStringData(): array
7070
new Generic(
7171
new Fqsen('\\MyClass'),
7272
[
73-
new GenericTemplate(new Object_(new Fqsen('\\T'))),
73+
new Object_(new Fqsen('\\T')),
7474
new Object_(new Fqsen('\\SomeClassSecond')),
7575
new Object_(new Fqsen('\\SomeClassThird')),
7676
]

0 commit comments

Comments
 (0)