Skip to content

Commit 1d4240c

Browse files
extssebastianbergmann
authored andcommitted
Allowed ArrayAccess data to be passed to array_replace_recursive
1 parent a99803f commit 1d4240c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/Framework/Constraint/ArraySubset.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,16 @@ public function __construct($subset, $strict = false)
4949
*/
5050
protected function matches($other)
5151
{
52+
//type cast $other & $this->subset as an array to allow
53+
//support in standard array functions.
54+
if($other instanceof ArrayAccess) {
55+
$other = (array) $other;
56+
}
57+
58+
if($this->subset instanceof ArrayAccess) {
59+
$this->subset = (array) $this->subset;
60+
}
61+
5262
$patched = array_replace_recursive($other, $this->subset);
5363

5464
if ($this->strict) {

0 commit comments

Comments
 (0)