Add missing dependency to amphp/serialization

This commit is contained in:
Niklas Keller 2022-02-03 20:28:16 +01:00
parent 43959fbdc5
commit 6a3985ee39
5 changed files with 9 additions and 10 deletions

1
.gitattributes vendored
View File

@ -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
View File

@ -2,3 +2,4 @@
/composer.lock
/.php_cs.cache
/docs/Gemfile.lock
/composer-require-checker.phar

View File

@ -16,9 +16,7 @@
"mixed",
"void",
"object",
"escapeArguments",
"IS_WINDOWS",
"posix_kill"
"parallel"
],
"php-core-extensions": [
"Core",

View File

@ -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": {

View File

@ -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) {