Utils: silence PHPStan warning about array_combine() result

phpstan doesn't account for having 2 arrays of the same size, and even if it did, the size cannot be inferred easily here.
This commit is contained in:
Dylan K. Taylor 2020-04-15 12:11:13 +01:00
parent 099562d582
commit a51a16a55c

View File

@ -616,7 +616,9 @@ class Utils{
public static function parseDocComment(string $docComment) : array{
preg_match_all('/(*ANYCRLF)^[\t ]*\* @([a-zA-Z]+)(?:[\t ]+(.+))?[\t ]*$/m', $docComment, $matches);
return array_combine($matches[1], $matches[2]);
$result = array_combine($matches[1], $matches[2]);
if($result === false) throw new AssumptionFailedError("array_combine() doesn't return false with two equal-sized arrays");
return $result;
}
/**