implementing an array of objects can be tricky in PHP since it does not support generics,
there are three solutions that I can see so far
- one is to implement
ArrayObject
class to your type for example
- using collection package by ramsy which somehow has workaround to implement generics