Skip to content

Commit 01a2f9d

Browse files
committed
For now move TypeResolvers to Reflection/Internal/Inheritance
1 parent efd86d0 commit 01a2f9d

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

Internal/Inheritance/ClassInheritance.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
use Typhoon\Type\TypeVisitor;
2121
use Typhoon\Type\Visitor\RelativeClassTypeResolver;
2222
use Typhoon\Type\Visitor\TemplateTypeResolver;
23-
use Typhoon\Type\Visitor\TypeResolvers;
2423
use Typhoon\TypedMap\TypedMap;
2524

2625
/**
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Typhoon\Reflection\Internal\Inheritance;
6+
7+
use Typhoon\Type\Type;
8+
use Typhoon\Type\TypeVisitor;
9+
use Typhoon\Type\Visitor\DefaultTypeVisitor;
10+
11+
/**
12+
* @internal
13+
* @psalm-internal Typhoon\Reflection\Internal\Inheritance
14+
* @extends DefaultTypeVisitor<Type>
15+
*/
16+
final class TypeResolvers extends DefaultTypeVisitor
17+
{
18+
/**
19+
* @param iterable<TypeVisitor<Type>> $resolvers
20+
*/
21+
public function __construct(
22+
private readonly iterable $resolvers = [],
23+
) {}
24+
25+
protected function default(Type $type): mixed
26+
{
27+
foreach ($this->resolvers as $resolver) {
28+
$type = $type->accept($resolver);
29+
}
30+
31+
return $type;
32+
}
33+
}

0 commit comments

Comments
 (0)