Permalink
Browse files

Merge pull request #10 from xi-project/fix-keys-for-map

Fixed key providing to ArrayCollection::map
  • Loading branch information...
2 parents bc59c86 + ccf2f4f commit c9e51a50616206cdd1d9407f5ab4501cb29382cd @Ezku Ezku committed Feb 19, 2013
@@ -123,7 +123,7 @@ public function map($callback)
private function addKeyArgument($callback)
{
$values = $this->elements;
- return function($value) use($callback, $values) {
+ return function($value) use($callback, &$values) {
list($key) = each($values);
return $callback($value, $key);
};
@@ -145,6 +145,7 @@ public function keyMapSet()
{
return array(
array(array('foo' => null), array('foo' => 'foo')),
+ array(array('min' => 1, 'max' => 3), array('min' => 'min', 'max' => 'max')),
);
}

0 comments on commit c9e51a5

Please sign in to comment.