I am trying to design a class which containes an array of another class objects
<?php
class X { };
class Y {
private ?X[] items;
}
But this apparently doesn't work ..
I dont want to declare items as array because I need it to be in X type .
itemsis markedprivateand you can declare type in your setter method signature asfunction addItem( \X $item ){...};