Skip to content

Commit

Permalink
Merge pull request #9479 from fluffycondor/json_throw_with_unescaped_…
Browse files Browse the repository at this point in the history
…unicode
  • Loading branch information
weirdan committed Mar 12, 2023
2 parents 20a2e66 + 7ba0f97 commit d6daaa8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
6 changes: 5 additions & 1 deletion stubs/CoreGenericFunctions.phpstub
Expand Up @@ -1467,7 +1467,11 @@ function json_decode(string $json, ?bool $associative = null, int $depth = 512,
/**
* @psalm-pure
*
* @return ($flags is 4194304 ? non-empty-string : non-empty-string|false)
* @return (
* $flags is 4194304
* ? non-empty-string
* : ($flags is 4194560 ? non-empty-string : non-empty-string|false)
* )
*
* @psalm-flow ($value) -> return
* @psalm-ignore-falsable-return
Expand Down
8 changes: 8 additions & 0 deletions tests/CoreStubsTest.php
Expand Up @@ -123,5 +123,13 @@ function foo(string $foo): string
'$a===' => 'string',
],
];
yield 'json_encode returns a non-empty-string provided JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE' => [
'code' => '<?php
$a = json_encode([], JSON_UNESCAPED_UNICODE | JSON_THROW_ON_ERROR);
',
'assertions' => [
'$a===' => 'non-empty-string',
],
];
}
}

0 comments on commit d6daaa8

Please sign in to comment.