键入带有 2 个条目的提示数组/数组的 phpdoc
type hinting array with 2 entries / phpdoc for array
说我有这个
function foo(){
return [1, 'bippo'];
}
我如何编写它在自动完成时自动创建的 phpdoc,就像这样
list($x, $y) = foo();
如phpDocumentor: Defining a 'Type' section Array中所述,您可以将包含多种类型的数组指定为@return (int|string)[]
,这意味着该函数的return类型是一个可以包含元素的数组是 int
或 string
类型
说我有这个
function foo(){
return [1, 'bippo'];
}
我如何编写它在自动完成时自动创建的 phpdoc,就像这样
list($x, $y) = foo();
如phpDocumentor: Defining a 'Type' section Array中所述,您可以将包含多种类型的数组指定为@return (int|string)[]
,这意味着该函数的return类型是一个可以包含元素的数组是 int
或 string