On 10-11-2026 14:44, Damian Jóźwiak wrote:
Hi Ignace,
Thanks for the suggestion. I agree that a dedicated interface for
converting objects into CSV fields could be useful.
I'd prefer to avoid the term "serialization", as I've deliberately
used "conversion" throughout the RFC. Something like
|Csv\FieldConvertible| with a |toCsvField()| method would be more
consistent with that terminology.
There is one thing I'd like to consider before introducing it, though.
The last item in the RFC's Future Scope section already mentions the
possibility of an object-oriented API. I think a dedicated conversion
interface would fit quite naturally into such an API.
With the current function-based API, callers can already explicitly
invoke their own conversion methods before passing values to the CSV
functions:
|Csv\array_to_row([ $object->toCsvField(), ]);|
This provides explicit control over the CSV representation without
requiring a new interface in the initial API.
So the question, in my view, is whether we really need to introduce a
dedicated interface now, or whether it would be better to revisit it
alongside the potential object-oriented API, where its role and
integration could be considered more broadly.
I'm not opposed to the interface itself. I'd just prefer to avoid
expanding the initial scope unless there's a compelling use case that
the existing functions cannot reasonably accommodate.
Best regards,
Damian
Damian,
Please respect the mailing list rules [1] and always reply with a
bottom-post. This conversation as it is currently, is impossible to
follow with Ignace (correctly) bottom posting and you consistently
incorrectly top-posting.
Smile,
Juliette
1: https://github.com/php/php-src/blob/master/docs/mailinglist-rules.md