The expression $this->serializeDate($th...getAttribute('value')); of type null|string adds the type string to the return on line 47 which is incompatible with the return type declared by the interface Illuminate\Contracts\Support\Arrayable::toArray of type array.