forked from phpstan/phpstan-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbug-11610.php
More file actions
25 lines (21 loc) · 696 Bytes
/
bug-11610.php
File metadata and controls
25 lines (21 loc) · 696 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php declare(strict_types = 1);
namespace Bug11610;
use function PHPStan\Testing\assertType;
function sayHello(string $value): void
{
/** @var object{containers?: array<int>} $responseJson */
$responseJson = json_decode($value);
if (!is_array($responseJson->containers ?? null)) {
throw new \Exception();
}
assertType('object{containers: array<int>}', $responseJson);
}
function sayHello2(string $value): void
{
/** @var object{containers?: array<int>} $responseJson */
$responseJson = json_decode($value);
if (!isset($responseJson->containers) || !is_array($responseJson->containers)) {
throw new \Exception();
}
assertType('object{containers: array<int>}', $responseJson);
}