I have currently have the following classes:
class Textarea Extends Field {}
class Field {}
I’m trying to declare a return type for the following function
public function field(string $field): Field
{
}
I would like the ‘Textarea’ class to be returnable via the field function and my understanding is that because the child class has a parent class of ‘Field’ then this should work?
I’m currently receiving the following error:
AppAdminCrudCrudModel::field(): Return value must be of type ?AppAdminCrudField, AppAdminCrudFieldsTextarea returned