コード例 #1
0
ファイル: CollectionType.php プロジェクト: dkplus/reflections
 public function __construct(ClassType $class, Type $generic)
 {
     $this->class = $class;
     $this->generic = new IterableType($generic);
     if (!$class->reflection()->implementsInterface(Traversable::class)) {
         throw new InvalidArgumentException('Class ' . $class->reflection()->name() . ' is not traversable');
     }
     parent::__construct($class->reflection());
 }
コード例 #2
0
 function let(ClassType $collection, ClassReflection $reflection, Type $generic)
 {
     $reflection->implementsInterface(Traversable::class)->willReturn(true);
     $collection->reflection()->willReturn($reflection);
     $this->beConstructedWith($collection, $generic);
 }