Skip to content

Commit ac2cef7

Browse files
authored
Merge pull request #13 from alexhaker/master
Fix non-object warning
2 parents 3ec914b + 7dbeab5 commit ac2cef7

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/PHPUnit/Listeners/NaughtyTestListener.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,14 @@ private function formatValue($value)
205205
try {
206206
$encoded = json_encode($value, true);
207207
if (json_last_error() !== 0) {
208-
$encoded = sprintf('Object<%s>', get_class($value));
208+
throw new \Exception(json_last_error_msg());
209209
}
210210
} catch (Exception $exception) {
211-
$encoded = sprintf('Object<%s>', get_class($value));
211+
if (is_object($value)) {
212+
$encoded = sprintf('Object<%s>', get_class($value));
213+
} else {
214+
$encoded = gettype($value);
215+
}
212216
}
213217
}
214218

0 commit comments

Comments
 (0)