Skip to content

Commit 972b82a

Browse files
committed
formatting
1 parent a53f563 commit 972b82a

1 file changed

Lines changed: 6 additions & 14 deletions

File tree

src/Illuminate/Http/JsonResponse.php

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -86,24 +86,16 @@ public function setData($data = [])
8686
*/
8787
protected function hasValidJson($jsonError)
8888
{
89-
// No error is obviously fine
9089
if ($jsonError === JSON_ERROR_NONE) {
9190
return true;
9291
}
9392

94-
// If the JSON_PARTIAL_OUTPUT_ON_ERROR option is set, some additional errors are fine
95-
// (see https://secure.php.net/manual/en/json.constants.php)
96-
if ($this->hasEncodingOption(JSON_PARTIAL_OUTPUT_ON_ERROR)) {
97-
$acceptableErrors = [
98-
JSON_ERROR_RECURSION,
99-
JSON_ERROR_INF_OR_NAN,
100-
JSON_ERROR_UNSUPPORTED_TYPE,
101-
];
102-
103-
return \in_array($jsonError, $acceptableErrors);
104-
}
105-
106-
return false;
93+
return $this->hasEncodingOption(JSON_PARTIAL_OUTPUT_ON_ERROR) &&
94+
in_array($jsonError, [
95+
JSON_ERROR_RECURSION,
96+
JSON_ERROR_INF_OR_NAN,
97+
JSON_ERROR_UNSUPPORTED_TYPE,
98+
]);
10799
}
108100

109101
/**

0 commit comments

Comments
 (0)