We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a1fb916 commit f76c43cCopy full SHA for f76c43c
src/SpecBaseObject.php
@@ -157,11 +157,16 @@ protected function instantiate($type, $data)
157
return new Reference($data, $type);
158
}
159
160
+ if (!is_array($data)) {
161
+ throw new TypeErrorException(
162
+ "Unable to instantiate {$type} Object with data '" . print_r($data, true) . "' at " . $this->getDocumentPosition()
163
+ );
164
+ }
165
try {
166
return new $type($data);
167
} catch (\TypeError $e) {
168
throw new TypeErrorException(
- "Unable to instantiate {$type} Object with data '" . print_r($data, true) . "'",
169
+ "Unable to instantiate {$type} Object with data '" . print_r($data, true) . "' at " . $this->getDocumentPosition(),
170
$e->getCode(),
171
$e
172
);
0 commit comments