misc: change ObjectBuilderFactory::for return signature

This commit is contained in:
Romain Canon 2022-08-05 15:27:09 +02:00
parent a401c2a2d6
commit 57849c92e7
12 changed files with 15 additions and 15 deletions

View File

@ -29,7 +29,7 @@ final class StaticMethodConstructor implements ObjectBuilderFactory
$this->methodName = $methodName;
}
public function for(ClassDefinition $class): iterable
public function for(ClassDefinition $class): array
{
return [new MethodObjectBuilder($class, $this->methodName)];
}

View File

@ -161,7 +161,7 @@ final class Container
$factory = new StrictTypesObjectBuilderFactory($factory);
}
/** @var RuntimeCache<iterable<ObjectBuilder>> $cache */
/** @var RuntimeCache<list<ObjectBuilder>> $cache */
$cache = new RuntimeCache();
return new CacheObjectBuilderFactory($factory, $cache);

View File

@ -19,7 +19,7 @@ final class AttributeObjectBuilderFactory implements ObjectBuilderFactory
$this->delegate = $delegate;
}
public function for(ClassDefinition $class): iterable
public function for(ClassDefinition $class): array
{
$attributes = $class->attributes()->ofType(ObjectBuilderFactory::class);

View File

@ -13,11 +13,11 @@ final class CacheObjectBuilderFactory implements ObjectBuilderFactory
{
private ObjectBuilderFactory $delegate;
/** @var CacheInterface<iterable<ObjectBuilder>> */
/** @var CacheInterface<list<ObjectBuilder>> */
private CacheInterface $cache;
/**
* @param CacheInterface<iterable<ObjectBuilder>> $cache
* @param CacheInterface<list<ObjectBuilder>> $cache
*/
public function __construct(ObjectBuilderFactory $delegate, CacheInterface $cache)
{
@ -25,7 +25,7 @@ final class CacheObjectBuilderFactory implements ObjectBuilderFactory
$this->cache = $cache;
}
public function for(ClassDefinition $class): iterable
public function for(ClassDefinition $class): array
{
$signature = $class->type()->toString();

View File

@ -22,7 +22,7 @@ final class CollisionObjectBuilderFactory implements ObjectBuilderFactory
$this->delegate = $delegate;
}
public function for(ClassDefinition $class): iterable
public function for(ClassDefinition $class): array
{
$builders = $this->delegate->for($class);

View File

@ -43,7 +43,7 @@ final class ConstructorObjectBuilderFactory implements ObjectBuilderFactory
$this->constructors = $constructors;
}
public function for(ClassDefinition $class): iterable
public function for(ClassDefinition $class): array
{
$builders = $this->listBuilders($class);

View File

@ -31,7 +31,7 @@ final class DateTimeObjectBuilderFactory implements ObjectBuilderFactory
$this->functions = $functions;
}
public function for(ClassDefinition $class): iterable
public function for(ClassDefinition $class): array
{
$className = $class->name();

View File

@ -11,7 +11,7 @@ use CuyZ\Valinor\Mapper\Object\ObjectBuilder;
interface ObjectBuilderFactory
{
/**
* @return iterable<ObjectBuilder>
* @return list<ObjectBuilder>
*/
public function for(ClassDefinition $class): iterable;
public function for(ClassDefinition $class): array;
}

View File

@ -10,7 +10,7 @@ use CuyZ\Valinor\Mapper\Object\ReflectionObjectBuilder;
/** @internal */
final class ReflectionObjectBuilderFactory implements ObjectBuilderFactory
{
public function for(ClassDefinition $class): iterable
public function for(ClassDefinition $class): array
{
return [new ReflectionObjectBuilder($class)];
}

View File

@ -19,7 +19,7 @@ final class StrictTypesObjectBuilderFactory implements ObjectBuilderFactory
$this->delegate = $delegate;
}
public function for(ClassDefinition $class): iterable
public function for(ClassDefinition $class): array
{
$builders = $this->delegate->for($class);

View File

@ -10,7 +10,7 @@ use CuyZ\Valinor\Tests\Fake\Mapper\Object\FakeObjectBuilder;
final class FakeObjectBuilderFactory implements ObjectBuilderFactory
{
public function for(ClassDefinition $class): iterable
public function for(ClassDefinition $class): array
{
return [new FakeObjectBuilder()];
}

View File

@ -72,7 +72,7 @@ final class ForeignAttribute
#[Attribute(Attribute::TARGET_CLASS | Attribute::IS_REPEATABLE)]
final class ObjectBuilderStrategyAttribute implements ObjectBuilderFactory
{
public function for(ClassDefinition $class): iterable
public function for(ClassDefinition $class): array
{
return [new FakeObjectBuilder()];
}