mirror of
https://github.com/danog/Valinor.git
synced 2024-11-30 04:39:05 +01:00
misc: change ObjectBuilderFactory::for
return signature
This commit is contained in:
parent
a401c2a2d6
commit
57849c92e7
@ -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)];
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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)];
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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()];
|
||||
}
|
||||
|
@ -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()];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user