Hi!
For all() function the docs say:
The promise will resolve with an array of whatever all events emitted or null if the events do not pass any data.
Here is a simple example. I create a writable stream and then try to collect data from all drain events. These events don't provide any data. As a result the promise should resolve with null:
$writable = new \React\Stream\WritableResourceStream(fopen('php://stdout', 'w'), $loop, 1);
$writable->write('Hello world');
React\Promise\Stream\all($writable, 'drain')->then(function() {
echo 'drained' . PHP_EOL;
});
But I receive
Notice: Undefined variable: data in vendor/react/promise-stream/src/functions.php on line 129
Looks like in source code for all() function we should add default null value for variable $data?
$bufferer = function ($data = null) use (&$buffer) {
$buffer []= $data;
};
Hi!
For
all()function the docs say:Here is a simple example. I create a writable stream and then try to collect data from all
drainevents. These events don't provide any data. As a result the promise should resolve withnull:But I receive
Looks like in source code for
all()function we should add defaultnullvalue for variable$data?