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); }
public function allows(Type $type) : bool { return $type instanceof self && $this->class->allows($type->class) && $this->generic->allows($type->generic); }