コード例 #1
0
 function it_does_not_allow_collections_of_other_generics(ClassType $collection, Type $generic)
 {
     $allowedCollectionClass = new ClassType(ClassReflectionStubBuilder::build()->implement(Traversable::class)->finish());
     $notAllowedGeneric = new StringType();
     $collection->allows($allowedCollectionClass)->willReturn(true);
     $generic->allows($notAllowedGeneric)->willReturn(false);
     $this->allows(new CollectionType($allowedCollectionClass, $notAllowedGeneric))->shouldBe(false);
 }
コード例 #2
0
ファイル: CollectionType.php プロジェクト: dkplus/reflections
 public function allows(Type $type) : bool
 {
     return $type instanceof self && $this->class->allows($type->class) && $this->generic->allows($type->generic);
 }