Hi.
I’m creating a class where the constructor is supposed to get an array of objects.
class Foo{
protected $property;
public function __construct(MyObject ...$arrayOfMyObjects){
$this->property = $arrayOfMyObjects;
}
}
So I expect that Yii/PHP would validate $arrayOfMyObjects as an array with 1 or more MyObject instances.
But I’ getting the TypeError: … __construct() must be an instance of MyObject, array given, called in…
Is that the way to do this or what I have done that it is not working?
Thank you