Mercurial > hg > isophonics-drupal-site
diff vendor/zendframework/zend-stdlib/src/ArrayUtils.php @ 16:c2387f117808
Routine composer update
author | Chris Cannam |
---|---|
date | Tue, 10 Jul 2018 15:07:59 +0100 |
parents | 7a779792577d |
children |
line wrap: on
line diff
--- a/vendor/zendframework/zend-stdlib/src/ArrayUtils.php Thu Apr 26 11:26:54 2018 +0100 +++ b/vendor/zendframework/zend-stdlib/src/ArrayUtils.php Tue Jul 10 15:07:59 2018 +0100 @@ -292,12 +292,13 @@ } /** - * Compatibility Method for array_filter on <5.6 systems + * @deprecated Since 3.2.0; use the native array_filter methods * * @param array $data * @param callable $callback * @param null|int $flag * @return array + * @throws Exception\InvalidArgumentException */ public static function filter(array $data, $callback, $flag = null) { @@ -308,28 +309,6 @@ )); } - if (version_compare(PHP_VERSION, '5.6.0') >= 0) { - return array_filter($data, $callback, $flag); - } - - $output = []; - foreach ($data as $key => $value) { - $params = [$value]; - - if ($flag === static::ARRAY_FILTER_USE_BOTH) { - $params[] = $key; - } - - if ($flag === static::ARRAY_FILTER_USE_KEY) { - $params = [$key]; - } - - $response = call_user_func_array($callback, $params); - if ($response) { - $output[$key] = $value; - } - } - - return $output; + return array_filter($data, $callback, $flag); } }