You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -81,33 +84,23 @@ public function __construct($data, $pkey, array $options = [])
81
84
$snapshot = $options['snapshotClass'];
82
85
}
83
86
84
-
if ($datainstanceof Traversable) {
85
-
$data = iterator_to_array($data);
86
-
}
87
-
88
-
if (!is_array($data)) {
87
+
if (!is_array($data) && !$datainstanceof Traversable) {
89
88
thrownewInvalidArgumentException(sprintf('An array or a Traversable was expected to take a snapshot of a collection, "%s" given', is_object($data) ? get_class($data) : gettype($data)));
90
89
}
91
90
92
91
foreach ($dataas$key => $value) {
93
-
$primary = $pkey;
94
-
95
-
if (!is_object($value)) {
96
-
$primary = '[' . $primary . ']';
97
-
}
98
-
99
92
if (!is_int($key)) {
100
93
thrownewInvalidArgumentException('The given array / Traversable is not a collection as it contains non numeric keys');
101
94
}
102
95
103
96
if (!$accessor->isReadable($value, $primary)) {
104
-
thrownewInvalidArgumentException(sprintf('The key "%s" is not defined or readable in one of the elements of the collection', $pkey));
97
+
thrownewInvalidArgumentException(sprintf('The key "%s" is not defined or readable in one of the elements of the collection', $primary));
0 commit comments