diff --git a/.gitattributes b/.gitattributes index 78ec727..4d1c9da 100644 --- a/.gitattributes +++ b/.gitattributes @@ -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 diff --git a/.gitignore b/.gitignore index 6ab022b..ab1fc64 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ /composer.lock /.php_cs.cache /docs/Gemfile.lock +/composer-require-checker.phar diff --git a/composer-require-check.json b/composer-require-check.json index d421268..b2ee8e9 100644 --- a/composer-require-check.json +++ b/composer-require-check.json @@ -16,9 +16,7 @@ "mixed", "void", "object", - "escapeArguments", - "IS_WINDOWS", - "posix_kill" + "parallel" ], "php-core-extensions": [ "Core", diff --git a/composer.json b/composer.json index 89b9e1e..2b4fa01 100644 --- a/composer.json +++ b/composer.json @@ -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": { diff --git a/src/functions.php b/src/functions.php index c0925f0..be2ab41 100644 --- a/src/functions.php +++ b/src/functions.php @@ -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) {