Skip to content

Commit

Permalink
For now move TypeResolvers to Reflection/Internal/Inheritance
Browse files Browse the repository at this point in the history
  • Loading branch information
vudaltsov committed Aug 18, 2024
1 parent efd86d0 commit 01a2f9d
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
1 change: 0 additions & 1 deletion Internal/Inheritance/ClassInheritance.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
use Typhoon\Type\TypeVisitor;
use Typhoon\Type\Visitor\RelativeClassTypeResolver;
use Typhoon\Type\Visitor\TemplateTypeResolver;
use Typhoon\Type\Visitor\TypeResolvers;
use Typhoon\TypedMap\TypedMap;

/**
Expand Down
33 changes: 33 additions & 0 deletions Internal/Inheritance/TypeResolvers.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

declare(strict_types=1);

namespace Typhoon\Reflection\Internal\Inheritance;

use Typhoon\Type\Type;
use Typhoon\Type\TypeVisitor;
use Typhoon\Type\Visitor\DefaultTypeVisitor;

/**
* @internal
* @psalm-internal Typhoon\Reflection\Internal\Inheritance
* @extends DefaultTypeVisitor<Type>
*/
final class TypeResolvers extends DefaultTypeVisitor
{
/**
* @param iterable<TypeVisitor<Type>> $resolvers
*/
public function __construct(
private readonly iterable $resolvers = [],
) {}

protected function default(Type $type): mixed
{
foreach ($this->resolvers as $resolver) {
$type = $type->accept($resolver);
}

return $type;
}
}

0 comments on commit 01a2f9d

Please sign in to comment.