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

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

View File

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

View File

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

View File

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