Upgrade to 3.5.6

This commit is contained in:
Bastian Allgeier
2021-06-08 09:57:59 +02:00
parent fb57845df1
commit 5358f8885c
65 changed files with 506 additions and 223 deletions

View File

@@ -31,6 +31,27 @@ class A
return $array + $append;
}
/**
* Recursively loops through the array and
* resolves any item defined as `Closure`,
* applying the passed parameters
* @since 3.5.6
*
* @param array $array
* @param mixed ...$args Parameters to pass to the closures
* @return array
*/
public static function apply(array $array, ...$args): array
{
array_walk_recursive($array, function (&$item) use ($args) {
if (is_a($item, 'Closure')) {
$item = $item(...$args);
}
});
return $array;
}
/**
* Gets an element of an array by key
*