1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00

Merge pull request #9479 from fluffycondor/json_throw_with_unescaped_unicode

This commit is contained in:
Bruce Weirdan 2023-03-11 22:04:09 -04:00 committed by GitHub
commit d6daaa842e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View File

@ -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

View File

@ -123,5 +123,13 @@ class CoreStubsTest extends TestCase
'$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',
],
];
}
}