8000 [Serializer] replaced "and" to "&&" · symfony/symfony@3127cea · GitHub
[go: up one dir, main page]

Skip to content

Commit 3127cea

Browse files
committed
[Serializer] replaced "and" to "&&"
1 parent 1382811 commit 3127cea

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/Symfony/Component/Serializer/Encoder/JsonDecode.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,9 @@ public function decode($data, $format, array $context = array())
9595
$decodedData = json_decode($data, $associative, $recursionDepth);
9696
}
9797

98-
if (JSON_ERROR_NONE !== $this->lastError = json_last_error() and false === $decodedData) {
99-
throw new UnexpectedValueException(sprintf('Json decode error #%s: %s', json_last_error(), json_last_error_msg()));
98+
$this->lastError = json_last_error();
99+
if (JSON_ERROR_NONE !== $this->lastError && false === $decodedData) {
100+
throw new UnexpectedValueException(sprintf('Json decode error #%s: %s', $this->lastError, json_last_error_msg()));
100101
}
101102

102103
return $decodedData;

src/Symfony/Component/Serializer/Encoder/JsonEncode.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,9 @@ public function encode($data, $format, array $context = array())
5555

5656
$encodedJson = json_encode($data, $context['json_encode_options']);
5757

58-
if (JSON_ERROR_NONE !== $this->lastError and false === $encodedJson) {
59-
throw new UnexpectedValueException(sprintf('Json encode error #%s: %s', json_last_error(), json_last_error_msg()));
58+
$this->lastError = json_last_error();
59+
if (JSON_ERROR_NONE !== $this->lastError && false === $encodedJson) {
60+
throw new UnexpectedValueException(sprintf('Json encode error #%s: %s', $this->lastError, json_last_error_msg()));
6061
}
6162

6263
return $encodedJson;

0 commit comments

Comments
 (0)
0