Skip to content

Commit

Permalink
Making json_encode() always produce a non-empty-string, when succ…
Browse files Browse the repository at this point in the history
…essful

`json_encode()` never produces `''` as a value: that would be invalid JSON anyway
  • Loading branch information
Ocramius committed Nov 7, 2022
1 parent 1986c8b commit 5e9b921
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dictionaries/CallMap.php
Expand Up @@ -6586,7 +6586,7 @@
'join' => ['string', 'separator'=>'string', 'array'=>'array'],
'join\'1' => ['string', 'separator'=>'array'],
'json_decode' => ['mixed', 'json'=>'string', 'associative='=>'bool', 'depth='=>'int', 'flags='=>'int'],
'json_encode' => ['string|false', 'value'=>'mixed', 'flags='=>'int', 'depth='=>'int'],
'json_encode' => ['non-empty-string|false', 'value'=>'mixed', 'flags='=>'int', 'depth='=>'int'],
'json_last_error' => ['int'],
'json_last_error_msg' => ['string'],
'JsonException::__clone' => ['void'],
Expand Down
2 changes: 1 addition & 1 deletion dictionaries/CallMap_historical.php
Expand Up @@ -12476,7 +12476,7 @@
'join\'1' => ['string', 'separator'=>'array'],
'jpeg2wbmp' => ['bool', 'jpegname'=>'string', 'wbmpname'=>'string', 'dest_height'=>'int', 'dest_width'=>'int', 'threshold'=>'int'],
'json_decode' => ['mixed', 'json'=>'string', 'associative='=>'bool', 'depth='=>'int', 'flags='=>'int'],
'json_encode' => ['string|false', 'value'=>'mixed', 'flags='=>'int', 'depth='=>'int'],
'json_encode' => ['non-empty-string|false', 'value'=>'mixed', 'flags='=>'int', 'depth='=>'int'],
'json_last_error' => ['int'],
'json_last_error_msg' => ['string'],
'judy_type' => ['int', 'array'=>'judy'],
Expand Down
2 changes: 1 addition & 1 deletion stubs/CoreGenericFunctions.phpstub
Expand Up @@ -1294,7 +1294,7 @@ function json_decode(string $json, ?bool $associative = null, int $depth = 512,
/**
* @psalm-pure
*
* @return ($flags is 4194304 ? string : string|false)
* @return ($flags is 4194304 ? non-empty-string : non-empty-string|false)
*
* @psalm-flow ($value) -> return
* @psalm-ignore-falsable-return
Expand Down

0 comments on commit 5e9b921

Please sign in to comment.