Hi,

On Tue, Dec 30, 2025 at 9:24 AM Christian Schneider <[email protected]>
wrote:

> Am 29.12.2025 um 19:52 schrieb Jakub Zelenka <[email protected]>:
> > - The storing of errors is done at the end of the operation grouping and
> contains only the last grouped errors. So the function name was changed to
> stream_get_last_error(). It returns just a single StreamError which has a
> next property pointing to the next error if there is any.
>
> I assume the chaining was based on Exception chaining but the example code
> under
>         https://wiki.php.net/rfc/stream_errors#error_chaining
> looks a bit clunky to me and I was wondering if returning an array of
> StreamError would not be more straightforward, i.e. one could then use
> foreach, empty(), count(), array_first(), array_last(), array_find() etc.
> instead of methods like while, $e->count(), $e->hasCode() which would make
> it feel more idiomatic to me.
>
>
I thought about it and I think the exception like chaining makes a bit more
sense here. The thing is that in majority cases there will be only one
error so it would be most of the time array with just one element which
seems a bit wasteful. But if others also feel that array would be better, I
wouldn't mind to do follow up RFC as I don't really feel strongly about it.
Just let me know during the vote and if there's more people asking for it,
I will do a follow up RFC. Alternatively it could just implement iterator
or array access, which I was thinking about, but not sure if it's not too
messy.

Kind regards,

Jakub

Reply via email to