-
-
Notifications
You must be signed in to change notification settings - Fork 946
Open
Labels
Milestone
Description
Bug report
In case of code:
<?php declare(strict_types = 1);
class HelloWorld
{
/**
* @param array{
* cr?: string,
* c?: string
* } $params
*/
public static function paramsToString(array $params): string
{
if (isset($params['cr']) === true || isset($params['c']) === true) {
return sprintf('-c%s', $params['cr'] ?? $params['c']);
}
return '';
}
}PhpStan will report:
Offset 'c' does not exist on array{cr?: string, c?: string}.
Live example: https://phpstan.org/r/f10dbfb6-e501-41e8-8a37-aa9e9a61489b
Related to: #6377
Thanks.
Reactions are currently unavailable