Skip to content

Commit

Permalink
Merge pull request #8681 from Ocramius/stubs/better-json-encode-types
Browse files Browse the repository at this point in the history
Making `json_encode()` always produce a `non-empty-string`, when successful
  • Loading branch information
orklah committed Nov 7, 2022
2 parents 1986c8b + 5e9b921 commit 4932337
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 4932337

Please sign in to comment.