When I declare a method I declare the type of an argument:
public function doOnce(CoolParam $param) {...}
But when I have a Doctrine ArrayCollection I can only check for the array
public function doOMulti(ArrayCollection $params) {...}
Now I would like to be sure, that all members of ArrayCollection are instance of CoolParam. Therefore I can loop the whole Array and check with $param instanceof CoolParam
.
But is there a way to use a ArrayCollection method for this case? Just something like
$params->membersAreInstanceOf('CoolParam');