Since PHP 8.1, most internal classes are updated
with tentative return types. This will be enforced
with 9.0.
It means incompatible or missing return types in
extending user land classes emit E_DEPRECATED
since 8.1. We can not add the return type in many
cases since that would be breaking in v11, solution
is the #[\ReturnTypeWillChange] attribute.
This patch adds according attributes to
AbstractRecordCollection, which implements \Iterator
interface. Mixed return type will be usable when core
requires at least PHP 8.0.
Class AbstractRecordCollection implement deprecated
\Serializable indirectly via RecordCollectionInterface.
Adding the magic methods suppresses PHP 7.4
E_DEPRECATED messages and retains compatibilty,
slated for removal in v12.