Use key-value foreach

(cherry picked from commit 00490d289c)
This commit is contained in:
Jan Bukva 2018-12-28 03:53:16 +07:00 committed by Vladimir Razuvaev
parent 8b8ea0d4a3
commit f52dfcfaef

View File

@ -34,11 +34,8 @@ use GraphQL\Utils\Utils;
use SplQueue;
use stdClass;
use Throwable;
use function array_keys;
use function count;
use function is_array;
use function is_string;
use function range;
use function sprintf;
class CoroutineExecutor implements Runtime, ExecutorImplementation
@ -155,13 +152,8 @@ class CoroutineExecutor implements Runtime, ExecutorImplementation
if (is_array($value)) {
$array = [];
$isAssoc = array_keys($value) !== range(0, count($value) - 1);
foreach ($value as $key => $item) {
if ($isAssoc) {
$array[$key] = self::resultToArray($item);
} else {
$array[] = self::resultToArray($item);
}
}
return $array;
}