File tree Expand file tree Collapse file tree 2 files changed +5
-12
lines changed
tests/TestCase/Collection Expand file tree Collapse file tree 2 files changed +5
-12
lines changed Original file line number Diff line number Diff line change @@ -73,25 +73,17 @@ public function unserialize($collection)
73
73
}
74
74
75
75
/**
76
- * Dynamic method handler
76
+ * Throws an exception.
77
77
*
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.
82
79
*
83
80
* @param string $name Method name.
84
81
* @param array $args Method arguments.
85
- * @return mixed
82
+ * @return void
86
83
* @throws \BadMethodCallException
87
84
*/
88
85
public function __call ($ name , $ args )
89
86
{
90
- if (!method_exists (ArrayIterator::class, $ name )) {
91
- $ inner = $ this ->getInnerIterator ();
92
-
93
- return call_user_func_array ([$ inner , $ name ], $ args );
94
- }
95
87
throw new BadMethodCallException (sprintf ('Call to undefined method %s::%s() ' , get_class ($ this ), $ name ));
96
88
}
97
89
Original file line number Diff line number Diff line change @@ -2547,7 +2547,7 @@ public function testArrayIteratorExtend()
2547
2547
$ this ->assertTrue (method_exists ($ iterator , 'checkValues ' ));
2548
2548
$ this ->assertTrue ($ iterator ->checkValues ());
2549
2549
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.
2551
2551
$ newIterator = $ iterator
2552
2552
->filter (function ($ item ) {
2553
2553
return $ item < 5 ;
@@ -2556,6 +2556,7 @@ public function testArrayIteratorExtend()
2556
2556
return $ item > 2 ;
2557
2557
});
2558
2558
2559
+ $ this ->assertTrue (method_exists ($ newIterator , 'checkValues ' ), 'Our method has gone missing! ' );
2559
2560
$ this ->assertTrue ($ newIterator ->checkValues ());
2560
2561
$ this ->assertCount (3 , $ newIterator ->toArray ());
2561
2562
}
You can’t perform that action at this time.
0 commit comments