Hey Jakub,

Very nice improvement overall. Beyond the enum comment from Bob/Ignace
I would also think that stream_get_errors() could return an array of
StreamError objects instead of arrays?

readonly class StreamError
{
    public function __construct(
        public string $message,
        public int $code,
        public int $severity,
        public bool $terminal,
        public string $wrapper,
        public ?string $param = null,
        public ?string $docref = null,
    ) {}
}

This object could also be passed to the error handlers perhaps as:

    function(string $wrapper, ?resource $stream, StreamError $error): void

Just some ideas :)

Best,
Jordi

Reply via email to