mirror of
https://github.com/danog/parallel-functions.git
synced 2024-11-26 12:24:52 +01:00
Add missing dependency to amphp/serialization
This commit is contained in:
parent
43959fbdc5
commit
6a3985ee39
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -4,7 +4,6 @@ test export-ignore
|
||||
.gitattributes export-ignore
|
||||
.gitignore export-ignore
|
||||
.php-cs-fixer.dist.php export-ignore
|
||||
.travis.yml export-ignore
|
||||
phpunit.xml.dist export-ignore
|
||||
README.md export-ignore
|
||||
CONTRIBUTING.md export-ignore
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,3 +2,4 @@
|
||||
/composer.lock
|
||||
/.php_cs.cache
|
||||
/docs/Gemfile.lock
|
||||
/composer-require-checker.phar
|
||||
|
@ -16,9 +16,7 @@
|
||||
"mixed",
|
||||
"void",
|
||||
"object",
|
||||
"escapeArguments",
|
||||
"IS_WINDOWS",
|
||||
"posix_kill"
|
||||
"parallel"
|
||||
],
|
||||
"php-core-extensions": [
|
||||
"Core",
|
||||
|
@ -24,8 +24,9 @@
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.4",
|
||||
"amphp/parallel": "^1.1",
|
||||
"amphp/amp": "^2.0.3",
|
||||
"amphp/parallel": "^1.4",
|
||||
"amphp/serialization": "^1.0",
|
||||
"laravel/serializable-closure": "^1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
|
@ -3,9 +3,9 @@
|
||||
namespace Amp\ParallelFunctions;
|
||||
|
||||
use Amp\MultiReasonException;
|
||||
use Amp\Parallel\Sync\SerializationException;
|
||||
use Amp\Parallel\Worker\Pool;
|
||||
use Amp\Promise;
|
||||
use Amp\Serialization\SerializationException;
|
||||
use Laravel\SerializableClosure\SerializableClosure;
|
||||
use function Amp\call;
|
||||
use function Amp\Parallel\Worker\enqueue;
|
||||
@ -53,7 +53,7 @@ function parallelMap(array $array, callable $callable, Pool $pool = null): Promi
|
||||
return call(function () use ($array, $callable, $pool) {
|
||||
// Amp\Promise\any() guarantees that all operations finished prior to resolving. Amp\Promise\all() doesn't.
|
||||
// Additionally, we return all errors as a MultiReasonException instead of throwing on the first error.
|
||||
list($errors, $results) = yield any(\array_map(parallel($callable, $pool), $array));
|
||||
[$errors, $results] = yield any(\array_map(parallel($callable, $pool), $array));
|
||||
|
||||
if ($errors) {
|
||||
throw new MultiReasonException($errors);
|
||||
@ -90,11 +90,11 @@ function parallelFilter(array $array, callable $callable = null, int $flag = 0,
|
||||
// Amp\Promise\any() guarantees that all operations finished prior to resolving. Amp\Promise\all() doesn't.
|
||||
// Additionally, we return all errors as a MultiReasonException instead of throwing on the first error.
|
||||
if ($flag === \ARRAY_FILTER_USE_BOTH) {
|
||||
list($errors, $results) = yield any(\array_map(parallel($callable, $pool), $array, \array_keys($array)));
|
||||
[$errors, $results] = yield any(\array_map(parallel($callable, $pool), $array, \array_keys($array)));
|
||||
} elseif ($flag === \ARRAY_FILTER_USE_KEY) {
|
||||
list($errors, $results) = yield any(\array_map(parallel($callable, $pool), \array_keys($array)));
|
||||
[$errors, $results] = yield any(\array_map(parallel($callable, $pool), \array_keys($array)));
|
||||
} else {
|
||||
list($errors, $results) = yield any(\array_map(parallel($callable, $pool), $array));
|
||||
[$errors, $results] = yield any(\array_map(parallel($callable, $pool), $array));
|
||||
}
|
||||
|
||||
if ($errors) {
|
||||
|
Loading…
Reference in New Issue
Block a user