Skip to content

Commit ffb4f9f

Browse files
committed
Revert "Merge pull request #11440 from cakephp/fix-build"
This reverts commit 58dd59f, reversing changes made to 701114c.
1 parent c1f9b61 commit ffb4f9f

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

src/Collection/Collection.php

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,25 +73,17 @@ public function unserialize($collection)
7373
}
7474

7575
/**
76-
* Dynamic method handler
76+
* Throws an exception.
7777
*
78-
* Collections do not allow access to methods of the inner iterator,
79-
* if that iterator is one of the PHP base classes as many of
80-
* these methods allow in-place mutation which breaks the immutability
81-
* Collection tries to provide.
78+
* Collection doesn't permit access to methods of the inner iterator.
8279
*
8380
* @param string $name Method name.
8481
* @param array $args Method arguments.
85-
* @return mixed
82+
* @return void
8683
* @throws \BadMethodCallException
8784
*/
8885
public function __call($name, $args)
8986
{
90-
if (!method_exists(ArrayIterator::class, $name)) {
91-
$inner = $this->getInnerIterator();
92-
93-
return call_user_func_array([$inner, $name], $args);
94-
}
9587
throw new BadMethodCallException(sprintf('Call to undefined method %s::%s()', get_class($this), $name));
9688
}
9789

tests/TestCase/Collection/CollectionTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2547,7 +2547,7 @@ public function testArrayIteratorExtend()
25472547
$this->assertTrue(method_exists($iterator, 'checkValues'));
25482548
$this->assertTrue($iterator->checkValues());
25492549

2550-
// We need to perform at least two collection operation to trigger the issue.
2550+
//We need to perform at least two collection operation to trigger the issue.
25512551
$newIterator = $iterator
25522552
->filter(function ($item) {
25532553
return $item < 5;
@@ -2556,6 +2556,7 @@ public function testArrayIteratorExtend()
25562556
return $item > 2;
25572557
});
25582558

2559+
$this->assertTrue(method_exists($newIterator, 'checkValues'), 'Our method has gone missing!');
25592560
$this->assertTrue($newIterator->checkValues());
25602561
$this->assertCount(3, $newIterator->toArray());
25612562
}

0 commit comments

Comments
 (0)