Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion resources/functionMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -5689,7 +5689,7 @@
'join' => ['string', 'glue'=>'string', 'pieces'=>'array'],
'join\'1' => ['string', 'pieces'=>'array'],
'jpeg2wbmp' => ['bool', 'jpegname'=>'string', 'wbmpname'=>'string', 'dest_height'=>'int', 'dest_width'=>'int', 'threshold'=>'int'],
'json_decode' => ['mixed', 'json'=>'string', 'assoc='=>'bool', 'depth='=>'positive-int', 'options='=>'int'],
'json_decode' => ['mixed[]|scalar|stdClass|null', 'json'=>'string', 'assoc='=>'bool', 'depth='=>'positive-int', 'options='=>'int'],
'json_encode' => ['string|false', 'data'=>'mixed', 'options='=>'int', 'depth='=>'positive-int'],
'json_last_error' => ['int'],
'json_last_error_msg' => ['string'],
Expand Down
6 changes: 3 additions & 3 deletions tests/PHPStan/Analyser/LegacyNodeScopeResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8699,15 +8699,15 @@ public function dataPhp73Functions(): array
'json_encode($mixed, $integer | JSON_THROW_ON_ERROR | JSON_NUMERIC_CHECK)',
],
[
'mixed',
'array|bool|float|int|stdClass|string|null',
'json_decode($mixed)',
],
[
'mixed',
'array|bool|float|int|stdClass|string|null',
'json_decode($mixed, false, 512, JSON_THROW_ON_ERROR | JSON_NUMERIC_CHECK)',
],
[
'mixed',
'array|bool|float|int|stdClass|string|null',
'json_decode($mixed, false, 512, $integer | JSON_THROW_ON_ERROR | JSON_NUMERIC_CHECK)',
],
[
Expand Down
10 changes: 5 additions & 5 deletions tests/PHPStan/Analyser/data/json-decode/json_object_as_array.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,27 @@
// @see https://3v4l.org/YFlHF
function ($mixed) {
$value = json_decode($mixed, null, 512, JSON_OBJECT_AS_ARRAY);
assertType('mixed~stdClass', $value);
assertType('array|bool|float|int|string|null', $value);
};

function ($mixed) {
$flagsAsVariable = JSON_OBJECT_AS_ARRAY;

$value = json_decode($mixed, null, 512, $flagsAsVariable);
assertType('mixed~stdClass', $value);
assertType('array|bool|float|int|string|null', $value);
};

function ($mixed) {
$value = json_decode($mixed, null, 512, JSON_OBJECT_AS_ARRAY | JSON_BIGINT_AS_STRING);
assertType('mixed~stdClass', $value);
assertType('array|bool|float|int|string|null', $value);
};

function ($mixed) {
$value = json_decode($mixed, null);
assertType('mixed', $value);
assertType('array|bool|float|int|stdClass|string|null', $value);
};

function ($mixed, $unknownFlags) {
$value = json_decode($mixed, null, 512, $unknownFlags);
assertType('mixed', $value);
assertType('array|bool|float|int|stdClass|string|null', $value);
};
4 changes: 2 additions & 2 deletions tests/PHPStan/Analyser/data/json-decode/narrow_type.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@

function ($mixed) {
$value = json_decode($mixed);
assertType('mixed', $value);
assertType('array|bool|float|int|stdClass|string|null', $value);
};

function ($mixed) {
$value = json_decode($mixed, false);
assertType('mixed', $value);
assertType('array|bool|float|int|stdClass|string|null', $value);
};
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@

function ($mixed) {
$value = json_decode($mixed, true);
assertType('mixed~stdClass', $value);
assertType('array|bool|float|int|string|null', $value);
};