Skip to content

Commit

Permalink
https://github.com/mage2pro/core/issues/403
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrii-fediuk committed Jun 3, 2024
1 parent abd70d3 commit a1b288f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Core/lib/array/map.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,21 @@
* Now the function accepts an array as $object.
* Even in this case it differs from @see array_column(): array_column() misses the keys: https://3v4l.org/llMrL
* df_column() preserves the keys.
* 2024-06-03
* 1.1) "Use the `iterable` type": https://github.com/mage2pro/core/issues/403
* 1.2) `iterable` is supported by PHP ≥ 7.1: https://3v4l.org/qNX1j
* 1.3) https://php.net/manual/en/language.types.iterable.php
* 2) We still can not use «Union Types» (e.g. `callable|iterable`) because they require PHP ≥ 8 (we need to support PHP ≥ 7.1):
* 2.1) https://php.watch/versions/8.0/union-types
* 2.2) https://3v4l.org/AOWmO
* @used-by df_category_names()
* @used-by \Df\Config\Backend\ArrayT::processI()
* @used-by \Df\Core\GlobalSingletonDestructor::process()
* @param Traversable|array(int|string => _DO|array(string => mixed)) $c
* @param string|callable $f
* @param mixed ...$p
*/
function df_each($c, $f, ...$p):array {return df_map(function($v) use($f, $p) {return df_call($v, $f, $p);}, $c);}
function df_each(iterable $c, $f, ...$p):array {return df_map(function($v) use($f, $p) {return df_call($v, $f, $p);}, $c);}

/**
* 2015-02-11
Expand Down

0 comments on commit a1b288f

Please sign in to comment.