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
|
.gitattributes export-ignore
|
||||||
.gitignore export-ignore
|
.gitignore export-ignore
|
||||||
.php-cs-fixer.dist.php export-ignore
|
.php-cs-fixer.dist.php export-ignore
|
||||||
.travis.yml export-ignore
|
|
||||||
phpunit.xml.dist export-ignore
|
phpunit.xml.dist export-ignore
|
||||||
README.md export-ignore
|
README.md export-ignore
|
||||||
CONTRIBUTING.md export-ignore
|
CONTRIBUTING.md export-ignore
|
||||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,3 +2,4 @@
|
|||||||
/composer.lock
|
/composer.lock
|
||||||
/.php_cs.cache
|
/.php_cs.cache
|
||||||
/docs/Gemfile.lock
|
/docs/Gemfile.lock
|
||||||
|
/composer-require-checker.phar
|
||||||
|
@ -16,9 +16,7 @@
|
|||||||
"mixed",
|
"mixed",
|
||||||
"void",
|
"void",
|
||||||
"object",
|
"object",
|
||||||
"escapeArguments",
|
"parallel"
|
||||||
"IS_WINDOWS",
|
|
||||||
"posix_kill"
|
|
||||||
],
|
],
|
||||||
"php-core-extensions": [
|
"php-core-extensions": [
|
||||||
"Core",
|
"Core",
|
||||||
|
@ -24,8 +24,9 @@
|
|||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=7.4",
|
"php": ">=7.4",
|
||||||
"amphp/parallel": "^1.1",
|
|
||||||
"amphp/amp": "^2.0.3",
|
"amphp/amp": "^2.0.3",
|
||||||
|
"amphp/parallel": "^1.4",
|
||||||
|
"amphp/serialization": "^1.0",
|
||||||
"laravel/serializable-closure": "^1.0"
|
"laravel/serializable-closure": "^1.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
namespace Amp\ParallelFunctions;
|
namespace Amp\ParallelFunctions;
|
||||||
|
|
||||||
use Amp\MultiReasonException;
|
use Amp\MultiReasonException;
|
||||||
use Amp\Parallel\Sync\SerializationException;
|
|
||||||
use Amp\Parallel\Worker\Pool;
|
use Amp\Parallel\Worker\Pool;
|
||||||
use Amp\Promise;
|
use Amp\Promise;
|
||||||
|
use Amp\Serialization\SerializationException;
|
||||||
use Laravel\SerializableClosure\SerializableClosure;
|
use Laravel\SerializableClosure\SerializableClosure;
|
||||||
use function Amp\call;
|
use function Amp\call;
|
||||||
use function Amp\Parallel\Worker\enqueue;
|
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) {
|
return call(function () use ($array, $callable, $pool) {
|
||||||
// Amp\Promise\any() guarantees that all operations finished prior to resolving. Amp\Promise\all() doesn't.
|
// 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.
|
// 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) {
|
if ($errors) {
|
||||||
throw new MultiReasonException($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.
|
// 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.
|
// Additionally, we return all errors as a MultiReasonException instead of throwing on the first error.
|
||||||
if ($flag === \ARRAY_FILTER_USE_BOTH) {
|
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) {
|
} 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 {
|
} else {
|
||||||
list($errors, $results) = yield any(\array_map(parallel($callable, $pool), $array));
|
[$errors, $results] = yield any(\array_map(parallel($callable, $pool), $array));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($errors) {
|
if ($errors) {
|
||||||
|
Loading…
Reference in New Issue
Block a user