Summary of a problem or a feature request
json_decode has second parameter to determine if result is an array or \stdClass. It would be nice to catch cases when there's no assoc: true, and code is trying to access the result of json_decode as an array and vice versa.
Code snippet that reproduces the problem
No error for:
<?php declare(strict_types = 1);
$data = json_decode('{"foo": "bar"}');
$foo = $data['foo'];
https://phpstan.org/r/936624ae-ac3f-4f70-afad-e6480a19a6e6
Expected output
Cannot use object of type stdClass as array
https://3v4l.org/KCXIa