在SO之前提出的一个问题之前,即How to resolve "Argument 1 passed to my_function() must be an instance of string, string given" prior to PHP 7?。我已经为此进行了测试但是double
出现了奇怪的错误,boolean
给了我一个错误
未捕获的TypeError:传递给A :: getData()的参数5必须是double的实例,float给定, 未捕获的TypeError:传递给A :: getData()的参数6必须是boolean的实例,给定布尔值,
class A{
/**
* [getData description]
* @param array $data [description]
* @param string $a [description]
* @param int $b [description]
* @param boolean $c [description]
* @param float $d [description]
* @return [type] [description]
*/
public function getData(array $data, string $a, int $b, float $f, double $d, boolean $c)
{}
}
$a = new A();
$a->getData(["as"],"assasa",12345, 64.153454, 65.41, true);
您可以通过here
进行检查答案 0 :(得分:2)
没有双重提示。并且boolean应该更改为bool。 您的PHPDoc控件也与te参数不匹配
/**
* [getData description]
* @param array $data [description]
* @param string $a [description]
* @param int $b [description]
* @param double $f [description]
* @param float $d [description]
* @param bool $c [description]
* @return [type] [description]
*/
public function getData(array $data, string $a, int $b, $f, float $d, bool $c)
{
}
$a->getData(["as"],"assasa",12345,65.41,64.153454 , true);