When you define a field as nullable array, updating one field in a context where it's not null results in an unwanted error:
class C {
/** @var array{a: string, b: string}|null */
private $a = null;
public function foo(): void {
if ($this->a !== null) {
$this->a['b'] = "baz";
}
}
}
Bug report
When you define a field as nullable array, updating one field in a context where it's not null results in an unwanted error:
Code snippet that reproduces the problem
https://phpstan.org/r/d5591f7c-b4e1-40bc-adce-15e4d846a4f7
Expected output
No error