Several people said:
> generics

Is there a reason why traits can't be used to introduce generics?
i.e. extending the code that composes the trait into the class to
replace the generic type? eg. in `zend_add_trait_method`?
(I couldn't quickly find where trait properties get added, even
though my example is for properties.)

trait GenericTrait<T>
{
private ?T $object = null;
}

class ComposableClass
{
    use GenericTrait<Foo>;
}

// Result:
class ComposedClass
{
    private ?Foo $object = null;
}

Just a random thought...

Regards,
radar3301

Reply via email to